File indexing completed on 2024-12-22 04:45:26
0001 /* 0002 SPDX-FileCopyrightText: 2022-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 0012 namespace RocketChatRestApi 0013 { 0014 class LIBROCKETCHATRESTAPI_QT_EXPORT UpdateAdminSettingsJob : public RestApiAbstractJob 0015 { 0016 Q_OBJECT 0017 public: 0018 struct UpdateAdminSettingsInfo { 0019 enum ValueType { 0020 Unknown, 0021 Boolean, 0022 Integer, 0023 String, 0024 }; 0025 0026 QString settingName; 0027 QVariant settingsValue; 0028 UpdateAdminSettingsInfo::ValueType valueType = UpdateAdminSettingsInfo::ValueType::Unknown; 0029 [[nodiscard]] bool isValid() const; 0030 [[nodiscard]] bool canStart() const; 0031 }; 0032 explicit UpdateAdminSettingsJob(QObject *parent = nullptr); 0033 ~UpdateAdminSettingsJob() override; 0034 0035 [[nodiscard]] bool start() override; 0036 [[nodiscard]] bool requireHttpAuthentication() const override; 0037 [[nodiscard]] bool canStart() const override; 0038 [[nodiscard]] QNetworkRequest request() const override; 0039 0040 [[nodiscard]] QJsonDocument json() const; 0041 [[nodiscard]] const UpdateAdminSettingsInfo &updateAdminSettingsInfo() const; 0042 void setUpdateAdminSettingsInfo(const UpdateAdminSettingsInfo &newInfo); 0043 0044 [[nodiscard]] bool requireTwoFactorAuthentication() const override; 0045 0046 Q_SIGNALS: 0047 void updateAdminSettingsDone(const QJsonObject &obj); 0048 0049 private: 0050 Q_DISABLE_COPY(UpdateAdminSettingsJob) 0051 LIBROCKETCHATRESTAPI_QT_NO_EXPORT void onPostRequestResponse(const QString &replyErrorString, const QJsonDocument &replyJson) override; 0052 UpdateAdminSettingsInfo mInfo; 0053 }; 0054 }