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 "librestapi_private_export.h"
0010 #include "restapiabstractjob.h"
0011 
0012 namespace RocketChatRestApi
0013 {
0014 class LIBROCKETCHATRESTAPI_QT_TESTS_EXPORT UsersAutocompleteJob : public RestApiAbstractJob
0015 {
0016     Q_OBJECT
0017 public:
0018     struct LIBROCKETCHATRESTAPI_QT_TESTS_EXPORT UsersAutocompleterInfo {
0019         [[nodiscard]] bool isValid() const;
0020 
0021         QString pattern;
0022         QString exception;
0023     };
0024 
0025     explicit UsersAutocompleteJob(QObject *parent = nullptr);
0026     ~UsersAutocompleteJob() override;
0027 
0028     [[nodiscard]] bool requireHttpAuthentication() const override;
0029 
0030     [[nodiscard]] bool start() override;
0031 
0032     [[nodiscard]] bool canStart() const override;
0033 
0034     [[nodiscard]] QNetworkRequest request() const override;
0035 
0036     [[nodiscard]] UsersAutocompleterInfo usersCompleterInfo() const;
0037     void setUsersCompleterInfo(const UsersAutocompleterInfo &usersCompleterInfo);
0038 
0039 Q_SIGNALS:
0040     void usersAutocompleteDone(const QJsonObject &obj);
0041 
0042 private:
0043     Q_DISABLE_COPY(UsersAutocompleteJob)
0044     void onGetRequestResponse(const QString &replyErrorString, const QJsonDocument &replyJson) override;
0045     UsersAutocompleterInfo mUsersCompleterInfo;
0046 };
0047 }