Kgapi

calendarservice.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 "types.h"
12#include "enums.h"
13#include "event.h"
14#include "kgapicalendar_export.h"
15
16#include <QFlags>
17
18class QNetworkRequest;
19
20namespace KGAPI2
21{
22
23/**
24 * @brief Additional methods for implementing support for Google Calendar service
25 *
26 * You should never need to use these methods, unless implementing your own Job
27 */
28namespace CalendarService
29{
30 enum class EventSerializeFlag {
31 Default = 0,
32 NoID = 1 << 0
33 };
34 using EventSerializeFlags = QFlags<EventSerializeFlag>;
35
36 /**
37 * @brief Preparse a QNetworkRequest for given URL
38 *
39 * @param url
40 */
41 KGAPICALENDAR_EXPORT QNetworkRequest prepareRequest(const QUrl &url);
42
43 /**
44 * @brief Parses calendar JSON data into Calendar object
45 *
46 * @param jsonData
47 */
48 KGAPICALENDAR_EXPORT CalendarPtr JSONToCalendar(const QByteArray& jsonData);
49
50 /**
51 * @brief Serializes calendar into JSON
52 *
53 * @param calendar
54 */
55 KGAPICALENDAR_EXPORT QByteArray calendarToJSON(const CalendarPtr& calendar);
56
57 /**
58 * @brief Parses JSON feed into list of Calendars
59 *
60 * @param jsonFeed
61 * @param feedData The structure will be filled with additional information about
62 * the feed, including URL for next page (if any)
63 */
64 KGAPICALENDAR_EXPORT ObjectsList parseCalendarJSONFeed(const QByteArray& jsonFeed, FeedData& feedData);
65
66 /**
67 * @brief Parses event JSON into Event object
68 *
69 * @param jsonData
70 */
71 KGAPICALENDAR_EXPORT EventPtr JSONToEvent(const QByteArray& jsonData);
72
73 /**
74 * @brief Serializes Event into JSON
75 *
76 * @param event
77 */
78 KGAPICALENDAR_EXPORT QByteArray eventToJSON(const EventPtr& event, EventSerializeFlags flags = EventSerializeFlag::Default);
79
80 /**
81 * @brief Parses JSON feed into list of Events
82 *
83 * @param jsonFeed
84 * @param feedData The structure will be filled with additional information about
85 * the feed, including URL for next page (if any)
86 */
87 KGAPICALENDAR_EXPORT ObjectsList parseEventJSONFeed(const QByteArray& jsonFeed, FeedData& feedData);
88
89 /**
90 * @brief Converts event type enum value to string
91 */
92 KGAPICALENDAR_EXPORT QString eventTypeToString(Event::EventType eventType);
93
94 /**
95 * @brief Converts event type string to enum value
96 */
97 KGAPICALENDAR_EXPORT Event::EventType eventTypeFromString(const QString &eventType);
98
99 /**
100 * @brief Supported API version
101 */
102 KGAPICALENDAR_EXPORT QString APIVersion();
103
104 /**
105 * @brief Returns URL for fetching calendars list.
106 */
107 KGAPICALENDAR_EXPORT QUrl fetchCalendarsUrl();
108
109 /**
110 * @brief Returns URL for fetching single calendar.
111 *
112 * @param calendarID calendar ID
113 */
114 KGAPICALENDAR_EXPORT QUrl fetchCalendarUrl(const QString &calendarID);
115
116 /**
117 * @brief Returns URL for updating existing calendar.
118 *
119 * @param calendarID ID of calendar to modify
120 */
121 KGAPICALENDAR_EXPORT QUrl updateCalendarUrl(const QString &calendarID);
122
123 /**
124 * @brief Returns URL for creating a new calendar.
125 */
126 KGAPICALENDAR_EXPORT QUrl createCalendarUrl();
127
128 /**
129 * @brief Returns URL for removing an existing calendar.
130 *
131 * @param calendarID ID of calendar to remove
132 */
133 KGAPICALENDAR_EXPORT QUrl removeCalendarUrl(const QString &calendarID);
134
135 /**
136 * @brief Returns URL for fetching all events from a specific calendar
137 *
138 * @param calendarID ID of calendar from which to fetch events
139 */
140 KGAPICALENDAR_EXPORT QUrl fetchEventsUrl(const QString &calendarID);
141
142 /**
143 * @brief Returns URL for fetching a single event from a specific calendar.
144 *
145 * @param calendarID ID of calendar from which to fetch the event
146 * @param eventID ID of event to fetch
147 */
148 KGAPICALENDAR_EXPORT QUrl fetchEventUrl(const QString &calendarID, const QString &eventID);
149
150 /**
151 * @brief Returns URL for updating a single event
152 *
153 * @param calendarID ID of calendar in which the event is
154 * @param eventID ID of event to update
155 * @param updatesPolicy Whether to send notification to participants
156 */
157 KGAPICALENDAR_EXPORT QUrl updateEventUrl(const QString &calendarID, const QString &eventID,
158 SendUpdatesPolicy updatesPolicy);
159
160 /**
161 * @brief Returns URL creating new events.
162 *
163 * @param calendarID ID of calendar in which to create the event
164 * @param updatesPolicy Whether to send notification to participants
165 */
166 KGAPICALENDAR_EXPORT QUrl createEventUrl(const QString &calendarID, SendUpdatesPolicy updatesPolicy);
167
168 /**
169 * @brief Returns URL importing private copies of existing events.
170 *
171 * @param calendarID ID of calendar in which to create the event
172 * @param updatesPolicy Whether to send notification to participants
173 */
174 KGAPICALENDAR_EXPORT QUrl importEventUrl(const QString &calendarID, SendUpdatesPolicy updatesPolicy);
175
176 /**
177 * @brief Returns URL for removing events
178 *
179 * @param calendarID ID of parent calendar
180 * @param eventID ID of event to remove.
181 */
182 KGAPICALENDAR_EXPORT QUrl removeEventUrl(const QString &calendarID, const QString &eventID);
183
184 /**
185 * @brief Returns URL for moving event between calendars.
186 *
187 * @param sourceCalendar ID of calendar from which to remove the event
188 * @param destCalendar ID of calendar to which to move the even
189 * @param eventID ID of event in the \p sourceCalendar to move
190 */
191 KGAPICALENDAR_EXPORT QUrl moveEventUrl(const QString &sourceCalendar, const QString &destCalendar, const QString &eventID);
192
193 /**
194 * @brief Returns URL for freebusy queries.
195 */
196 KGAPICALENDAR_EXPORT QUrl freeBusyQueryUrl();
197
198} // namespace CalendarService
199
200} // namespace KGAPI
201
202Q_DECLARE_OPERATORS_FOR_FLAGS(KGAPI2::CalendarService::EventSerializeFlags)
203
QByteArray eventToJSON(const EventPtr &event, EventSerializeFlags flags)
Serializes Event into JSON.
QUrl updateCalendarUrl(const QString &calendarID)
Returns URL for updating existing calendar.
QUrl fetchCalendarsUrl()
Returns URL for fetching calendars list.
QUrl removeCalendarUrl(const QString &calendarID)
Returns URL for removing an existing calendar.
QUrl updateEventUrl(const QString &calendarID, const QString &eventID, SendUpdatesPolicy updatePolicy)
Returns URL for updating a single event.
QUrl createEventUrl(const QString &calendarID, SendUpdatesPolicy updatePolicy)
Returns URL creating new events.
ObjectsList parseEventJSONFeed(const QByteArray &jsonFeed, FeedData &feedData)
Parses JSON feed into list of Events.
QUrl importEventUrl(const QString &calendarID, SendUpdatesPolicy updatePolicy)
Returns URL importing private copies of existing events.
QUrl createCalendarUrl()
Returns URL for creating a new calendar.
QUrl moveEventUrl(const QString &sourceCalendar, const QString &destCalendar, const QString &eventID)
Returns URL for moving event between calendars.
QByteArray calendarToJSON(const CalendarPtr &calendar)
Serializes calendar into JSON.
QUrl fetchCalendarUrl(const QString &calendarID)
Returns URL for fetching single calendar.
CalendarPtr JSONToCalendar(const QByteArray &jsonData)
Parses calendar JSON data into Calendar object.
QNetworkRequest prepareRequest(const QUrl &url)
Preparse a QNetworkRequest for given URL.
QString eventTypeToString(Event::EventType eventType)
Converts event type enum value to string.
EventPtr JSONToEvent(const QByteArray &jsonData)
Parses event JSON into Event object.
ObjectsList parseCalendarJSONFeed(const QByteArray &jsonFeed, FeedData &feedData)
Parses JSON feed into list of Calendars.
QString APIVersion()
Supported API version.
QUrl freeBusyQueryUrl()
Returns URL for freebusy queries.
QUrl fetchEventsUrl(const QString &calendarID)
Returns URL for fetching all events from a specific calendar.
Event::EventType eventTypeFromString(const QString &eventType)
Converts event type string to enum value.
QUrl fetchEventUrl(const QString &calendarID, const QString &eventID)
Returns URL for fetching a single event from a specific calendar.
QUrl removeEventUrl(const QString &calendarID, const QString &eventID)
Returns URL for removing events.
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 Jul 19 2024 11:58:17 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.