1 | // Copyright (C) 2023 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QGRPCALLOPTIONS_H |
5 | #define QGRPCALLOPTIONS_H |
6 | |
7 | #include <QtCore/QUrl> |
8 | #include <QtGrpc/qgrpcmetadata.h> |
9 | #include <QtGrpc/qtgrpcglobal.h> |
10 | |
11 | #include <chrono> |
12 | #include <memory> |
13 | #include <optional> |
14 | |
15 | QT_BEGIN_NAMESPACE |
16 | |
17 | struct QGrpcCallOptionsPrivate; |
18 | |
19 | class Q_GRPC_EXPORT QGrpcCallOptions final |
20 | { |
21 | public: |
22 | QGrpcCallOptions(); |
23 | ~QGrpcCallOptions(); |
24 | |
25 | QGrpcCallOptions(const QGrpcCallOptions &other); |
26 | QGrpcCallOptions &operator=(const QGrpcCallOptions &other); |
27 | |
28 | QGrpcCallOptions &withDeadline(std::chrono::milliseconds deadline); |
29 | QGrpcCallOptions &withMaxRetryAttempts(qint64 maxRetryAttempts); |
30 | QGrpcCallOptions &withMetadata(const QGrpcMetadata &metadata); |
31 | |
32 | std::optional<std::chrono::milliseconds> deadline() const; |
33 | std::optional<qint64> maxRetryAttempts() const; |
34 | QGrpcMetadata metadata() const; |
35 | |
36 | private: |
37 | std::unique_ptr<QGrpcCallOptionsPrivate> dPtr; |
38 | }; |
39 | |
40 | QT_END_NAMESPACE |
41 | |
42 | #endif // QGRPCALLOPTIONS_H |
43 |