Kgapi

revision.h
1/*
2 SPDX-FileCopyrightText: 2012 Andrius da Costa Ribas <andriusmao@gmail.com>
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#include <QUrl>
15
16#include <QDateTime>
17
18namespace KGAPI2
19{
20
21namespace Drive
22{
23
24/**
25 * @brief Revision contains a revision of a file.
26 *
27 * Getters and setters' documentation is based on Google Drive's API v2 reference
28 * @see <a href="https://developers.google.com/drive/v2/reference/revisions">Revisions</a>
29 *
30 * @since 2.0
31 * @author Andrius da Costa Ribas <andriusmao@gmail.com>
32 * @author Daniel Vrátil <dvratil@redhat.com>
33 */
34class KGAPIDRIVE_EXPORT Revision : public KGAPI2::Object
35{
36public:
37 explicit Revision();
38 explicit Revision(const Revision &other);
39 ~Revision() override;
40 bool operator==(const Revision &other) const;
41 bool operator!=(const Revision &other) const
42 {
43 return !operator==(other);
44 }
45
46 /**
47 * @brief Returns the id of the revision.
48 */
49 [[nodiscard]] QString id() const;
50
51 /**
52 * @brief Returns a link back to this revision.
53 */
54 [[nodiscard]] QUrl selfLink() const;
55
56 /**
57 * @brief Returns the MIME type of the revision.
58 */
59 [[nodiscard]] QString mimeType() const;
60
61 /**
62 * @brief Returns the last time this revision was modified.
63 */
64 [[nodiscard]] QDateTime modifiedDate() const;
65
66 /**
67 * @brief Returns whether this revision is pinned to prevent automatic purging.
68 *
69 * This will only be populated and can only be modified on files with content
70 * stored in Drive which are not Google Docs.
71 *
72 * Revisions can also be pinned when they are created through the
73 * drive.files.insert/update/copy by using the pinned query parameter.
74 */
75 [[nodiscard]] bool pinned() const;
76
77 /**
78 * @brief Sets whether this revision is pinned to prevent automatic purging.
79 *
80 * This will only be populated and can only be modified on files with content
81 * stored in Drive which are not Google Docs.
82 *
83 * Revisions can also be pinned when they are created through the
84 * drive.files.insert/update/copy by using the pinned query parameter.
85 *
86 * @param pinned
87 */
88 void setPinned(bool pinned);
89
90 /**
91 * @brief Returns whether this revision is published.
92 *
93 * This is only populated and can only be modified for Google Docs.
94 */
95 [[nodiscard]] bool published() const;
96
97 /**
98 * @brief Sets whether this revision is published.
99 *
100 * @param published
101 */
102 void setPublished(bool published);
103
104 /**
105 * @brief Returns a link to the published revision.
106 */
107 [[nodiscard]] QUrl publishedLink() const;
108
109 /**
110 * @brief Returns whether subsequent revisions will be automatically republished.
111 *
112 * This is only populated and can only be modified for Google Docs.
113 */
114 [[nodiscard]] bool publishAuto() const;
115
116 /**
117 * @brief Sets whether subsequent revisions will be automatically republished.
118 *
119 * This is only populated and can only be modified for Google Docs.
120 *
121 * @param publishAuto
122 */
123 void setPublishAuto(bool publishAuto);
124
125 /**
126 * @brief Returns whether this revision is published outside the domain.
127 *
128 * This is only populated and can only be modified for Google Docs.
129 */
130 [[nodiscard]] bool publishedOutsideDomain() const;
131
132 /**
133 * @brief Sets whether this revision is published outside the domain.
134 *
135 * This is only populated and can only be modified for Google Docs.
136 *
137 * @param publishedOutsideDomain
138 */
139 void setPublishedOutsideDomain(bool publishedOutsideDomain);
140
141 /**
142 * @brief Returns a short term download URL for the file.
143 *
144 * This will only be populated on files with content stored in Drive.
145 */
146 [[nodiscard]] QUrl downloadUrl() const;
147
148 /**
149 * @brief Returns the links for exporting Google Docs to specific formats.
150 *
151 * This is a map from the export format to URL.
152 */
153 QMap<QString /* format */, QUrl /* url */> exportLinks() const;
154
155 /**
156 * @brief Returns the name of the last user to modify this revision.
157 */
158 [[nodiscard]] QString lastModifyingUserName() const;
159
160 /**
161 * @brief Returns object representing the last user to modify this revision
162 */
163 [[nodiscard]] UserPtr lastModifyingUser() const;
164
165 /**
166 * @brief Returns the original filename when this revision was created.
167 *
168 * This will only be populated on files with content stored in Drive.
169 */
170 [[nodiscard]] QString originalFilename() const;
171
172 /**
173 * @brief Returns an MD5 checksum for the content of this revision.
174 *
175 * This will only be populated on files with content stored in Drive
176 */
177 [[nodiscard]] QString md5Checksum() const;
178
179 /**
180 * @brief Returns the size of the revision in bytes.
181 *
182 * This will only be populated on files with content stored in Drive.
183 */
184 [[nodiscard]] qlonglong fileSize() const;
185
186 static RevisionPtr fromJSON(const QByteArray &jsonData);
187 static RevisionsList fromJSONFeed(const QByteArray &jsonData);
188 static QByteArray toJSON(const RevisionPtr &revision);
189
190private:
191 class Private;
192 Private *const d;
193 friend class Private;
194};
195
196} /* namespace Drive */
197
198} /* namespace KGAPI2 */
Revision contains a revision of a file.
Definition revision.h:35
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 Fri Oct 11 2024 12:19:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.