File indexing completed on 2024-05-12 05:22:29

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@kde.org>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #pragma once
0010 
0011 #include "fetchjob.h"
0012 #include "kgapipeople_export.h"
0013 
0014 namespace KGAPI2::People
0015 {
0016 
0017 class KGAPIPEOPLE_EXPORT PersonFetchJob : public KGAPI2::FetchJob
0018 {
0019     Q_OBJECT
0020     Q_PROPERTY(QString syncToken READ syncToken WRITE setSyncToken NOTIFY syncTokenChanged)
0021     Q_PROPERTY(QString receivedSyncToken READ receivedSyncToken NOTIFY receivedSyncTokenChanged)
0022 
0023 public:
0024     explicit PersonFetchJob(const AccountPtr &account, QObject* parent = nullptr);
0025     explicit PersonFetchJob(const QString &resourceName, const AccountPtr &account, QObject* parent = nullptr);
0026     ~PersonFetchJob();
0027 
0028     [[nodiscard]] QString syncToken() const;
0029     [[nodiscard]] QString receivedSyncToken() const;
0030 
0031 public Q_SLOTS:
0032     void setSyncToken(const QString &syncToken);
0033 
0034 Q_SIGNALS:
0035     void syncTokenChanged();
0036     void receivedSyncTokenChanged();
0037 
0038 protected:
0039     void start() override;
0040     ObjectsList handleReplyWithItems(const QNetworkReply *reply,
0041                                      const QByteArray &rawData) override;
0042 
0043 private:
0044     class Private;
0045     std::unique_ptr<Private> d;
0046     friend class Private;
0047 };
0048 
0049 }