Kgapi

teamdrive.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 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 <david@barchie.si>
31 */
32class KGAPIDRIVE_EXPORT Teamdrive : public KGAPI2::Object
33{
34public:
35 /**
36 * @brief DriveTeamdrive::Restrictions holds the structure used for
37 * restrictions property.
38 */
40 {
41 public:
42 struct Fields {
43 static const QString AdminManagedRestrictions;
44 static const QString CopyRequiresWriterPermission;
45 static const QString DomainUsersOnly;
46 static const QString TeamMembersOnly;
47 };
48
50 Restrictions(const Restrictions &other);
52 bool operator==(const Restrictions &other) const;
53 bool operator!=(const Restrictions &other) const
54 {
55 return !operator==(other);
56 }
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 [[nodiscard]] 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 [[nodiscard]] 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 [[nodiscard]] 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;
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 public:
137 struct Fields {
138 static const QString CanAddChildren;
139 static const QString CanChangeCopyRequiresWriterPermissionRestriction;
140 static const QString CanChangeDomainUsersOnlyRestriction;
141 static const QString CanChangeTeamDriveBackground;
142 static const QString CanChangeTeamMembersOnlyRestriction;
143 static const QString CanComment;
144 static const QString CanCopy;
145 static const QString CanDeleteChildren;
146 static const QString CanDeleteTeamDrive;
147 static const QString CanDownload;
148 static const QString CanEdit;
149 static const QString CanListChildren;
150 static const QString CanManageMembers;
151 static const QString CanReadRevisions;
152 static const QString CanRename;
153 static const QString CanRenameTeamDrive;
154 static const QString CanShare;
155 static const QString CanTrashChildren;
156 };
157
158 Capabilities();
159 Capabilities(const Capabilities &other);
161 bool operator==(const Capabilities &other) const;
162 bool operator!=(const Capabilities &other) const
163 {
164 return !operator==(other);
165 }
166
167 /**
168 * @brief Returns whether the current user can add children to folders
169 * in this Team Drive.
170 */
171 [[nodiscard]] bool canAddChildren() const;
172
173 /**
174 * @brief Returns whether the current user can change the
175 * copyRequiresWriterPermission restriction of this Team Drive.
176 */
177 [[nodiscard]] bool canChangeCopyRequiresWriterPermissionRestriction() const;
178
179 /**
180 * @brief Returns whether the current user can change the domainUsersOnly
181 * restriction of this Team Drive.
182 */
183 [[nodiscard]] bool canChangeDomainUsersOnlyRestriction() const;
184
185 /**
186 * @brief Returns whether the current user can change the background of
187 * this Team Drive.
188 */
189 [[nodiscard]] bool canChangeTeamDriveBackground() const;
190
191 /**
192 * @brief Returns whether the current user can change the teamMembersOnly
193 * restriction of this Team Drive.
194 */
195 [[nodiscard]] bool canChangeTeamMembersOnlyRestriction() const;
196
197 /**
198 * @brief Returns Whether the current user can comment on files in
199 * this Team Drive.
200 */
201 [[nodiscard]] bool canComment() const;
202
203 /**
204 * @brief Returns Whether the current user can copy files in this Team Drive.
205 */
206 [[nodiscard]] bool canCopy() const;
207
208 /**
209 * @brief Returns Whether the current user can delete children from
210 * folders in this Team Drive.
211 */
212 [[nodiscard]] bool canDeleteChildren() const;
213
214 /**
215 * @brief Returns Whether the current user can delete this Team Drive.
216 *
217 * Attempting to delete the Team Drive may still fail if there are
218 * untrashed items inside the Team Drive.
219 */
220 [[nodiscard]] bool canDeleteTeamDrive() const;
221
222 /**
223 * @brief Returns Whether the current user can download files in this
224 * Team Drive.
225 */
226 [[nodiscard]] bool canDownload() const;
227
228 /**
229 * @brief Returns Whether the current user can edit files in this
230 * Team Drive
231 */
232 [[nodiscard]] bool canEdit() const;
233
234 /**
235 * @brief Returns Whether the current user can list the children of
236 * folders in this Team Drive.
237 */
238 [[nodiscard]] bool canListChildren() const;
239
240 /**
241 * @brief Returns Whether the current user can add members to this Team Drive
242 * or remove them or change their role.
243 */
244 [[nodiscard]] bool canManageMembers() const;
245
246 /**
247 * @brief Returns Whether the current user can read the revisions
248 * resource of files in this Team Drive.
249 */
250 [[nodiscard]] bool canReadRevisions() const;
251
252 /**
253 * @brief Returns Whether the current user can rename files or folders
254 * in this Team Drive.
255 */
256 [[nodiscard]] bool canRename() const;
257
258 /**
259 * @brief Returns Whether the current user can rename this Team Drive.
260 */
261 [[nodiscard]] bool canRenameTeamDrive() const;
262
263 /**
264 * @brief Returns Whether the current user can share files or folders
265 * in this Team Drive.
266 */
267 [[nodiscard]] bool canShare() const;
268
269 /**
270 * @brief Returns Whether the current user can trash children from
271 * folders in this Team Drive.
272 */
273 [[nodiscard]] bool canTrashChildren() const;
274
275 private:
276 class Private;
278 friend class Private;
279 friend class Teamdrive;
280 };
281
283
284 /**
285 * @brief DriveTeamdrive::BackgroundImageFile holds the structure used
286 * for backgroundImageFile property.
287 */
289 {
290 public:
291 struct Fields {
292 static const QString Id;
293 static const QString XCoordinate;
294 static const QString YCoordinate;
295 static const QString Width;
296 };
297
301 bool operator==(const BackgroundImageFile &other) const;
302 bool operator!=(const BackgroundImageFile &other) const
303 {
304 return !operator==(other);
305 }
306
307 /**
308 * @brief Returns the id of the background image file.
309 */
310 [[nodiscard]] QString id() const;
311
312 /**
313 * @brief Sets the id of the background image file.
314 *
315 * @param id
316 */
317 void setId(const QString &id) const;
318
319 /**
320 * @brief Returns the x coordinate for this background image file.
321 */
322 [[nodiscard]] float xCoordinate() const;
323
324 /**
325 * @brief Sets the x coordinate for this background image file.
326 *
327 * @param xCoordinate
328 */
329 void setXCoordinate(float xCoordinate) const;
330
331 /**
332 * @brief Returns the y coordinate for this background image file.
333 */
334 [[nodiscard]] float yCoordinate() const;
335
336 /**
337 * @brief Sets the y coordinate for this background image file.
338 *
339 * @param yCoordinate
340 */
341 void setYCoordinate(float yCoordinate) const;
342
343 /**
344 * @brief Returns the width for this background image file.
345 */
346 [[nodiscard]] float width() const;
347
348 /**
349 * @brief Sets the width for this background image file.
350 *
351 * @param width
352 */
353 void setWidth(float width) const;
354
355 private:
356 class Private;
358 friend class Private;
359 friend class Teamdrive;
360 };
361
363
364 struct Fields {
365 static const QString Kind;
366 static const QString Items;
367 static const QString KindDrive;
368 static const QString PageToken;
369 static const QString NextPageToken;
370 static const QString Id;
371 static const QString Name;
372 static const QString ThemeId;
373 static const QString ColorRgb;
374 static const QString BackgroundImageFile;
375 static const QString BackgroundImageLink;
376 static const QString Capabilities;
377 static const QString CreatedDate;
378 static const QString Restrictions;
379 };
380
381 Teamdrive();
382 Teamdrive(const Teamdrive &other);
383 ~Teamdrive() override;
384 bool operator==(const Teamdrive &other) const;
385 bool operator!=(const Teamdrive &other) const
386 {
387 return !operator==(other);
388 }
389
390 /**
391 * @brief Returns the id of the teamdrive.
392 */
393 [[nodiscard]] QString id() const;
394
395 /**
396 * @brief Sets the id of the teamdrive.
397 *
398 * @param id
399 */
400 void setId(const QString &id) const;
401
402 /**
403 * @brief Returns the name of the teamdrive.
404 */
405 [[nodiscard]] QString name() const;
406
407 /**
408 * @brief Sets the name of the teamdrive.
409 *
410 * @param name
411 */
412 void setName(const QString &name) const;
413
414 /**
415 * @brief Returns the themeId of the teamdrive.
416 */
417 [[nodiscard]] QString themeId() const;
418
419 /**
420 * @brief Sets the themeId of the teamdrive.
421 *
422 * @param themeId
423 */
424 void setThemeId(const QString &themeId) const;
425
426 /**
427 * @brief Returns the colorRgb of the teamdrive.
428 */
429 [[nodiscard]] QString colorRgb() const;
430
431 /**
432 * @brief Sets the colorRgb of the teamdrive.
433 *
434 * @param colorRgb
435 */
436 void setColorRgb(const QString &colorRgb) const;
437
438 /**
439 * @brief Returns the image file and cropping parameters from which a background image for this Team Drive is set.
440 */
441 BackgroundImageFilePtr backgroundImageFile() const;
442
443 /**
444 * @brief Sets the backgroundImageFile of the teamdrive.
445 *
446 * @param backgroundImageFile
447 */
448 void setBackgroundImageFile(const BackgroundImageFilePtr &backgroundImageFile) const;
449
450 /**
451 * @brief Returns the backgroundImageLink of the teamdrive.
452 */
453 [[nodiscard]] QString backgroundImageLink() const;
454
455 /**
456 * @brief Returns the capabilities the current user has on this Team Drive.
457 */
458 CapabilitiesPtr capabilities() const;
459
460 /**
461 * @brief Returns the time at which the Team Drive was created.
462 */
463 [[nodiscard]] QDateTime createdDate() const;
464
465 /**
466 * @brief Returns the set of restrictions that apply to this Team Drive or
467 * items inside this Team Drive.
468 */
469 RestrictionsPtr restrictions() const;
470
471 /**
472 * @brief Sets the restrictions of the teamdrive.
473 *
474 * @param restrictions
475 */
476 void setRestrictions(const RestrictionsPtr &restrictions) const;
477
478 static TeamdrivePtr fromJSON(const QByteArray &jsonData);
479 static TeamdrivesList fromJSONFeed(const QByteArray &jsonData, FeedData &feedData);
480 static QByteArray toJSON(const TeamdrivePtr &teamdrive);
481
482private:
483 class Private;
485 friend class Private;
486};
487
488} /* namespace Drive */
489
490} /* namespace KGAPI2 */
DriveTeamdrive::BackgroundImageFile holds the structure used for backgroundImageFile property.
Definition teamdrive.h:289
DriveTeamdrive::Capabilities holds the structure used for capabilities property.
Definition teamdrive.h:135
DriveTeamdrive::Restrictions holds the structure used for restrictions property.
Definition teamdrive.h:40
Teamdrive contains a representation of a Team Drive.
Definition teamdrive.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 4 2024 16:36:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.