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

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 
0017 namespace Drive
0018 {
0019 
0020 class KGAPIDRIVE_EXPORT ChangeFetchJob : public KGAPI2::FetchJob
0021 {
0022     Q_OBJECT
0023 
0024     /**
0025      * Whether to include deleted items.
0026      *
0027      * By default deletes items are included.
0028      *
0029      * This property does not have any effect when fetching a specific change and
0030      * can be modified only when the job is not running.
0031      */
0032     Q_PROPERTY(bool includeDeleted READ includeDeleted WRITE setIncludeDeleted)
0033 
0034     /**
0035      * Whether to include shared files and public files the user has opened.
0036      * When set to false, the list will include owned files plus any shared or
0037      * public files the user has explicitly added to a folder in Drive.
0038      *
0039      * Default is to include subscribed files.
0040      *
0041      * This property does not have any effect when fetching a specific event and
0042      * can be modified only when the job is not running.
0043      */
0044     Q_PROPERTY(bool includeSubscribed READ includeSubscribed WRITE setIncludeSubscribed)
0045 
0046     /**
0047      * Maximum number of changes to return.
0048      *
0049      * Default value is 0, i.e. no limit.
0050      *
0051      * This property does not have any effect when fetching a specific event and
0052      * can be modified only when the job is not running.
0053      */
0054     Q_PROPERTY(int maxResults READ maxResults WRITE setMaxResults)
0055 
0056     /**
0057      * Change ID to start listing changes from.
0058      *
0059      * Default value is 0, i.e. all changes.
0060      *
0061      * This property does not have any effect when fetching a specific event and
0062      * can be modified only when the job is not running.
0063      */
0064     Q_PROPERTY(qlonglong startChangeId READ startChangeId WRITE setStartChangeId)
0065 
0066 public:
0067     explicit ChangeFetchJob(const AccountPtr &account, QObject *parent = nullptr);
0068     explicit ChangeFetchJob(const QString &changeId, const AccountPtr &account, QObject *parent = nullptr);
0069     ~ChangeFetchJob() override;
0070 
0071     [[nodiscard]] bool includeSubscribed() const;
0072     void setIncludeSubscribed(bool includeSubscribed);
0073 
0074     [[nodiscard]] bool includeDeleted() const;
0075     void setIncludeDeleted(bool includeDeleted);
0076 
0077     [[nodiscard]] int maxResults() const;
0078     void setMaxResults(int maxResults);
0079 
0080     [[nodiscard]] qlonglong startChangeId() const;
0081     void setStartChangeId(qlonglong startChangeId);
0082 
0083     /**
0084      * @brief Whether both My Drive and shared drive items should be included in results.
0085      *
0086      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards shared drive items will be included in the results.
0087      */
0088     KGAPIDRIVE_DEPRECATED bool includeItemsFromAllDrives() const;
0089 
0090     /**
0091      * @brief Sets whether both My Drive and shared drive items should be included in results.
0092      *
0093      * Set to true by default as LibKGAPI supports Team Drives.
0094      *
0095      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards shared drive items will be included in the results.
0096      */
0097     KGAPIDRIVE_DEPRECATED void setIncludeItemsFromAllDrives(bool includeItemsFromAllDrives);
0098 
0099     /**
0100      * @brief Whether the request supports both My Drives and shared drives.
0101      *
0102      * Set to true by default as LibKGAPI supports Team Drives.
0103      *
0104      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards all applications
0105      * are assumed to support shared drives.
0106      */
0107     KGAPIDRIVE_DEPRECATED bool supportsAllDrives() const;
0108 
0109     /**
0110      * @brief Sets whether the request supports both My Drives and shared drives.
0111      *
0112      * Set to true by default as LibKGAPI supports Team Drives.
0113      *
0114      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards all applications
0115      * are assumed to support shared drives.
0116      */
0117     KGAPIDRIVE_DEPRECATED void setSupportsAllDrives(bool supportsAllDrives);
0118 
0119 protected:
0120     void start() override;
0121     KGAPI2::ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
0122 
0123 private:
0124     class Private;
0125     Private *const d;
0126     friend class Private;
0127 };
0128 
0129 } // namespace Drive
0130 
0131 } // namespace KGAPI2