File indexing completed on 2024-12-22 04:45:26
0001 /* 0002 SPDX-FileCopyrightText: 2018-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 namespace RocketChatRestApi 0012 { 0013 class LIBROCKETCHATRESTAPI_QT_TESTS_EXPORT MarkRoomAsUnReadJob : public RestApiAbstractJob 0014 { 0015 Q_OBJECT 0016 public: 0017 // Since 0.65 0018 explicit MarkRoomAsUnReadJob(QObject *parent = nullptr); 0019 ~MarkRoomAsUnReadJob() override; 0020 0021 enum MarkAsUnReadObject { Unknown = 0, FromMessage, Room }; 0022 0023 [[nodiscard]] bool start() override; 0024 [[nodiscard]] bool requireHttpAuthentication() const override; 0025 [[nodiscard]] bool canStart() const override; 0026 [[nodiscard]] QNetworkRequest request() const override; 0027 0028 [[nodiscard]] QJsonDocument json() const; 0029 0030 [[nodiscard]] MarkAsUnReadObject unReadObject() const; 0031 void setUnReadObject(MarkAsUnReadObject type); 0032 0033 [[nodiscard]] QString objectId() const; 0034 void setObjectId(const QString &objectId); 0035 0036 Q_SIGNALS: 0037 void markAsUnReadDone(); 0038 0039 protected: 0040 [[nodiscard]] QString errorMessage(const QString &str, const QJsonObject &detail) override; 0041 0042 private: 0043 Q_DISABLE_COPY(MarkRoomAsUnReadJob) 0044 void onPostRequestResponse(const QString &replyErrorString, const QJsonDocument &replyJson) override; 0045 QString mObjectId; 0046 MarkAsUnReadObject mUnReadObject = Unknown; 0047 }; 0048 }