OpenAB  1.0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CardDAVHelper Class Reference

Documentation for class CardDAVHelper. More...

#include <CardDAVHelper.hpp>

Classes

struct  ContactMetadata
 

Public Types

typedef std::vector
< ContactMetadata
ContactsMetadata
 

Public Member Functions

 CardDAVHelper (const std::string &serverUrl, OpenAB::HttpSession *httpSession, OpenAB::HttpAuthorizer *httpAuthorizer)
 Constructor. More...
 
virtual ~CardDAVHelper ()
 Destructor, virtual by default. More...
 
bool findPrincipalUrl ()
 Query principal url. More...
 
bool findAddressbookSet ()
 Query address book set. More...
 
bool findAddressbooks ()
 Query address books. More...
 
bool queryAddressbookMetadata ()
 Query address book metadata (current revision and sync token). After calling this function sync token can be obtained by using getSyncToken(). More...
 
bool queryContactsMetadata ()
 Query contacts metadata (list of IDs and revisions). After calling this function metadata can be obtained by using getContactsMetadata() and getTotalCount(). More...
 
bool queryChangedContactsMetadata (const std::string &syncToken, std::vector< OpenAB::PIMItem::ID > &removed)
 Query contacts metadta only of contact that were modified since sync token. After calling this function metadata can be obtained by using getContactsMetadata() and getTotalCount(). More...
 
bool downloadVCards (unsigned int offset, unsigned int size, std::vector< std::string > &vcards)
 Download vCards of contacts from metadata. More...
 
bool downloadVCards (std::vector< std::string > &uris, std::vector< std::string > &vcards)
 Download vCards of given contacts. More...
 
bool addContact (const std::string &vcard, std::string &uri, std::string &etag)
 Uploads contact. More...
 
bool removeContact (const std::string &uri, const std::string &etag="")
 Removes contact. More...
 
bool modifyContact (const std::string &uri, const std::string &vcard, std::string &etag)
 Modifies contact. More...
 
unsigned int getTotalCount () const
 Returns total count of contacts metadata downlaoded by queryContactsMetadata or queryChangedContactsMetadata. More...
 
std::string getSyncToken () const
 Returns sync token queried by queryAddressbookMetadata(). More...
 
ContactsMetadata getContactsMetadata () const
 Returns contacts metadata downlaoded by queryContactsMetadata or queryChangedContactsMetadata. More...
 

Detailed Description

Documentation for class CardDAVHelper.

Member Typedef Documentation

Constructor & Destructor Documentation

CardDAVHelper::CardDAVHelper ( const std::string &  serverUrl,
OpenAB::HttpSession httpSession,
OpenAB::HttpAuthorizer httpAuthorizer 
)

Constructor.

CardDAVHelper::~CardDAVHelper ( )
virtual

Destructor, virtual by default.

Member Function Documentation

bool CardDAVHelper::addContact ( const std::string &  vcard,
std::string &  uri,
std::string &  etag 
)

Uploads contact.

Parameters
[in]vcardvcard to be uploaded
[out]uriof newly created contact.
[out]etagrevision of newly created contact.
Returns
true if contact were created successfully.
bool CardDAVHelper::downloadVCards ( unsigned int  offset,
unsigned int  size,
std::vector< std::string > &  vcards 
)

Download vCards of contacts from metadata.

Parameters
[in]offsetoffset of contact in metadata.
[in]sizenumber of contacts to be downloaded.
[out]vcardsdownloaded list of vcards in the same order as contacts in metadata.
Note
before calling this either queryContactsMetadata or queryChangedContactsMetadata needs to be called to populate metadata information.
Returns
true if contacts were downloaded successfully.
bool CardDAVHelper::downloadVCards ( std::vector< std::string > &  uris,
std::vector< std::string > &  vcards 
)

Download vCards of given contacts.

Parameters
[in]urislist of contact ids to be downloaded.
[out]vcardsdownloaded list of vcards in the same order as provided ids.
Returns
true if contacts were downloaded successfully.
bool CardDAVHelper::findAddressbooks ( )

Query address books.

Note
: Should be called after findAddressbookSet and before queryAddressbookMetadata.
Returns
true if address book was found successfully, false otherwise.
bool CardDAVHelper::findAddressbookSet ( )

Query address book set.

Note
: Should be called after findPrincipalUrl and before findAddressbooks.
Returns
true if address book set was found successfully, false otherwise.
bool CardDAVHelper::findPrincipalUrl ( )

Query principal url.

Note
Needs to be called before calling other functions from this class.
Returns
true if principal URL was found successfully, false otherwise.
ContactsMetadata CardDAVHelper::getContactsMetadata ( ) const
inline

Returns contacts metadata downlaoded by queryContactsMetadata or queryChangedContactsMetadata.

Note
that calls to queryContactsMetadata and queryChangedContactsMetadata will overwrite results.
Returns
contacts metadata.
std::string CardDAVHelper::getSyncToken ( ) const
inline

Returns sync token queried by queryAddressbookMetadata().

Returns
sync token
unsigned int CardDAVHelper::getTotalCount ( ) const
inline

Returns total count of contacts metadata downlaoded by queryContactsMetadata or queryChangedContactsMetadata.

Returns
total count of contacts metadata.
bool CardDAVHelper::modifyContact ( const std::string &  uri,
const std::string &  vcard,
std::string &  etag 
)

Modifies contact.

Parameters
[in]uriid of contact to be updated.
[in]vcardvcard to be uploaded
[out]etagnew revision of updated contact.
Returns
true if contact were modified successfully.
bool CardDAVHelper::queryAddressbookMetadata ( )

Query address book metadata (current revision and sync token). After calling this function sync token can be obtained by using getSyncToken().

Returns
true if address book metadata was queried successfully, false otherwise.
bool CardDAVHelper::queryChangedContactsMetadata ( const std::string &  syncToken,
std::vector< OpenAB::PIMItem::ID > &  removed 
)

Query contacts metadta only of contact that were modified since sync token. After calling this function metadata can be obtained by using getContactsMetadata() and getTotalCount().

Returns
true if contacts metadata was queried successfully, false otherwise.
bool CardDAVHelper::queryContactsMetadata ( )

Query contacts metadata (list of IDs and revisions). After calling this function metadata can be obtained by using getContactsMetadata() and getTotalCount().

Returns
true if contacts metadata was queried successfully, false otherwise.
bool CardDAVHelper::removeContact ( const std::string &  uri,
const std::string &  etag = "" 
)

Removes contact.

Parameters
[in]uriid of contact to be removed.
[in]etagrevision of contact to be removed, if revision of given contact does not match on the servers, removal will fail (not all servers supports that).
Returns
true if contact were removed successfully.

The documentation for this class was generated from the following files: