Kgapi

types.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 "kgapicore_export.h"
12
13#include <QList>
14#include <QSharedPointer>
15#include <QUrl>
16
17namespace KGAPI2
18{
19
20/**
21 * @brief Structure to store additional information about a feed.
22 */
23class KGAPICORE_EXPORT FeedData
24{
25public:
26 explicit FeedData()
27 : startIndex(0)
28 , itemsPerPage(0)
29 , totalResults(0)
30 {
31 }
32
33 int startIndex; /**< Index of first item on current feed page. */
34 int itemsPerPage; /**< Number of items per feed page. This will be same
35 for all pages (except for the last one which can be
36 shorter). */
37 int totalResults; /**< Number of all items. */
38 QUrl nextPageUrl; /**< Link to next page of feed.*/
39 QUrl requestUrl; /**< Original URL of the request. This value is filled
40 by AccessManager when passing the structure to a
41 service */
42 QString syncToken; /**< Sync token that can be used for incremental
43 updates by some of the services.*/
44};
45
46class Object;
49
50class Account;
53
54class AccountInfo;
57
58namespace People {
59
60class Person;
61using PersonPtr = QSharedPointer<Person>;
62using PersonList = QList<PersonPtr>;
63
64class ContactGroup;
65using ContactGroupPtr = QSharedPointer<ContactGroup>;
66using ContactGroupList = QList<ContactGroupPtr>;
67
68}
69
70class Calendar;
71using CalendarPtr = QSharedPointer<Calendar>;
72using CalendarsList = QList<CalendarPtr>;
73
74namespace Drive
75{
76
77class About;
78using AboutPtr = QSharedPointer<About>;
79using AboutsList = QList<AboutPtr>;
80
81class App;
82using AppPtr = QSharedPointer<App>;
83using AppsList = QList<AppPtr>;
84
85class Change;
86using ChangePtr = QSharedPointer<Change>;
87using ChangesList = QList<ChangePtr>;
88
89class ChildReference;
90using ChildReferencePtr = QSharedPointer<ChildReference>;
91using ChildReferencesList = QList<ChildReferencePtr>;
92
93class File;
94using FilePtr = QSharedPointer<File>;
95using FilesList = QList<FilePtr>;
96
97class ParentReference;
98using ParentReferencePtr = QSharedPointer<ParentReference>;
99using ParentReferencesList = QList<ParentReferencePtr>;
100
101class Permission;
102using PermissionPtr = QSharedPointer<Permission>;
103using PermissionsList = QList<PermissionPtr>;
104
105class Revision;
106using RevisionPtr = QSharedPointer<Revision>;
107using RevisionsList = QList<RevisionPtr>;
108
109class Drives;
110using DrivesPtr = QSharedPointer<Drives>;
111using DrivesList = QList<DrivesPtr>;
112
113class Teamdrive;
114using TeamdrivePtr = QSharedPointer<Teamdrive>;
115using TeamdrivesList = QList<TeamdrivePtr>;
116
117class User;
118using UserPtr = QSharedPointer<User>;
119using UsersList = QList<UserPtr>;
120
121}
122
123class Event;
124using EventPtr = QSharedPointer<Event>;
125using EventsList = QList<EventPtr>;
126
127class Location;
128using LocationPtr = QSharedPointer<Location>;
129using LocationsList = QList<LocationPtr>;
130
131class Reminder;
132using ReminderPtr = QSharedPointer<Reminder>;
133using RemindersList = QList<ReminderPtr>;
134
135class Task;
136using TaskPtr = QSharedPointer<Task>;
137using TasksList = QList<TaskPtr>;
138
139class TaskList;
140using TaskListPtr = QSharedPointer<TaskList>;
141using TaskListsList = QList<TaskListPtr>;
142
143namespace Blogger
144{
145class Blog;
146using BlogPtr = QSharedPointer<Blog>;
147using BlogsList = QList<BlogPtr>;
148
149class Comment;
150using CommentPtr = QSharedPointer<Comment>;
151using CommentsList = QList<CommentPtr>;
152
153class Page;
154using PagePtr = QSharedPointer<Page>;
155using PagesList = QList<PagePtr>;
156
157class Post;
158using PostPtr = QSharedPointer<Post>;
159using PostsList = QList<PostPtr>;
160
161}
162
163template<class T>
164ObjectsList operator<<(ObjectsList &objectsList, const QList<QSharedPointer<T>> &list)
165{
166 for (const QSharedPointer<T> &item : list) {
167 objectsList << item;
168 }
169
170 return objectsList;
171}
172
173/**
174 * @brief Job error codes
175 */
176enum Error {
177 /* Internal LibKGAPI errors */
178 NoError = 0, ///< LibKGAPI error - no error.
179 UnknownError = 1, ///< LibKGAPI error - a general unidentified error.
180 AuthError = 2, ///< LibKGAPI error - authentication process failed.
181 UnknownAccount = 3, ///< LibKGAPI error - application requested unknown account.
182 UnknownService = 4, ///< LibKGAPI error - application requested unknown service.
183 InvalidResponse = 5, ///< LibKGAPI error - Google returned invalid response.
184 BackendNotReady = 6, ///< @deprecated LibKGAPI error - backend is not ready (for example KWallet is not opened).
185 InvalidAccount = 7, ///< LibKGAPI error - the KGAPI2::Account object is invalid.
186 NetworkError = 8, ///< LibKGAPI error - standard network request returned a different code than 200.
187 AuthCancelled = 9, ///< LibKGAPI error - when the authentication dialog is canceled.
188
189 /* Following error codes identify Google errors */
190 OK = 200, ///< Request successfully executed.
191 Created = 201, ///< Create request successfully executed.
192 NoContent = 204, ///< Tasks API returns 204 when task is successfully removed.
193 ResumeIncomplete = 308, ///< Drive Api returns 308 when accepting a partial file upload
194 TemporarilyMoved = 302, ///< The object is located on a different URL provided in reply.
195 NotModified = 304, ///< Request was successful, but no data were updated.
196 TemporarilyMovedUseSameMethod = 307, ///< The object is located at a different URL provided in the reply. The same request method must be used.
197 BadRequest = 400, ///< Invalid (malformed) request.
198 Unauthorized = 401, ///< Invalid or expired token. See KGAPI2::Account::refreshTokens().
199 Forbidden = 403, ///< The requested data is not accessible to this account.
200 NotFound = 404, ///< Requested object was not found on the remote side.
201 Conflict = 409, ///< Object on the remote site differs from the submitted one. @see KGAPI2::Object::setEtag.
202 Gone = 410, ///< The requested data does not exist anymore on the remote site.
203 InternalError = 500, ///< An unexpected error occurred on the Google service.
204 QuotaExceeded = 503 ///< User quota has been exceeded, the request should be sent again later.
206
207/**
208 * @since 2.0
209 */
210enum ContentType { UnknownContentType = -1, JSON, XML };
211
212} // namespace KGAPI2
AccountInfo contains information about user's Google account.
Definition accountinfo.h:32
A Google account.
Definition account.h:40
Structure to store additional information about a feed.
Definition types.h:24
int startIndex
Index of first item on current feed page.
Definition types.h:33
int totalResults
Number of all items.
Definition types.h:37
QString syncToken
Sync token that can be used for incremental updates by some of the services.
Definition types.h:42
QUrl requestUrl
Original URL of the request.
Definition types.h:39
QUrl nextPageUrl
Link to next page of feed.
Definition types.h:38
int itemsPerPage
Number of items per feed page.
Definition types.h:34
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
Error
Job error codes.
Definition types.h:176
@ ResumeIncomplete
Drive Api returns 308 when accepting a partial file upload.
Definition types.h:193
@ Created
Create request successfully executed.
Definition types.h:191
@ Conflict
Object on the remote site differs from the submitted one.
Definition types.h:201
@ Unauthorized
Invalid or expired token. See KGAPI2::Account::refreshTokens().
Definition types.h:198
@ NetworkError
LibKGAPI error - standard network request returned a different code than 200.
Definition types.h:186
@ Gone
The requested data does not exist anymore on the remote site.
Definition types.h:202
@ UnknownError
LibKGAPI error - a general unidentified error.
Definition types.h:179
@ AuthError
LibKGAPI error - authentication process failed.
Definition types.h:180
@ UnknownAccount
LibKGAPI error - application requested unknown account.
Definition types.h:181
@ BackendNotReady
Definition types.h:184
@ InternalError
An unexpected error occurred on the Google service.
Definition types.h:203
@ NotModified
Request was successful, but no data were updated.
Definition types.h:195
@ QuotaExceeded
User quota has been exceeded, the request should be sent again later.
Definition types.h:204
@ Forbidden
The requested data is not accessible to this account.
Definition types.h:199
@ BadRequest
Invalid (malformed) request.
Definition types.h:197
@ NotFound
Requested object was not found on the remote side.
Definition types.h:200
@ UnknownService
LibKGAPI error - application requested unknown service.
Definition types.h:182
@ OK
Request successfully executed.
Definition types.h:190
@ TemporarilyMoved
The object is located on a different URL provided in reply.
Definition types.h:194
@ NoContent
Tasks API returns 204 when task is successfully removed.
Definition types.h:192
@ AuthCancelled
LibKGAPI error - when the authentication dialog is canceled.
Definition types.h:187
@ TemporarilyMovedUseSameMethod
The object is located at a different URL provided in the reply. The same request method must be used.
Definition types.h:196
@ NoError
LibKGAPI error - no error.
Definition types.h:178
@ InvalidAccount
LibKGAPI error - the KGAPI2::Account object is invalid.
Definition types.h:185
@ InvalidResponse
LibKGAPI error - Google returned invalid response.
Definition types.h:183
ContentType
Definition types.h:210
KIOCORE_EXPORT QStringList list(const QString &fileClass)
QDebug operator<<(QDebug dbg, const PerceptualColor::LchaDouble &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:51 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.