File indexing completed on 2024-12-22 04:45:29
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 "createupdateuserinfo.h" 0010 #include "librocketchatrestapi-qt_export.h" 0011 #include "restapiabstractjob.h" 0012 0013 namespace RocketChatRestApi 0014 { 0015 class LIBROCKETCHATRESTAPI_QT_EXPORT UsersCreateJob : public RestApiAbstractJob 0016 { 0017 Q_OBJECT 0018 public: 0019 explicit UsersCreateJob(QObject *parent = nullptr); 0020 ~UsersCreateJob() override; 0021 0022 [[nodiscard]] bool start() override; 0023 [[nodiscard]] bool requireHttpAuthentication() const override; 0024 [[nodiscard]] bool canStart() const override; 0025 [[nodiscard]] QNetworkRequest request() const override; 0026 0027 [[nodiscard]] QJsonDocument json() const; 0028 0029 [[nodiscard]] CreateUpdateUserInfo createInfo() const; 0030 void setCreateInfo(const CreateUpdateUserInfo &createInfo); 0031 0032 Q_SIGNALS: 0033 void usersCreateDone(const QJsonObject &obj); 0034 0035 protected: 0036 [[nodiscard]] QString errorMessage(const QString &str, const QJsonObject &detail) override; 0037 0038 private: 0039 Q_DISABLE_COPY(UsersCreateJob) 0040 LIBROCKETCHATRESTAPI_QT_NO_EXPORT void onPostRequestResponse(const QString &replyErrorString, const QJsonDocument &replyJson) override; 0041 CreateUpdateUserInfo mCreateInfo; 0042 }; 0043 }