// Copyright (C) 2022 The Qt Company Ltd. // Copyright (C) 2019 Alexey Edelev // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #ifndef QGRPCLIENTBASE_H #define QGRPCLIENTBASE_H #include #include #include #include #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QProtobufMessage; class QGrpcClientBasePrivate; class Q_GRPC_EXPORT QGrpcClientBase : public QObject { Q_OBJECT Q_PROPERTY(std::shared_ptr channel READ channel WRITE attachChannel NOTIFY channelChanged) public: ~QGrpcClientBase() override; bool attachChannel(std::shared_ptr channel); [[nodiscard]] std::shared_ptr channel() const; Q_SIGNALS: void channelChanged(); protected: explicit QGrpcClientBase(QLatin1StringView service, QObject *parent = nullptr); std::unique_ptr call(QLatin1StringView method, const QProtobufMessage &arg, const QGrpcCallOptions &options); std::unique_ptr serverStream(QLatin1StringView method, const QProtobufMessage &arg, const QGrpcCallOptions &options); std::unique_ptr clientStream(QLatin1StringView method, const QProtobufMessage &arg, const QGrpcCallOptions &options); std::unique_ptr bidiStream(QLatin1StringView method, const QProtobufMessage &arg, const QGrpcCallOptions &options); private: Q_DISABLE_COPY_MOVE(QGrpcClientBase) Q_DECLARE_PRIVATE(QGrpcClientBase) public: bool event(QEvent *event) override; }; QT_END_NAMESPACE #endif // QGRPCLIENTBASE_H