File indexing completed on 2024-12-22 04:45:18
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "librocketchatrestapi-qt_export.h" 0010 #include "restapiabstractjob.h" 0011 #include <QDebug> 0012 namespace RocketChatRestApi 0013 { 0014 class LIBROCKETCHATRESTAPI_QT_EXPORT RunCommandJob : public RestApiAbstractJob 0015 { 0016 Q_OBJECT 0017 public: 0018 struct LIBROCKETCHATRESTAPI_QT_EXPORT RunCommandInfo { 0019 QString commandName; 0020 QString roomId; 0021 QString threadMessageId; 0022 QString triggerId; 0023 QString params; 0024 [[nodiscard]] bool isValid() const; 0025 }; 0026 explicit RunCommandJob(QObject *parent = nullptr); 0027 ~RunCommandJob() override; 0028 0029 [[nodiscard]] bool start() override; 0030 [[nodiscard]] bool requireHttpAuthentication() const override; 0031 [[nodiscard]] bool canStart() const override; 0032 [[nodiscard]] QNetworkRequest request() const override; 0033 0034 [[nodiscard]] QJsonDocument json() const; 0035 0036 [[nodiscard]] RunCommandInfo runCommandInfo() const; 0037 void setRunCommandInfo(const RunCommandInfo &runCommandInfo); 0038 0039 static RunCommandInfo parseString(const QString &str, const QString &roomId, const QString &tmid); 0040 Q_SIGNALS: 0041 void runCommandDone(); 0042 0043 private: 0044 Q_DISABLE_COPY(RunCommandJob) 0045 LIBROCKETCHATRESTAPI_QT_NO_EXPORT void onPostRequestResponse(const QString &replyErrorString, const QJsonDocument &replyJson) override; 0046 RunCommandInfo mRunCommandInfo; 0047 }; 0048 } 0049 Q_DECLARE_METATYPE(RocketChatRestApi::RunCommandJob::RunCommandInfo) 0050 Q_DECLARE_TYPEINFO(RocketChatRestApi::RunCommandJob::RunCommandInfo, Q_RELOCATABLE_TYPE); 0051 LIBROCKETCHATRESTAPI_QT_EXPORT QDebug operator<<(QDebug d, const RocketChatRestApi::RunCommandJob::RunCommandInfo &t);