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

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
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 "kgapidrive_export.h"
0013 
0014 namespace KGAPI2
0015 {
0016 namespace Drive
0017 {
0018 
0019 class KGAPIDRIVE_EXPORT FileFetchContentJob : public KGAPI2::FetchJob
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit FileFetchContentJob(const FilePtr &file, const AccountPtr &account, QObject *parent = nullptr);
0025     explicit FileFetchContentJob(const QUrl &url, const AccountPtr &account, QObject *parent = nullptr);
0026     ~FileFetchContentJob() override;
0027 
0028     [[nodiscard]] QByteArray data() const;
0029 
0030 protected:
0031     void start() override;
0032     void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override;
0033     void dispatchRequest(QNetworkAccessManager *accessManager, const QNetworkRequest &request, const QByteArray &data, const QString &contentType) override;
0034 
0035     KGAPI2::ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
0036 
0037 private:
0038     class Private;
0039     Private *const d;
0040     friend class Private;
0041 };
0042 
0043 } // namespace Drive
0044 
0045 } // namespace KGAPI2