1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QGRPCHANNELOPTIONS_H
5#define QGRPCHANNELOPTIONS_H
6
7#include <QtCore/QUrl>
8#include <QtGrpc/qgrpcmetadata.h>
9#include <QtGrpc/qtgrpcglobal.h>
10
11#if QT_CONFIG(ssl)
12# include <QtNetwork/QSslConfiguration>
13#endif
14
15#include <chrono>
16#include <memory>
17#include <optional>
18
19QT_BEGIN_NAMESPACE
20
21class QSslConfiguration;
22struct QGrpcChannelOptionsPrivate;
23
24class Q_GRPC_EXPORT QGrpcChannelOptions final
25{
26public:
27 explicit QGrpcChannelOptions(const QUrl &host);
28 ~QGrpcChannelOptions();
29
30 QGrpcChannelOptions(const QGrpcChannelOptions &other);
31 QGrpcChannelOptions &operator=(const QGrpcChannelOptions &other);
32
33 QGrpcChannelOptions &withHost(const QUrl &host);
34 QGrpcChannelOptions &withDeadline(std::chrono::milliseconds deadline);
35 QGrpcChannelOptions &withMetadata(const QGrpcMetadata &metadata);
36
37 QUrl host() const;
38 std::optional<std::chrono::milliseconds> deadline() const;
39 QGrpcMetadata metadata() const;
40
41#if QT_CONFIG(ssl)
42 QGrpcChannelOptions &withSslConfiguration(const QSslConfiguration &sslConfiguration);
43 std::optional<QSslConfiguration> sslConfiguration() const;
44#endif
45
46private:
47 std::unique_ptr<QGrpcChannelOptionsPrivate> dPtr;
48};
49QT_END_NAMESPACE
50
51#endif // QGRPCHANNELOPTIONS_H
52

source code of qtgrpc/src/grpc/qgrpcchanneloptions.h