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

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