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

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2019 David Barchiesi <david@barchie.si>
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 #include "drivessearchquery.h"
0015 
0016 namespace KGAPI2
0017 {
0018 
0019 namespace Drive
0020 {
0021 
0022 class KGAPIDRIVE_EXPORT DrivesFetchJob : public KGAPI2::FetchJob
0023 {
0024     Q_OBJECT
0025 
0026     /**
0027      * Maximum number of shared drives to return. Acceptable
0028      * values are 1 to 100, inclusive
0029      *
0030      * Default value if missing is 10.
0031      *
0032      * This property does not have any effect when fetching a specific event and
0033      * can be modified only when the job is not running.
0034      */
0035     Q_PROPERTY(int maxResults READ maxResults WRITE setMaxResults)
0036 
0037     /**
0038      * Issue the request as a domain administrator; if set to true, then all
0039      * shared Drives of the domain in which the requester is an administrator
0040      * are returned.
0041      *
0042      * Default value if missing is false.
0043      *
0044      * This property does not have any effect when fetching a specific event and
0045      * can be modified only when the job is not running.
0046      */
0047     Q_PROPERTY(bool useDomainAdminAccess READ useDomainAdminAccess WRITE setUseDomainAdminAccess)
0048 
0049 public:
0050     DrivesFetchJob(const DrivesSearchQuery &query, const AccountPtr &account, QObject *parent = nullptr);
0051     DrivesFetchJob(const AccountPtr &account, QObject *parent = nullptr);
0052     DrivesFetchJob(const QString &drivesId, const AccountPtr &account, QObject *parent = nullptr);
0053     ~DrivesFetchJob() override;
0054 
0055     int maxResults() const;
0056     void setMaxResults(int maxResults);
0057 
0058     void setUseDomainAdminAccess(bool useDomainAdminAccess);
0059     [[nodiscard]] bool useDomainAdminAccess() const;
0060 
0061     void setFields(const QStringList &fields);
0062     [[nodiscard]] QStringList fields() const;
0063 
0064 protected:
0065     void start() override;
0066     KGAPI2::ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
0067 
0068 private:
0069     class Private;
0070     QScopedPointer<Private> d;
0071     friend class Private;
0072 
0073     void applyRequestParameters(QUrl &url);
0074 };
0075 
0076 } // namespace Drive
0077 
0078 } // namespace KGAPI2