2 Copyright (c) 2008 Instituto Nokia de Tecnologia
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
8 * Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13 * Neither the name of the INdT nor the names of its contributors
14 may be used to endorse or promote products derived from this software
15 without specific prior written permission.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 POSSIBILITY OF SUCH DAMAGE.
31 * @author Adenilson Cavalcanti
32 * @date Fri May 30 14:52:52 2008
34 * @brief Google contacts libgcal header file.
36 * Public functions and data structures for contacts.
46 /** Contact data type */
49 /** Extracts from the atom stream the contact entries (you should
50 * had got the atom stream before, using \ref gcal_dump).
52 * Pay attention that it returns a vector of structures that must be destroyed
53 * using \ref gcal_destroy_contacts.
55 * @param ptr_gcal Pointer to a \ref gcal_resource structure, which has
56 * previously got the authentication using
57 * \ref gcal_get_authentication.
59 * @param length Pointer to an unsigned int, it will have the vector length.
61 * @return A pointer on sucess, NULL otherwise.
63 struct gcal_contact
*gcal_get_all_contacts(struct gcal_resource
*ptr_gcal
,
67 /** Cleanup memory of 1 contact structure pointer.
70 * @param contact A pointer to a \ref gcal_contact.
72 void gcal_destroy_contact(struct gcal_contact
*contact
);
75 /** Always use this to set contact structure to a sane state.
79 * @param contact A pointer to a \ref gcal_contact.
81 void gcal_init_contact(struct gcal_contact
*contact
);
83 /** Cleanup the memory of a vector of calendar entries created using
84 * \ref gcal_get_contacts.
86 * @param contacts A pointer to a vector of \ref gcal_event structure.
88 * @param length The vector length.
90 void gcal_destroy_contacts(struct gcal_contact
*contacts
, size_t length
);
93 /** Creates a new contact.
95 * You need to first succeed to get an authorization token using
96 * \ref gcal_get_authentication with mode set using
97 * \ref gcal_set_service to GCONTACT.
99 * @param ptr_gcal Pointer to a \ref gcal_resource structure, which has
100 * previously got the authentication using
101 * \ref gcal_get_authentication.
103 * @param contact A pointer to a libgcal \ref gcal_contact structure.
105 * @param updated Pass a pointer to a \ref gcal_contact structure if you
106 * wish to access the newly created contact (i.e. access fields like
107 * edit_uri and id). If you don't need it, just pass NULL.
109 * @return -1 on error, 0 on success, -2 if operation went correctly but
110 * cannot return 'updated' entry.
112 int gcal_create_contact(struct gcal_resource
*ptr_gcal
,
113 struct gcal_contact
*contact
,
114 struct gcal_contact
*updated
);
117 /** Deletes a contact.
119 * You need to first succeed to get an authorization token using
120 * \ref gcal_get_authentication with mode set using
121 * \ref gcal_set_service to GCONTACT.
123 * @param ptr_gcal Pointer to a \ref gcal_resource structure, which has
124 * previously got the authentication using
125 * \ref gcal_get_authentication.
127 * @param contact A pointer to a libgcal \ref gcal_contact structure.
129 * @return -1 on error, 0 on success.
131 int gcal_delete_contact(struct gcal_resource
*ptr_gcal
,
132 struct gcal_contact
*contact
);
136 /** Modify an existing contact.
138 * You need to first succeed to get an authorization token using
139 * \ref gcal_get_authentication with mode set using
140 * \ref gcal_set_service to GCONTACT.
142 * @param contact A pointer to a libgcal \ref gcal_contact structure.
144 * @param ptr_gcal Pointer to a \ref gcal_resource structure, which has
145 * previously got the authentication using
146 * \ref gcal_get_authentication.
148 * @param updated Pass a pointer to a \ref gcal_contact structure if you
149 * wish to access the newly created contact (i.e. access fields like
150 * edit_uri and id). If you don't need it, just pass NULL.
152 * @return -1 on error, 0 on success, -2 if operation went correctly but
153 * cannot return 'updated' entry.
155 int gcal_edit_contact(struct gcal_resource
*ptr_gcal
,
156 struct gcal_contact
*contact
,
157 struct gcal_contact
*updated
);