OpenAB
1.0.1
|
Documentation for class CalDAVHelper. This class implements CalDAV client using libcurl. More...
#include <CalDAVHelper.hpp>
Classes | |
class | CalendarInfo |
Class describing calendar. More... | |
struct | EventMetadata |
Simple struct describing items in metadata. More... | |
Public Types | |
enum | CalendarItemTypes { EVENT = 0, TODO, JOURNAL } |
typedef std::vector < EventMetadata > | EventsMetadata |
typedef std::vector< CalendarInfo > | Calendars |
Public Member Functions | |
CalDAVHelper (const std::string &serverUrl, bool isCalendarUrl, OpenAB::HttpSession *httpSession, OpenAB::HttpAuthorizer *httpAuthorizer) | |
Constructor. More... | |
virtual | ~CalDAVHelper () |
Destructor, virtual by default. More... | |
bool | findPrincipalUrl () |
Queries principal url - url used by given user to send CalDAV requests. More... | |
bool | findCalendarHomeSet () |
Queries address book set - url that can be further queried about user calendars details.. More... | |
bool | findCalendars () |
Queries calendars information. Queried information about calendars can be obtained by getCalendars, for each calendar information like display name and supported items type is queried. More... | |
bool | queryCalendarInfo (const std::string &calendarURL, CalendarInfo &info) |
Queries calendar infromation. In opposite to findCalendars, this function queries detailed information about given calendar and return them directly to caller. This function won't alter results of getCalendars function. More... | |
bool | queryCalendarMetadata (const std::string &calendarURL) |
Queries calendar metadata (current revision and sync token). After calling this function sync token can be obtained by using getSyncToken(). More... | |
bool | queryEventsMetadata (const std::string &calendarURL) |
Queries events/tasks metadata (list of IDs and revisions). After calling this function metadata can be obtained by using getContactsMetadata() and getTotalCount(). More... | |
bool | queryChangedEventsMetadata (const std::string &calendarURL, const std::string &syncToken, std::vector< OpenAB::PIMItem::ID > &removed) |
Queries only metadata of events/tasks that were modified since provided sync token was created. After calling this function metadata can be obtained by using getEventsMetadata() and getTotalCount(). More... | |
bool | downloadEvents (const std::string &calendarURL, unsigned int offset, unsigned int size, std::vector< std::string > &icals) |
Downloads iCalendar objects from metadata. More... | |
bool | downloadEvents (const std::string &calendarURL, std::vector< std::string > &uris, std::vector< std::string > &icals) |
Downloads iCalendar objects with given uris. More... | |
bool | addEvent (const std::string &calendarURL, const std::string &ical, std::string &uri, std::string &etag) |
Creates new event/task. More... | |
bool | removeEvent (const std::string &uri, const std::string &etag="") |
Removes event/task. More... | |
bool | modifyEvent (const std::string &uri, const std::string &ical, std::string &etag) |
Modifies event/task. More... | |
unsigned int | getTotalCount () const |
Returns total count of items in metadata downlaoded by queryEventsMetadata or queryChangedEventsMetadata. More... | |
std::string | getSyncToken () const |
Returns sync token queried by queryCalendarMetadata(). More... | |
EventsMetadata | getEventsMetadata () const |
Returns contacts metadata downlaoded by queryContactsMetadata or queryChangedEventsMetadata. More... | |
Calendars | getCalendars () const |
Returns list of available calendars. More... | |
Documentation for class CalDAVHelper. This class implements CalDAV client using libcurl.
typedef std::vector<CalendarInfo> CalDAVHelper::Calendars |
typedef std::vector<EventMetadata> CalDAVHelper::EventsMetadata |
CalDAVHelper::CalDAVHelper | ( | const std::string & | serverUrl, |
bool | isCalendarUrl, | ||
OpenAB::HttpSession * | httpSession, | ||
OpenAB::HttpAuthorizer * | httpAuthorizer | ||
) |
Constructor.
[in] | serverUrl | address of CalDAV server or direct address of calendar to be used. |
[in] | isCalendarUrl | indicates if url provided as serverUrl is calendar url or server url. |
[in] | httpSession | CURL http session object to be used for HTTP requests. |
[in] | httpAuthorizer | initialized httpAuthorizer required by given server. |
|
virtual |
Destructor, virtual by default.
bool CalDAVHelper::addEvent | ( | const std::string & | calendarURL, |
const std::string & | ical, | ||
std::string & | uri, | ||
std::string & | etag | ||
) |
Creates new event/task.
[in] | calendarURL | calendar to be used. |
[in] | ical | iCalendar object to be created. |
[out] | uri | URI of newly created item. |
[out] | etag | revision of newly created item. |
bool CalDAVHelper::downloadEvents | ( | const std::string & | calendarURL, |
unsigned int | offset, | ||
unsigned int | size, | ||
std::vector< std::string > & | icals | ||
) |
Downloads iCalendar objects from metadata.
[in] | calendarURL | calendar to be used. |
[in] | offset | offset of events/tasks in metadata. |
[in] | size | number of events/tasks to be downloaded. |
[out] | icals | downloaded iCalendar objects in the same order as in metadata. |
bool CalDAVHelper::downloadEvents | ( | const std::string & | calendarURL, |
std::vector< std::string > & | uris, | ||
std::vector< std::string > & | icals | ||
) |
Downloads iCalendar objects with given uris.
[in] | calendarURL | calendar to be used. |
[in] | uris | list of iCalendar uri (from EventMetadata) to be downloaded. |
[out] | icals | downloaded iCalendar list in the same order as provided uris. |
bool CalDAVHelper::findCalendarHomeSet | ( | ) |
Queries address book set - url that can be further queried about user calendars details..
bool CalDAVHelper::findCalendars | ( | ) |
Queries calendars information. Queried information about calendars can be obtained by getCalendars, for each calendar information like display name and supported items type is queried.
bool CalDAVHelper::findPrincipalUrl | ( | ) |
Queries principal url - url used by given user to send CalDAV requests.
|
inline |
Returns list of available calendars.
|
inline |
Returns contacts metadata downlaoded by queryContactsMetadata or queryChangedEventsMetadata.
|
inline |
Returns sync token queried by queryCalendarMetadata().
|
inline |
Returns total count of items in metadata downlaoded by queryEventsMetadata or queryChangedEventsMetadata.
bool CalDAVHelper::modifyEvent | ( | const std::string & | uri, |
const std::string & | ical, | ||
std::string & | etag | ||
) |
Modifies event/task.
[in] | uri | id of item to be updated. |
[in] | ical | iCalendar object to be uploaded. |
[out] | etag | new revision of updated item. |
bool CalDAVHelper::queryCalendarInfo | ( | const std::string & | calendarURL, |
CalendarInfo & | info | ||
) |
Queries calendar infromation. In opposite to findCalendars, this function queries detailed information about given calendar and return them directly to caller. This function won't alter results of getCalendars function.
[in] | calendarURL | url of calendar which details should be queried |
[out] | info | CalendarInfo structure filled with calendar details. |
bool CalDAVHelper::queryCalendarMetadata | ( | const std::string & | calendarURL | ) |
Queries calendar metadata (current revision and sync token). After calling this function sync token can be obtained by using getSyncToken().
[in] | calendarURL | calendar to be queried. |
bool CalDAVHelper::queryChangedEventsMetadata | ( | const std::string & | calendarURL, |
const std::string & | syncToken, | ||
std::vector< OpenAB::PIMItem::ID > & | removed | ||
) |
Queries only metadata of events/tasks that were modified since provided sync token was created. After calling this function metadata can be obtained by using getEventsMetadata() and getTotalCount().
[in] | calendarURL | calendar to be queried. |
[in] | syncToken | last synchronization token |
[out] | removed | list of removed items from server |
bool CalDAVHelper::queryEventsMetadata | ( | const std::string & | calendarURL | ) |
Queries events/tasks metadata (list of IDs and revisions). After calling this function metadata can be obtained by using getContactsMetadata() and getTotalCount().
[in] | calendarURL | calendar to be queried. |
bool CalDAVHelper::removeEvent | ( | const std::string & | uri, |
const std::string & | etag = "" |
||
) |
Removes event/task.
[in] | uri | id of item to be removed. |
[in] | etag | revision of item to be removed, if revision of given item does not match on the server, removal will fail (not all servers supports that). |