File indexing completed on 2024-12-22 04:45:24
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 namespace RocketChatRestApi 0012 { 0013 class LIBROCKETCHATRESTAPI_QT_EXPORT RoleUpdateJob : public RestApiAbstractJob 0014 { 0015 Q_OBJECT 0016 public: 0017 struct LIBROCKETCHATRESTAPI_QT_EXPORT RoleUpdateInfo { 0018 QString name; 0019 QString description; 0020 QString scope; 0021 QString identifier; 0022 bool mandatory2fa = false; 0023 [[nodiscard]] bool isValid() const 0024 { 0025 return !name.isEmpty() && !scope.isEmpty() && !identifier.isEmpty(); 0026 } 0027 }; 0028 explicit RoleUpdateJob(QObject *parent = nullptr); 0029 ~RoleUpdateJob() override; 0030 0031 [[nodiscard]] bool start() override; 0032 [[nodiscard]] bool requireHttpAuthentication() const override; 0033 [[nodiscard]] bool canStart() const override; 0034 [[nodiscard]] QNetworkRequest request() const override; 0035 0036 [[nodiscard]] QJsonDocument json() const; 0037 [[nodiscard]] RoleUpdateInfo updateRoleInfo() const; 0038 void setUpdateRoleInfo(const RoleUpdateInfo &statusCreateInfo); 0039 0040 Q_SIGNALS: 0041 void updateRoleDone(); 0042 0043 private: 0044 Q_DISABLE_COPY(RoleUpdateJob) 0045 LIBROCKETCHATRESTAPI_QT_NO_EXPORT void onPostRequestResponse(const QString &replyErrorString, const QJsonDocument &replyJson) override; 0046 RoleUpdateInfo mRoleCreateInfo; 0047 }; 0048 }