Kgapi

drives.h
1/*
2 SPDX-FileCopyrightText: 2019 David Barchiesi <david@barchie.si>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#pragma once
8
9#include "kgapidrive_export.h"
10#include "object.h"
11#include "types.h"
12
13#include <QString>
14
15#include <QDateTime>
16
17namespace KGAPI2
18{
19
20namespace Drive
21{
22
23/**
24 * @brief Drives contains a representation of a Drive.
25 *
26 * Getters and setters' documentation is based on Google Drive's API v2 reference
27 * @see <a href="https://developers.google.com/drive/v2/reference/drives">Drives</a>
28 *
29 * @since 5.11.41
30 * @author David Barchiesi <david@barchie.si>
31 */
32class KGAPIDRIVE_EXPORT Drives : public KGAPI2::Object
33{
34public:
35 /**
36 * @brief Drives::Restrictions holds the structure used for
37 * a set of restrictions that apply to this shared drive
38 * or items inside this shared drive.
39 */
41 {
42 public:
43 struct Fields {
44 static const QString AdminManagedRestrictions;
45 static const QString CopyRequiresWriterPermission;
46 static const QString DomainUsersOnly;
47 static const QString DriveMembersOnly;
48 };
49
51 Restrictions(const Restrictions &other);
53 bool operator==(const Restrictions &other) const;
54 bool operator!=(const Restrictions &other) const
55 {
56 return !operator==(other);
57 }
58
59 /**
60 * @brief Returns whether administrative privileges on this shared
61 * drive are required to modify restrictions.
62 */
63 bool adminManagedRestrictions() const;
64
65 /**
66 * @brief Sets whether administrative privileges on this shared drive
67 * are required to modify restrictions.
68 *
69 * @param adminManagedRestrictions
70 */
71 void setAdminManagedRestrictions(bool adminManagedRestrictions) const;
72
73 /**
74 * @brief Returns whether the options to copy, print, or download files
75 * inside this shared drive, should be disabled for readers and commenters.
76 * When this restriction is set to true, it will override the similarly
77 * named field to true for any file inside this shared drive.
78 */
79 [[nodiscard]] bool copyRequiresWriterPermission() const;
80
81 /**
82 * @brief Sets whether the options to copy, print, or download files
83 * inside this shared drive, should be disabled for readers and commenters.
84 * When this restriction is set to true, it will override the similarly
85 * named field to true for any file inside this shared drive.
86 *
87 * @param copyRequiresWriterPermission
88 */
89 void setCopyRequiresWriterPermission(bool copyRequiresWriterPermission) const;
90
91 /**
92 * @brief Returns whether access to this shared drive and items inside
93 * this shared drive is restricted to users of the domain to which this
94 * shared drive belongs. This restriction may be overridden by other
95 * sharing policies controlled outside of this shared drive.
96 */
97 [[nodiscard]] bool domainUsersOnly() const;
98
99 /**
100 * @brief Sets whether access to this shared drive and items inside this
101 * shared drive is restricted to users of the domain to which this
102 * shared drive belongs. This restriction may be overridden by other
103 * sharing policies controlled outside of this shared drive.
104 *
105 * @param domainUsersOnly
106 */
107 void setDomainUsersOnly(bool domainUsersOnly) const;
108
109 /**
110 * @brief Returns whether access to items inside this shared drive is
111 * restricted to its members.
112 */
113 [[nodiscard]] bool driveMembersOnly() const;
114
115 /**
116 * @brief Sets whether access to items inside this shared drive is
117 * restricted to its members.
118 *
119 * @param driveMembersOnly
120 */
121 void setDriveMembersOnly(bool driveMembersOnly) const;
122
123 private:
124 class Private;
126 friend class Private;
127 friend class Drives;
128 };
129
131
132 /**
133 * @brief Drives::Capabilities holds the structure used for
134 * capabilities the current user has on this shared drive.
135 */
137 {
138 public:
139 struct Fields {
140 static const QString CanAddChildren;
141 static const QString CanChangeCopyRequiresWriterPermissionRestriction;
142 static const QString CanChangeDomainUsersOnlyRestriction;
143 static const QString CanChangeDriveBackground;
144 static const QString CanChangeDriveMembersOnlyRestriction;
145 static const QString CanComment;
146 static const QString CanCopy;
147 static const QString CanDeleteChildren;
148 static const QString CanDeleteDrive;
149 static const QString CanDownload;
150 static const QString CanEdit;
151 static const QString CanListChildren;
152 static const QString CanManageMembers;
153 static const QString CanReadRevisions;
154 static const QString CanRename;
155 static const QString CanRenameDrive;
156 static const QString CanShare;
157 static const QString CanTrashChildren;
158 };
159
160 Capabilities();
161 Capabilities(const Capabilities &other);
163 bool operator==(const Capabilities &other) const;
164 bool operator!=(const Capabilities &other) const
165 {
166 return !operator==(other);
167 }
168
169 /**
170 * @brief Returns whether the current user can add children to folders
171 * in this shared drive.
172 */
173 bool canAddChildren() const;
174
175 /**
176 * @brief Returns whether the current user can change the
177 * copyRequiresWriterPermission restriction of this shared drive.
178 */
179 bool canChangeCopyRequiresWriterPermissionRestriction() const;
180
181 /**
182 * @brief Returns whether the current user can change the domainUsersOnly
183 * restriction of this shared drive.
184 */
185 bool canChangeDomainUsersOnlyRestriction() const;
186
187 /**
188 * @brief Returns whether the current user can change the background of
189 * this shared drive.
190 */
191 bool canChangeDriveBackground() const;
192
193 /**
194 * @brief Returns whether the current user can change the driveMembersOnly
195 * restriction of this shared drive.
196 */
197 bool canChangeDriveMembersOnlyRestriction() const;
198
199 /**
200 * @brief Returns Whether the current user can comment on files in
201 * this shared drive.
202 */
203 bool canComment() const;
204
205 /**
206 * @brief Returns Whether the current user can copy files in this shared drive.
207 */
208 bool canCopy() const;
209
210 /**
211 * @brief Returns Whether the current user can delete children from
212 * folders in this shared drive.
213 */
214 bool canDeleteChildren() const;
215
216 /**
217 * @brief Returns Whether the current user can delete this shared drive.
218 *
219 * Attempting to delete the shared drive may still fail if there are
220 * untrashed items inside the shared drive.
221 */
222 bool canDeleteDrive() const;
223
224 /**
225 * @brief Returns Whether the current user can download files in this
226 * shared drive.
227 */
228 bool canDownload() const;
229
230 /**
231 * @brief Returns Whether the current user can edit files in this
232 * shared drive
233 */
234 bool canEdit() const;
235
236 /**
237 * @brief Returns Whether the current user can list the children of
238 * folders in this shared drive.
239 */
240 bool canListChildren() const;
241
242 /**
243 * @brief Returns Whether the current user can add members to this shared drive
244 * or remove them or change their role.
245 */
246 bool canManageMembers() const;
247
248 /**
249 * @brief Returns Whether the current user can read the revisions
250 * resource of files in this shared drive.
251 */
252 bool canReadRevisions() const;
253
254 /**
255 * @brief Returns Whether the current user can rename files or folders
256 * in this shared drive.
257 */
258 bool canRename() const;
259
260 /**
261 * @brief Returns Whether the current user can rename this shared drive.
262 */
263 bool canRenameDrive() const;
264
265 /**
266 * @brief Returns Whether the current user can share files or folders
267 * in this shared drive.
268 */
269 bool canShare() const;
270
271 /**
272 * @brief Returns Whether the current user can trash children from
273 * folders in this shared drive.
274 */
275 bool canTrashChildren() const;
276
277 private:
278 class Private;
280 friend class Private;
281 friend class Drives;
282 };
283
285
286 /**
287 * @brief Drives::BackgroundImageFile holds the structure used
288 * for backgroundImageFile property.
289 */
291 {
292 public:
293 struct Fields {
294 static const QString Id;
295 static const QString XCoordinate;
296 static const QString YCoordinate;
297 static const QString Width;
298 };
299
303 bool operator==(const BackgroundImageFile &other) const;
304 bool operator!=(const BackgroundImageFile &other) const
305 {
306 return !operator==(other);
307 }
308
309 /**
310 * @brief Returns the ID of an image file in Google Drive
311 * to use for the background image.
312 */
313 QString id() const;
314
315 /**
316 * @brief Sets the ID of an image file in Google Drive to
317 * use for the background image.
318 *
319 * @param id
320 */
321 void setId(const QString &id) const;
322
323 /**
324 * @brief Returns the X coordinate of the upper left corner of
325 * the cropping area in the background image. This is a value
326 * in the closed range of 0 to 1. This value represents the
327 * horizontal distance from the left side of the entire image
328 * to the left side of the cropping area divided by the width
329 * of the entire image.
330 */
331 float xCoordinate() const;
332
333 /**
334 * @brief Returns the X coordinate of the upper left corner of
335 * the cropping area in the background image. This is a value
336 * in the closed range of 0 to 1. This value represents the
337 * horizontal distance from the left side of the entire image
338 * to the left side of the cropping area divided by the width
339 * of the entire image.
340 *
341 * @param xCoordinate
342 */
343 void setXCoordinate(float xCoordinate) const;
344
345 /**
346 * @brief Returns the Y coordinate of the upper left corner of the
347 * cropping area in the background image. This is a value in the
348 * closed range of 0 to 1. This value represents the vertical
349 * distance from the top side of the entire image to the top side
350 * of the cropping area divided by the height of the entire image.
351 */
352 float yCoordinate() const;
353
354 /**
355 * @brief Sets the Y coordinate of the upper left corner of the
356 * cropping area in the background image. This is a value in the
357 * closed range of 0 to 1. This value represents the vertical
358 * distance from the top side of the entire image to the top side
359 * of the cropping area divided by the height of the entire image.
360 *
361 * @param yCoordinate
362 */
363 void setYCoordinate(float yCoordinate) const;
364
365 /**
366 * @brief Returns the width of the cropped image in the closed
367 * range of 0 to 1. This value represents the width of the cropped
368 * image divided by the width of the entire image. The height is
369 * computed by applying a width to height aspect ratio of 80 to 9.
370 * The resulting image must be at least 1280 pixels wide and
371 * 144 pixels high.
372 */
373 float width() const;
374
375 /**
376 * @brief Sets the width of the cropped image in the closed
377 * range of 0 to 1. This value represents the width of the cropped
378 * image divided by the width of the entire image. The height is
379 * computed by applying a width to height aspect ratio of 80 to 9.
380 * The resulting image must be at least 1280 pixels wide and
381 * 144 pixels high.
382 *
383 * @param width
384 */
385 void setWidth(float width) const;
386
387 private:
388 class Private;
390 friend class Private;
391 friend class Drives;
392 };
393
395
396 struct Fields {
397 static const QString Kind;
398 static const QString Items;
399 static const QString KindDrive;
400 static const QString PageToken;
401 static const QString NextPageToken;
402 static const QString Id;
403 static const QString Name;
404 static const QString ThemeId;
405 static const QString ColorRgb;
406 static const QString BackgroundImageFile;
407 static const QString BackgroundImageLink;
408 static const QString Capabilities;
409 static const QString CreatedDate;
410 static const QString Hidden;
411 static const QString Restrictions;
412 };
413
414 Drives();
415 Drives(const Drives &other);
416 ~Drives() override;
417 bool operator==(const Drives &other) const;
418 bool operator!=(const Drives &other) const
419 {
420 return !operator==(other);
421 }
422
423 /**
424 * @brief Returns the ID of this shared drive which
425 * is also the ID of the top level folder of this
426 * shared drive.
427 */
428 QString id() const;
429
430 /**
431 * @brief Sets the ID of this shared drive which
432 * is also the ID of the top level folder of this
433 * shared drive.
434 *
435 * @param id
436 */
437 void setId(const QString &id) const;
438
439 /**
440 * @brief Returns the name of the drive.
441 */
442 QString name() const;
443
444 /**
445 * @brief Sets the name of the drive.
446 *
447 * @param name
448 */
449 void setName(const QString &name) const;
450
451 /**
452 * @brief Returns the themeId of the drive.
453 */
454 QString themeId() const;
455
456 /**
457 * @brief Sets the themeId of the shared drive.
458 *
459 * @param themeId
460 */
461 void setThemeId(const QString &themeId) const;
462
463 /**
464 * @brief Returns the colorRgb of the shared drive.
465 */
466 QString colorRgb() const;
467
468 /**
469 * @brief Sets the colorRgb of the shared drive.
470 *
471 * @param colorRgb
472 */
473 void setColorRgb(const QString &colorRgb) const;
474
475 /**
476 * @brief Returns the image file and cropping parameters from which a background image for this shared drive is set.
477 */
478 BackgroundImageFilePtr backgroundImageFile() const;
479
480 /**
481 * @brief Sets the backgroundImageFile of the shared drive.
482 *
483 * @param backgroundImageFile
484 */
485 void setBackgroundImageFile(const BackgroundImageFilePtr &backgroundImageFile) const;
486
487 /**
488 * @brief Returns the backgroundImageLink of the shared drive.
489 */
490 QString backgroundImageLink() const;
491
492 /**
493 * @brief Returns the capabilities the current user has on this shared drive.
494 */
495 CapabilitiesPtr capabilities() const;
496
497 /**
498 * @brief Returns the time at which the shared drive was created.
499 */
500 QDateTime createdDate() const;
501
502 /**
503 * @brief Returns whether the shared drive is hidden from default view.
504 */
505 bool hidden() const;
506
507 /**
508 * @brief Returns the set of restrictions that apply to this shared drive or
509 * items inside this shared drive.
510 */
511 RestrictionsPtr restrictions() const;
512
513 /**
514 * @brief Sets the restrictions of the shared drive.
515 *
516 * @param restrictions
517 */
518 void setRestrictions(const RestrictionsPtr &restrictions) const;
519
520 static DrivesPtr fromJSON(const QByteArray &jsonData);
521 static DrivesList fromJSONFeed(const QByteArray &jsonData, FeedData &feedData);
522 static QByteArray toJSON(const DrivesPtr &drives);
523
524private:
525 class Private;
527 friend class Private;
528};
529
530} /* namespace Drive */
531
532} /* namespace KGAPI2 */
Drives::BackgroundImageFile holds the structure used for backgroundImageFile property.
Definition drives.h:291
Drives::Capabilities holds the structure used for capabilities the current user has on this shared dr...
Definition drives.h:137
Drives::Restrictions holds the structure used for a set of restrictions that apply to this shared dri...
Definition drives.h:41
Drives contains a representation of a Drive.
Definition drives.h:33
Structure to store additional information about a feed.
Definition types.h:24
Base class for all objects.
Definition object.h:31
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 Mon Nov 18 2024 12:17:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.