Kgapi

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

KDE's Doxygen guidelines are available online.