File indexing completed on 2024-05-19 05:03:33
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 "userbasejob.h" 0011 #include <QPointer> 0012 0013 #include <QNetworkRequest> 0014 namespace RocketChatRestApi 0015 { 0016 class LIBROCKETCHATRESTAPI_QT_TESTS_EXPORT GetAvatarJob : public UserBaseJob 0017 { 0018 Q_OBJECT 0019 public: 0020 explicit GetAvatarJob(QObject *parent = nullptr); 0021 ~GetAvatarJob() override; 0022 0023 [[nodiscard]] bool start() override; 0024 [[nodiscard]] bool requireHttpAuthentication() const override; 0025 0026 [[nodiscard]] QNetworkRequest request() const override; 0027 0028 [[nodiscard]] bool canStart() const override; 0029 0030 protected: 0031 [[nodiscard]] QString jobName() const override; 0032 0033 Q_SIGNALS: 0034 void avatar(const UserBaseJob::UserInfo &info, const QUrl &url); 0035 void redownloadAvatar(); 0036 0037 private: 0038 Q_DISABLE_COPY(GetAvatarJob) 0039 LIBROCKETCHATRESTAPI_QT_NO_EXPORT void onGetRequestResponse(const QString &replyErrorString, const QJsonDocument &replyJson) override; 0040 }; 0041 }