Kgapi

teamdrive.h
1 /*
2  SPDX-FileCopyrightText: 2019 David Barchiesi <[email protected]>
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 "types.h"
10 #include "object.h"
11 #include "kgapidrive_export.h"
12 
13 #include <QString>
14 
15 #include <QDateTime>
16 
17 namespace KGAPI2
18 {
19 
20 namespace Drive
21 {
22 
23 /**
24  * @brief Teamdrive contains a representation of a Team 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/teamdrives">Teamdrives</a>
28  *
29  * @since x.0
30  * @author David Barchiesi <[email protected]>
31  */
32 class KGAPIDRIVE_EXPORT Teamdrive: public KGAPI2::Object
33 {
34 
35  public:
36 
37  /**
38  * @brief DriveTeamdrive::Restrictions holds the structure used for
39  * restrictions property.
40  */
42  {
43 
44  public:
45  struct Fields {
46  static const QString AdminManagedRestrictions;
47  static const QString CopyRequiresWriterPermission;
48  static const QString DomainUsersOnly;
49  static const QString TeamMembersOnly;
50  };
51 
52  Restrictions();
53  Restrictions(const Restrictions &other);
54  ~Restrictions();
55  bool operator==(const Restrictions &other) const;
56  bool operator!=(const Restrictions &other) const { return !operator==(other); }
57 
58  /**
59  * @brief Returns whether administrative privileges on this Team Drive
60  * are required to modify restrictions.
61  */
62  bool adminManagedRestrictions() const;
63 
64  /**
65  * @brief Sets whether administrative privileges on this Team Drive
66  * are required to modify restrictions.
67  *
68  * @param adminManagedRestrictions
69  */
70  void setAdminManagedRestrictions(bool adminManagedRestrictions) const;
71 
72  /**
73  * @brief Returns whether the options to copy, print, or download files
74  * inside this Team Drive, should be disabled for readers and commenters.
75  * When this restriction is set to true, it will override the similarly
76  * named field to true for any file inside this Team Drive.
77  */
78  bool copyRequiresWriterPermission() const;
79 
80  /**
81  * @brief Sets whether the options to copy, print, or download files
82  * inside this Team Drive, should be disabled for readers and commenters.
83  * When this restriction is set to true, it will override the similarly
84  * named field to true for any file inside this Team Drive.
85  *
86  * @param copyRequiresWriterPermission
87  */
88  void setCopyRequiresWriterPermission(bool copyRequiresWriterPermission) const;
89 
90  /**
91  * @brief Returns whether access to this Team Drive and items inside this
92  * Team Drive is restricted to users of the domain to which this Team
93  * Drive belongs. This restriction may be overridden by other sharing
94  * policies controlled outside of this Team Drive.
95  */
96  bool domainUsersOnly() const;
97 
98  /**
99  * @brief Sets whether access to this Team Drive and items inside this
100  * Team Drive is restricted to users of the domain to which this Team
101  * Drive belongs. This restriction may be overridden by other sharing
102  * policies controlled outside of this Team Drive.
103  *
104  * @param domainUsersOnly
105  */
106  void setDomainUsersOnly(bool domainUsersOnly) const;
107 
108  /**
109  * @brief Returns whether access to items inside this Team Drive is
110  * restricted to members of this Team Drive.
111  */
112  bool teamMembersOnly() const;
113 
114  /**
115  * @brief Sets whether access to items inside this Team Drive is
116  * restricted to members of this Team Drive.
117  *
118  * @param teamMembersOnly
119  */
120  void setTeamMembersOnly(bool teamMembersOnly) const;
121 
122  private:
123  class Private;
124  QScopedPointer<Private> const d;
125  friend class Private;
126  friend class Teamdrive;
127  };
128 
130 
131  /**
132  * @brief DriveTeamdrive::Capabilities holds the structure used for capabilities property.
133  */
135  {
136 
137  public:
138  struct Fields {
139  static const QString CanAddChildren;
140  static const QString CanChangeCopyRequiresWriterPermissionRestriction;
141  static const QString CanChangeDomainUsersOnlyRestriction;
142  static const QString CanChangeTeamDriveBackground;
143  static const QString CanChangeTeamMembersOnlyRestriction;
144  static const QString CanComment;
145  static const QString CanCopy;
146  static const QString CanDeleteChildren;
147  static const QString CanDeleteTeamDrive;
148  static const QString CanDownload;
149  static const QString CanEdit;
150  static const QString CanListChildren;
151  static const QString CanManageMembers;
152  static const QString CanReadRevisions;
153  static const QString CanRename;
154  static const QString CanRenameTeamDrive;
155  static const QString CanShare;
156  static const QString CanTrashChildren;
157  };
158 
159  Capabilities();
160  Capabilities(const Capabilities &other);
161  ~Capabilities();
162  bool operator==(const Capabilities &other) const;
163  bool operator!=(const Capabilities &other) const { return !operator==(other); }
164 
165  /**
166  * @brief Returns whether the current user can add children to folders
167  * in this Team Drive.
168  */
169  bool canAddChildren() const;
170 
171  /**
172  * @brief Returns whether the current user can change the
173  * copyRequiresWriterPermission restriction of this Team Drive.
174  */
175  bool canChangeCopyRequiresWriterPermissionRestriction() const;
176 
177  /**
178  * @brief Returns whether the current user can change the domainUsersOnly
179  * restriction of this Team Drive.
180  */
181  bool canChangeDomainUsersOnlyRestriction() const;
182 
183  /**
184  * @brief Returns whether the current user can change the background of
185  * this Team Drive.
186  */
187  bool canChangeTeamDriveBackground() const;
188 
189  /**
190  * @brief Returns whether the current user can change the teamMembersOnly
191  * restriction of this Team Drive.
192  */
193  bool canChangeTeamMembersOnlyRestriction() const;
194 
195  /**
196  * @brief Returns Whether the current user can comment on files in
197  * this Team Drive.
198  */
199  bool canComment() const;
200 
201  /**
202  * @brief Returns Whether the current user can copy files in this Team Drive.
203  */
204  bool canCopy() const;
205 
206  /**
207  * @brief Returns Whether the current user can delete children from
208  * folders in this Team Drive.
209  */
210  bool canDeleteChildren() const;
211 
212  /**
213  * @brief Returns Whether the current user can delete this Team Drive.
214  *
215  * Attempting to delete the Team Drive may still fail if there are
216  * untrashed items inside the Team Drive.
217  */
218  bool canDeleteTeamDrive() const;
219 
220  /**
221  * @brief Returns Whether the current user can download files in this
222  * Team Drive.
223  */
224  bool canDownload() const;
225 
226  /**
227  * @brief Returns Whether the current user can edit files in this
228  * Team Drive
229  */
230  bool canEdit() const;
231 
232  /**
233  * @brief Returns Whether the current user can list the children of
234  * folders in this Team Drive.
235  */
236  bool canListChildren() const;
237 
238  /**
239  * @brief Returns Whether the current user can add members to this Team Drive
240  * or remove them or change their role.
241  */
242  bool canManageMembers() const;
243 
244  /**
245  * @brief Returns Whether the current user can read the revisions
246  * resource of files in this Team Drive.
247  */
248  bool canReadRevisions() const;
249 
250  /**
251  * @brief Returns Whether the current user can rename files or folders
252  * in this Team Drive.
253  */
254  bool canRename() const;
255 
256  /**
257  * @brief Returns Whether the current user can rename this Team Drive.
258  */
259  bool canRenameTeamDrive() const;
260 
261  /**
262  * @brief Returns Whether the current user can share files or folders
263  * in this Team Drive.
264  */
265  bool canShare() const;
266 
267  /**
268  * @brief Returns Whether the current user can trash children from
269  * folders in this Team Drive.
270  */
271  bool canTrashChildren() const;
272 
273  private:
274  class Private;
275  QScopedPointer<Private> const d;
276  friend class Private;
277  friend class Teamdrive;
278  };
279 
281 
282  /**
283  * @brief DriveTeamdrive::BackgroundImageFile holds the structure used
284  * for backgroundImageFile property.
285  */
287  {
288 
289  public:
290  struct Fields {
291  static const QString Id;
292  static const QString XCoordinate;
293  static const QString YCoordinate;
294  static const QString Width;
295  };
296 
300  bool operator==(const BackgroundImageFile &other) const;
301  bool operator!=(const BackgroundImageFile &other) const { return !operator==(other); }
302 
303  /**
304  * @brief Returns the id of the background image file.
305  */
306  QString id() const;
307 
308  /**
309  * @brief Sets the id of the background image file.
310  *
311  * @param id
312  */
313  void setId(const QString &id) const;
314 
315  /**
316  * @brief Returns the x coordinate for this background image file.
317  */
318  float xCoordinate() const;
319 
320  /**
321  * @brief Sets the x coordinate for this background image file.
322  *
323  * @param xCoordinate
324  */
325  void setXCoordinate(float xCoordinate) const;
326 
327  /**
328  * @brief Returns the y coordinate for this background image file.
329  */
330  float yCoordinate() const;
331 
332  /**
333  * @brief Sets the y coordinate for this background image file.
334  *
335  * @param yCoordinate
336  */
337  void setYCoordinate(float yCoordinate) const;
338 
339  /**
340  * @brief Returns the width for this background image file.
341  */
342  float width() const;
343 
344  /**
345  * @brief Sets the width for this background image file.
346  *
347  * @param width
348  */
349  void setWidth(float width) const;
350 
351  private:
352  class Private;
353  QScopedPointer<Private> const d;
354  friend class Private;
355  friend class Teamdrive;
356  };
357 
359 
360  struct Fields {
361  static const QString Kind;
362  static const QString Items;
363  static const QString KindDrive;
364  static const QString PageToken;
365  static const QString NextPageToken;
366  static const QString Id;
367  static const QString Name;
368  static const QString ThemeId;
369  static const QString ColorRgb;
370  static const QString BackgroundImageFile;
371  static const QString BackgroundImageLink;
372  static const QString Capabilities;
373  static const QString CreatedDate;
374  static const QString Restrictions;
375  };
376 
377  Teamdrive();
378  Teamdrive(const Teamdrive &other);
379  ~Teamdrive() override;
380  bool operator==(const Teamdrive &other) const;
381  bool operator!=(const Teamdrive &other) const { return !operator==(other); }
382 
383  /**
384  * @brief Returns the id of the teamdrive.
385  */
386  QString id() const;
387 
388  /**
389  * @brief Sets the id of the teamdrive.
390  *
391  * @param id
392  */
393  void setId(const QString &id) const;
394 
395  /**
396  * @brief Returns the name of the teamdrive.
397  */
398  QString name() const;
399 
400  /**
401  * @brief Sets the name of the teamdrive.
402  *
403  * @param name
404  */
405  void setName(const QString &name) const;
406 
407  /**
408  * @brief Returns the themeId of the teamdrive.
409  */
410  QString themeId() const;
411 
412  /**
413  * @brief Sets the themeId of the teamdrive.
414  *
415  * @param themeId
416  */
417  void setThemeId(const QString &themeId) const;
418 
419  /**
420  * @brief Returns the colorRgb of the teamdrive.
421  */
422  QString colorRgb() const;
423 
424  /**
425  * @brief Sets the colorRgb of the teamdrive.
426  *
427  * @param colorRgb
428  */
429  void setColorRgb(const QString &colorRgb) const;
430 
431  /**
432  * @brief Returns the image file and cropping parameters from which a background image for this Team Drive is set.
433  */
434  BackgroundImageFilePtr backgroundImageFile() const;
435 
436  /**
437  * @brief Sets the backgroundImageFile of the teamdrive.
438  *
439  * @param backgroundImageFile
440  */
441  void setBackgroundImageFile(const BackgroundImageFilePtr &backgroundImageFile) const;
442 
443  /**
444  * @brief Returns the backgroundImageLink of the teamdrive.
445  */
446  QString backgroundImageLink() const;
447 
448  /**
449  * @brief Returns the capabilities the current user has on this Team Drive.
450  */
451  CapabilitiesPtr capabilities() const;
452 
453  /**
454  * @brief Returns the time at which the Team Drive was created.
455  */
456  QDateTime createdDate() const;
457 
458  /**
459  * @brief Returns the set of restrictions that apply to this Team Drive or
460  * items inside this Team Drive.
461  */
462  RestrictionsPtr restrictions() const;
463 
464  /**
465  * @brief Sets the restrictions of the teamdrive.
466  *
467  * @param restrictions
468  */
469  void setRestrictions(const RestrictionsPtr &restrictions) const;
470 
471  static TeamdrivePtr fromJSON(const QByteArray &jsonData);
472  static TeamdrivesList fromJSONFeed(const QByteArray &jsonData, FeedData &feedData);
473  static QByteArray toJSON(const TeamdrivePtr &teamdrive);
474 
475  private:
476  class Private;
477  QScopedPointer<Private> const d;
478  friend class Private;
479 };
480 
481 } /* namespace Drive */
482 
483 } /* namespace KGAPI2 */
484 
Base class for all objects.
Definition: object.h:30
DriveTeamdrive::Restrictions holds the structure used for restrictions property.
Definition: teamdrive.h:41
Structure to store additional information about a feed.
Definition: types.h:23
DriveTeamdrive::Capabilities holds the structure used for capabilities property.
Definition: teamdrive.h:134
A job to fetch a single map tile described by a StaticMapUrl.
Definition: blog.h:15
Teamdrive contains a representation of a Team Drive.
Definition: teamdrive.h:32
Width
DriveTeamdrive::BackgroundImageFile holds the structure used for backgroundImageFile property...
Definition: teamdrive.h:286
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Jul 29 2021 23:11:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.