File indexing completed on 2024-06-02 05:07:08
0001 /* 0002 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "librestapi_private_export.h" 0010 #include "restapiabstractjob.h" 0011 0012 namespace RocketChatRestApi 0013 { 0014 class LIBROCKETCHATRESTAPI_QT_TESTS_EXPORT GetThreadsJob : public RestApiAbstractJob 0015 { 0016 Q_OBJECT 0017 public: 0018 enum class TheadSearchType { 0019 All = 0, 0020 Following, 0021 Unread, 0022 }; 0023 explicit GetThreadsJob(QObject *parent = nullptr); 0024 ~GetThreadsJob() override; 0025 0026 [[nodiscard]] bool canStart() const override; 0027 0028 [[nodiscard]] bool requireHttpAuthentication() const override; 0029 0030 [[nodiscard]] bool start() override; 0031 0032 [[nodiscard]] QNetworkRequest request() const override; 0033 0034 [[nodiscard]] QString roomId() const; 0035 void setRoomId(const QString &roomId); 0036 [[nodiscard]] bool hasQueryParameterSupport() const override; 0037 0038 [[nodiscard]] TheadSearchType searchType() const; 0039 void setSearchType(TheadSearchType newSearchType); 0040 0041 Q_SIGNALS: 0042 void getThreadsDone(const QJsonObject &obj, const QString &roomId); 0043 0044 private: 0045 Q_DISABLE_COPY(GetThreadsJob) 0046 void onGetRequestResponse(const QString &replyErrorString, const QJsonDocument &replyJson) override; 0047 TheadSearchType mSearchType = TheadSearchType::All; 0048 QString mRoomId; 0049 }; 0050 }