Kgapi

aboutfetchjob.h
1/*
2 * This file is part of LibKGAPI library
3 *
4 * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#pragma once
10
11#include "fetchjob.h"
12#include "kgapidrive_export.h"
13
14namespace KGAPI2
15{
16
17namespace Drive
18{
19
20/**
21 * @brief A fetch job that retrieves DriveAbout data.
22 */
23class KGAPIDRIVE_EXPORT AboutFetchJob : public KGAPI2::FetchJob
24{
25 Q_OBJECT
26
27 /**
28 * @brief Whether to include shared and public files to change IDs count
29 *
30 * When calculating the number of remaining change IDs, whether to include
31 * shared files and public files the user has opened. When set to false, this
32 * counts only change IDs for owned files and any shared or public files that
33 * the user has explicitly added to a folder in Drive.
34 *
35 * Default value is true.
36 *
37 * This property can be modified only when the job is not running.
38 */
39 Q_PROPERTY(bool includeSubscribed READ includeSubscribed WRITE setIncludeSubscribed)
40
41 /**
42 * @brief Maximum number of remaining change IDs to count.
43 *
44 * Default value is 0, i.e. no limit
45 *
46 * This property can be modified only when the job is not running.
47 */
48 Q_PROPERTY(qlonglong maxChangeIdCount READ maxChangeIdCount WRITE setMaxChangeIdCount)
49
50 /**
51 * @brief Change ID to start counting from when calculating number of
52 * remaining change IDs.
53 *
54 * Default value is 0, i.e. first ID
55 *
56 * This property can be modified only when the job is not running.
57 */
58 Q_PROPERTY(qlonglong startChangeId READ startChangeId WRITE setStartChangeId)
59
60public:
61 /**
62 * @brief Constructs a new fetch job.
63 *
64 * The @p account must be authenticated with one of the following scopes:
65 * <ul>
66 * <li>https://www.googleapis.com/auth/drive.readonly.metadata</li>
67 * <li>https://www.googleapis.com/auth/drive.readonly</li>
68 * <li>https://www.googleapis.com/auth/drive</li>
69 * <li>https://www.googleapis.com/auth/drive.file</li>
70 * <li>https://www.googleapis.com/auth/drive.metadata.readonly</li>
71 * </ul>
72 *
73 * @param account Account to authenticate the request with
74 * @param parent
75 */
76 explicit AboutFetchJob(const AccountPtr &account, QObject *parent = nullptr);
77 ~AboutFetchJob() override;
78
79 /**
80 * @brief Returns whether to include shared and public files to change IDs count.
81 */
82 [[nodiscard]] bool includeSubscribed() const;
83
84 /**
85 * @brief Sets whether to include shared and public files to change IDs count.
86 *
87 * @param includeSubscribed
88 */
89 void setIncludeSubscribed(bool includeSubscribed);
90
91 /**
92 * @brief Returns maximum number of remaining change IDs to count.
93 */
94 [[nodiscard]] qlonglong maxChangeIdCount() const;
95
96 /**
97 * @brief Sets maximum number of remaining change IDs to count.
98 *
99 * @param maxChangeIdCount
100 */
101 void setMaxChangeIdCount(qlonglong maxChangeIdCount);
102
103 /**
104 * @brief Returns change ID to start counting from when calculating number of
105 * remaining change IDs.
106 */
107 [[nodiscard]] qlonglong startChangeId() const;
108
109 /**
110 * @brief Sets change ID to start counting from when calculating number of
111 * remaining change IDs.
112 *
113 * @param startChangeId
114 */
115 void setStartChangeId(qlonglong startChangeId);
116
117 /**
118 * @brief Returns the retrieved DriveAbout object
119 *
120 * This method can only be called after the job has emitted finished()
121 */
122 [[nodiscard]] AboutPtr aboutData() const;
123
124protected:
125 /**
126 * @brief KGAPI2::Job::start implementation
127 */
128 void start() override;
129
130 /**
131 * @brief KGAPI2::Job::handleReply implementation
132 *
133 * @param reply
134 * @param rawData
135 */
136 KGAPI2::ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
137
138private:
139 class Private;
140 Private *const d;
141 friend class Private;
142};
143
144} // namespace Drive
145
146} // namespace KGAPI2
A fetch job that retrieves DriveAbout data.
Abstract superclass for all jobs that fetch resources from Google.
Definition fetchjob.h:25
Q_SCRIPTABLE Q_NOREPLY void start()
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.