4 * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #ifndef __TIZEN_SOCIAL_CONTACTS_DB_H__
20 #define __TIZEN_SOCIAL_CONTACTS_DB_H__
32 * @ingroup CAPI_SOCIAL_CONTACTS_SVC_MODULE
33 * @defgroup CAPI_SOCIAL_CONTACTS_SVC_DATABASE_MODULE Database
35 * @brief The contacts database API provides the set of definitions and interfaces that enable application developers to handle contacts database.
37 * @section CAPI_SOCIAL_CONTACTS_SVC_DATABASE_MODULE_HEADER Required Header
38 * \#include <contacts.h>
45 * @brief Enumeration for contact change state.
47 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
52 CONTACTS_CHANGE_INSERTED, /**< Inserted */
53 CONTACTS_CHANGE_UPDATED, /**< Updated */
54 CONTACTS_CHANGE_DELETED, /**< Deleted */
58 * @brief Called when the designated view changes.
60 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
62 * @param[in] view_uri The view URI
63 * @param[in] user_data The user data passed from the callback registration function
65 * @pre The callback must be registered using contacts_db_add_changed_cb.
67 * @see contacts_db_add_changed_cb()
69 typedef void (*contacts_db_changed_cb)(const char *view_uri, void *user_data);
72 * @brief Inserts a record to the contacts database.
74 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
76 * @privilege %http://tizen.org/privilege/contact.write
77 * @privilege %http://tizen.org/privilege/callhistory.write
80 * %http://tizen.org/privilege/contact.write is needed for record which is created with @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, \n @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile,
81 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, \n
82 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, \n
83 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, \n
84 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, \n
85 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial. \n\n
86 * %http://tizen.org/privilege/callhistory.write is needed for record which is created with @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log.
88 * @param[in] record The record handle
89 * @param[out] id The ID of inserted record
91 * @return @c 0 on success,
92 * otherwise a negative error value
94 * @retval #CONTACTS_ERROR_NONE Successful
95 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
96 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
97 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
98 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
99 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
100 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
101 * @retval #CONTACTS_ERROR_DB Database operation failure
102 * @retval #CONTACTS_ERROR_IPC IPC error
104 * @pre contacts_connect() should be called to open a connection to the contacts service.
105 * @post contacts_db_changed_cb() callback wil be called upon success.
107 * @see contacts_connect()
108 * @see contacts_db_update_record()
109 * @see contacts_db_delete_record()
110 * @see contacts_db_get_record()
112 int contacts_db_insert_record(contacts_record_h record, int *id);
115 * @brief Gets a record from the contacts database.
117 * @details This function creates a new contact handle from the contacts database by the given @a record_id. \n
118 * @a record will be created, which is filled with contact information.
120 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
122 * @privilege %http://tizen.org/privilege/contact.read
123 * @privilege %http://tizen.org/privilege/callhistory.read
125 * @remarks %http://tizen.org/privilege/contact.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person, \n
126 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_simple_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile, \n
127 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, \n
128 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, \n
129 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, \n
130 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, \n
131 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_sdn. \n\n
132 * %http://tizen.org/privilege/callhistory.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log.
134 * @remarks You must release @a record using contacts_record_destroy().
136 * @param[in] view_uri The view URI of a record
137 * @param[in] record_id The record ID to get from database
138 * @param[out] record The record handle associated with the record ID
140 * @return @c 0 on success,
141 * otherwise a negative error value
143 * @retval #CONTACTS_ERROR_NONE Successful
144 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
145 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
146 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
147 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
148 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
149 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
150 * @retval #CONTACTS_ERROR_DB Database operation failure
151 * @retval #CONTACTS_ERROR_IPC IPC error
153 * @pre contacts_connect() should be called to open a connection to the contacts service.
155 * @see contacts_connect()
156 * @see contacts_record_destroy()
158 int contacts_db_get_record(const char *view_uri, int record_id, contacts_record_h *record);
161 * @brief Updates a record in the contacts database.
163 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
165 * @privilege %http://tizen.org/privilege/contact.write
166 * @privilege %http://tizen.org/privilege/callhistory.write
168 * @remarks %http://tizen.org/privilege/contact.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, \n @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile,
169 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, \n
170 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, \n
171 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, \n
172 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, \n
173 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial. \n\n
174 * %http://tizen.org/privilege/callhistory.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log.
176 * @param[in] record The record handle
178 * @return @c 0 on success,
179 * otherwise a negative error value
181 * @retval #CONTACTS_ERROR_NONE Successful
182 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
183 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
184 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
185 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
186 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
187 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
188 * @retval #CONTACTS_ERROR_DB Database operation failure
189 * @retval #CONTACTS_ERROR_IPC IPC error
191 * @pre contacts_connect() should be called to open a connection to the contacts service.
192 * @post contacts_db_changed_cb() callback wil be called upon success.
194 * @see contacts_connect()
195 * @see contacts_db_insert_record()
196 * @see contacts_db_delete_record()
197 * @see contacts_db_get_record()
199 int contacts_db_update_record(contacts_record_h record);
202 * @brief Deletes a record from the contacts database with related child records.
204 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
206 * @privilege %http://tizen.org/privilege/contact.write
207 * @privilege %http://tizen.org/privilege/callhistory.write
209 * @remarks %http://tizen.org/privilege/contact.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, \n @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile,
210 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, \n
211 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, \n
212 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, \n
213 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, \n
214 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial. \n\n
215 * %http://tizen.org/privilege/callhistory.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log.
217 * @param[in] view_uri The view URI of a record
218 * @param[in] record_id The record ID to delete
220 * @return @c 0 on success,
221 * otherwise a negative error value
223 * @retval #CONTACTS_ERROR_NONE Successful
224 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
225 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
226 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
227 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
228 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
229 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
230 * @retval #CONTACTS_ERROR_DB Database operation failure
231 * @retval #CONTACTS_ERROR_IPC IPC error
233 * @pre contacts_connect() should be called to open a connection to the contacts service.
234 * @post contacts_db_changed_cb() callback wil be called upon success.
236 * @see contacts_connect()
237 * @see contacts_db_insert_record()
239 int contacts_db_delete_record(const char *view_uri, int record_id);
242 * @brief Replaces an id-identified record with the given record.
244 * @details Now, this API supports only _contacts_contact view_uri.
246 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
248 * @privilege %http://tizen.org/privilege/contact.write
250 * @remarks The write-once value of @a record is not replaced.\n
251 * This API works only for @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact
253 * @param[in] record The new record handle to replace
254 * @param[in] id The DB record ID to be replaced
256 * @return @c 0 on success,
257 * otherwise a negative error value
259 * @retval #CONTACTS_ERROR_NONE Successful
260 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
261 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
262 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
263 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
264 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
265 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
266 * @retval #CONTACTS_ERROR_DB Database operation failure
267 * @retval #CONTACTS_ERROR_IPC IPC error
269 * @pre contacts_connect() should be called to open a connection to the contacts service.
270 * @post contacts_db_changed_cb() callback wil be called upon success.
272 * @see contacts_connect()
273 * @see contacts_db_update_record()
274 * @see contacts_db_delete_record()
275 * @see contacts_db_get_record()
277 int contacts_db_replace_record(contacts_record_h record, int id);
280 * @brief Retrieves all records and returns the results list.
282 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
284 * @privilege %http://tizen.org/privilege/contact.read
285 *@privilege %http://tizen.org/privilege/callhistory.read
287 * @remarks You must release @a record_list using contacts_list_destroy(). \n
288 * %http://tizen.org/privilege/contact.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person, \n
289 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_simple_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile, \n
290 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, \n
291 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, \n
292 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, \n
293 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, \n
294 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_sdn and all read-only views except views which are related to phone log. \n\n
295 * %http://tizen.org/privilege/callhistory.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log_stat. \n
296 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_phone_log view is needed both privileges.
298 * @param[in] view_uri The view URI to get records
299 * @param[in] offset The index from which to get results
300 * @param[in] limit The number to limit results(value 0 is used for all records)
301 * @param[out] record_list The record list
303 * @return @c 0 on success,
304 * otherwise a negative error value
306 * @retval #CONTACTS_ERROR_NONE Successful
307 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
308 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
309 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
310 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
311 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
312 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
313 * @retval #CONTACTS_ERROR_DB Database operation failure
314 * @retval #CONTACTS_ERROR_IPC IPC error
316 * @pre contacts_connect() should be called to open a connection to the contacts service.
318 * @see contacts_connect()
319 * @see contacts_list_destroy()
321 int contacts_db_get_all_records(const char *view_uri, int offset, int limit, contacts_list_h *record_list);
324 * @brief Uses a query to find records.
326 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
328 * @privilege %http://tizen.org/privilege/contact.read
329 * @privilege %http://tizen.org/privilege/callhistory.read
331 * @remarks You must release @a record_list using contacts_list_destroy(). \n
332 * %http://tizen.org/privilege/contact.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person, \n
333 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_simple_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile, \n
334 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, \n
335 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, \n
336 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, \n
337 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, \n
338 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_sdn and all read-only views except views which are related to phone log. \n\n
339 * %http://tizen.org/privilege/callhistory.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log_stat. \n
340 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_phone_log view is needed both privileges.
342 * @param[in] query The query to filter the results
343 * @param[in] offset The index from which to get results
344 * @param[in] limit The number to limit results(value 0 is used for get all records)
345 * @param[out] record_list The record list
347 * @return @c 0 on success,
348 * otherwise a negative error value
350 * @retval #CONTACTS_ERROR_NONE Successful
351 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
352 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
353 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
354 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
355 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
356 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
357 * @retval #CONTACTS_ERROR_DB Database operation failure
358 * @retval #CONTACTS_ERROR_IPC IPC error
360 * @pre contacts_connect() should be called to open a connection to the contacts service.
362 * @see contacts_connect()
363 * @see contacts_list_destroy()
365 int contacts_db_get_records_with_query(contacts_query_h query, int offset, int limit, contacts_list_h *record_list);
368 * @brief Inserts multiple records to the contacts database.
370 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
372 * @privilege %http://tizen.org/privilege/contact.write
373 * @privilege %http://tizen.org/privilege/callhistory.write
375 * @remarks %http://tizen.org/privilege/contact.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, \n @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile,
376 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, \n
377 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, \n
378 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, \n
379 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, \n
380 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial. \n\n
381 * %http://tizen.org/privilege/callhistory.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log.
383 * @param[in] record_list The record list handle
384 * @param[out] ids The IDs of inserted records
385 * @param[out] count The number of IDs
387 * @return @c 0 on success,
388 * otherwise a negative error value
390 * @retval #CONTACTS_ERROR_NONE Successful
391 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
392 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
393 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
394 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
395 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
396 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
397 * @retval #CONTACTS_ERROR_DB Database operation failure
398 * @retval #CONTACTS_ERROR_IPC IPC error
400 * @pre contacts_connect() should be called to open a connection to the contacts service.
401 * @post contacts_db_changed_cb() callback wil be called upon success.
403 * @see contacts_connect()
404 * @see contacts_db_update_records()
405 * @see contacts_db_delete_records()
407 int contacts_db_insert_records(contacts_list_h record_list, int **ids, int *count);
410 * @brief Updates multiple records in the contacts database.
412 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
414 * @privilege %http://tizen.org/privilege/contact.write
415 * @privilege %http://tizen.org/privilege/callhistory.write
417 * @remarks %http://tizen.org/privilege/contact.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, \n @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile,
418 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, \n
419 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, \n
420 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, \n
421 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, \n
422 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial. \n\n
423 * %http://tizen.org/privilege/callhistory.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log.
425 * @param[in] record_list The record list handle
427 * @return @c 0 on success,
428 * otherwise a negative error value
430 * @retval #CONTACTS_ERROR_NONE Successful
431 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
432 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
433 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
434 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
435 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
436 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
437 * @retval #CONTACTS_ERROR_DB Database operation failure
438 * @retval #CONTACTS_ERROR_IPC IPC error
440 * @pre contacts_connect() should be called to open a connection to the contacts service.
441 * @post contacts_db_changed_cb() callback wil be called upon success.
443 * @see contacts_connect()
444 * @see contacts_db_insert_records()
445 * @see contacts_db_delete_records()
447 int contacts_db_update_records(contacts_list_h record_list);
450 * @brief Deletes multiple records in the contacts database with related child records.
452 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
454 * @privilege %http://tizen.org/privilege/contact.write
455 * @privilege %http://tizen.org/privilege/callhistory.write
457 * @remarks %http://tizen.org/privilege/contact.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, \n @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile,
458 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, \n
459 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, \n
460 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, \n
461 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, \n
462 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial. \n\n
463 * %http://tizen.org/privilege/callhistory.write is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log.
465 * @param[in] view_uri The view URI of records
466 * @param[in] record_id_array The record IDs to delete
467 * @param[in] count The size of record ID array
469 * @return @c 0 on success,
470 * otherwise a negative error value
472 * @retval #CONTACTS_ERROR_NONE Successful
473 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
474 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
475 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
476 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
477 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
478 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
479 * @retval #CONTACTS_ERROR_DB Database operation failure
480 * @retval #CONTACTS_ERROR_IPC IPC error
482 * @pre contacts_connect() should be called to open a connection to the contacts service.
483 * @post contacts_db_changed_cb() callback wil be called upon success.
485 * @see contacts_connect()
486 * @see contacts_db_insert_records()
487 * @see contacts_db_update_records()
489 int contacts_db_delete_records(const char *view_uri, int record_id_array[], int count);
492 * @brief Replaces database records identified by given ids with a given record list.
494 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
496 * @privilege %http://tizen.org/privilege/contact.write
498 * @remarks The write-once value of record is not replaced.\n
499 * This API works only for @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact
501 * @param[in] list The new record list handle to replace
502 * @param[in] record_id_array The record IDs to replace
503 * @param[in] count The size of record ID array
505 * @return @c 0 on success,
506 * otherwise a negative error value
508 * @retval #CONTACTS_ERROR_NONE Successful
509 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
510 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
511 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
512 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
513 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
514 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
515 * @retval #CONTACTS_ERROR_DB Database operation failure
516 * @retval #CONTACTS_ERROR_IPC IPC error
518 * @pre contacts_connect() should be called to open a connection to the contacts service.
519 * @post contacts_db_changed_cb() callback wil be called upon success.
521 * @see contacts_connect()
522 * @see contacts_db_update_record()
523 * @see contacts_db_delete_record()
524 * @see contacts_db_get_record()
526 int contacts_db_replace_records(contacts_list_h list, int record_id_array[], int count);
529 * @brief Gets the current contacts database version.
531 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
533 * @privilege %http://tizen.org/privilege/contact.read
534 * @privilege %http://tizen.org/privilege/callhistory.read
536 * @param[out] contacts_db_version The contacts database version
538 * @return @c 0 on success,
539 * otherwise a negative error value
541 * @retval #CONTACTS_ERROR_NONE Successful
542 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
543 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
544 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
545 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
546 * @retval #CONTACTS_ERROR_DB Database operation failure
547 * @retval #CONTACTS_ERROR_IPC IPC error
549 * @pre contacts_connect() should be called to open a connection to the contacts service.
551 * @see contacts_connect()
552 * @see contacts_db_get_changes_by_version()
554 int contacts_db_get_current_version(int *contacts_db_version);
557 * @brief Registers a callback function to be invoked when a record changes.
559 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
561 * @privilege %http://tizen.org/privilege/contact.read
562 * @privilege %http://tizen.org/privilege/callhistory.read
564 * @remarks %http://tizen.org/privilege/contact.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person, \n
565 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_simple_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile, \n
566 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, \n
567 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, \n
568 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, \n
569 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, \n
570 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_sdn, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group_relation.\n\n
571 * %http://tizen.org/privilege/callhistory.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log.
572 * If successive change notification produced on the view_uri are identical,
573 * then they are coalesced into a single notification if the older notification has not yet been called
574 * because default main loop is doing something.
575 * But, it means that a callback function is not called to reliably count of change.
577 * @param[in] view_uri The view URI of records whose changes are monitored
578 * @param[in] callback The callback function to register
579 * @param[in] user_data The user data to be passed to the callback function
581 * @return @c 0 on success,
582 * otherwise a negative error value
584 * @retval #CONTACTS_ERROR_NONE Successful
585 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
586 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
587 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
588 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
589 * @retval #CONTACTS_ERROR_SYSTEM System error
591 * @pre contacts_connect() should be called to open a connection to the contacts service.
592 * @post contacts_db_changed_cb() will be invoked when the designated view changes.
594 * @see contacts_connect()
595 * @see contacts_db_changed_cb()
596 * @see contacts_db_remove_changed_cb()
598 int contacts_db_add_changed_cb(const char *view_uri, contacts_db_changed_cb callback, void *user_data);
601 * @brief Unregisters a callback function.
603 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
605 * @param[in] view_uri The view URI of records whose changes are monitored
606 * @param[in] callback The callback function to register
607 * @param[in] user_data The user data to be passed to the callback function
609 * @return @c 0 on success,
610 * otherwise a negative error value
612 * @retval #CONTACTS_ERROR_NONE Successful
613 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
614 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
615 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
616 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
617 * @retval #CONTACTS_ERROR_SYSTEM System error
619 * @pre contacts_connect() should be called to open a connection to the contacts service.
621 * @see contacts_connect()
622 * @see contacts_db_changed_cb()
623 * @see contacts_db_add_changed_cb()
625 int contacts_db_remove_changed_cb(const char *view_uri, contacts_db_changed_cb callback, void *user_data);
628 * @brief Retrieves records changes since the given database version.
630 * @details This function will find all changed records since the given @a contacts_db_version. \n
631 * Now, support @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact_updated_info, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group_updated_info \n
632 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile_updated_info and @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_grouprel_updated_info.
634 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
636 * @privilege %http://tizen.org/privilege/contact.read
638 * @remarks You must release @a record_list using contacts_list_destroy().
640 * @param[in] view_uri The view URI to get records
641 * @param[in] address_book_id The address book ID to filter
642 * @param[in] contacts_db_version The contacts database version
643 * @param[out] change_record_list The record list
644 * @param[out] current_contacts_db_version The current contacts database version
646 * @return @c 0 on success,
647 * otherwise a negative error value
649 * @retval #CONTACTS_ERROR_NONE Successful
650 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
651 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
652 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
653 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
654 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
655 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
656 * @retval #CONTACTS_ERROR_DB Database operation failure
657 * @retval #CONTACTS_ERROR_IPC IPC error
659 * @pre contacts_connect() should be called to open a connection to the contacts service.
661 * @see contacts_connect()
662 * @see contacts_list_destroy()
664 int contacts_db_get_changes_by_version(const char *view_uri,
666 int contacts_db_version,
667 contacts_list_h *change_record_list,
668 int *current_contacts_db_version);
671 * @brief Finds records based on a given keyword.
673 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
675 * @privilege %http://tizen.org/privilege/contact.read
677 * @remarks You must release @a record_list using contacts_list_destroy(). \n
678 * This API works only for @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_contact, \n
679 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_grouprel, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_group_assigned \n
680 * and @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_group_not_assigned.
682 * @param[in] view_uri The view URI to get records
683 * @param[in] keyword The keyword
684 * @param[in] offset The index from which to get results
685 * @param[in] limit The number to limit results(value 0 is used for get all records)
686 * @param[out] record_list The record list
688 * @return @c 0 on success,
689 * otherwise a negative error value
691 * @retval #CONTACTS_ERROR_NONE Successful
692 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
693 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
694 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
695 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
696 * @retval #CONTACTS_ERROR_DB Database operation failure
697 * @retval #CONTACTS_ERROR_IPC IPC error
699 * @pre contacts_connect() should be called to open a connection to the contacts service.
701 * @see contacts_connect()
702 * @see contacts_list_destroy()
704 int contacts_db_search_records(const char *view_uri, const char *keyword, int offset, int limit, contacts_list_h *record_list);
707 * @brief Finds records based on given query and keyword.
709 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
711 * @privilege %http://tizen.org/privilege/contact.read
713 * @remarks You must release @a record_list using contacts_list_destroy(). \n
714 * This API works only for @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_contact, \n
715 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_grouprel, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_group_assigned \n
716 * and @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_group_not_assigned
718 * @param[in] query The query handle to filter
719 * @param[in] keyword The keyword
720 * @param[in] offset The index from which to get results
721 * @param[in] limit The number to limit results(value 0 used for get all records)
722 * @param[out] record_list The record list
724 * @return @c 0 on success,
725 * otherwise a negative error value
727 * @retval #CONTACTS_ERROR_NONE Successful
728 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
729 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
730 * @retval #CONTACTS_ERROR_FILE_NO_SPACE FS Full
731 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
732 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
733 * @retval #CONTACTS_ERROR_DB Database operation failure
734 * @retval #CONTACTS_ERROR_IPC IPC error
736 * @pre contacts_connect() should be called to open a connection to the contacts service.
738 * @see contacts_connect()
739 * @see contacts_list_destroy()
741 int contacts_db_search_records_with_query(contacts_query_h query, const char *keyword, int offset, int limit, contacts_list_h *record_list);
744 * @brief Finds records based on a keyword and range.
746 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
748 * @privilege %http://tizen.org/privilege/contact.read
750 * @remarks You must release @a record_list using contacts_list_destroy(). \n
751 * This API works only for @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_contact, \n
752 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_grouprel, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_group_assigned, \n
753 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_group_not_assigned. These views can search records with range @ref CONTACTS_SEARCH_RANGE_NAME, @ref CONTACTS_SEARCH_RANGE_NUMBER, @ref CONTACTS_SEARCH_RANGE_DATA. \n
754 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_number can search records with @ref CONTACTS_SEARCH_RANGE_NAME and @ref CONTACTS_SEARCH_RANGE_NUMBER.\n
755 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_email can search records with @ref CONTACTS_SEARCH_RANGE_NAME and @ref CONTACTS_SEARCH_RANGE_EMAIL. \n
757 * @param[in] view_uri The view URI
758 * @param[in] keyword The keyword
759 * @param[in] offset The index from which to get results
760 * @param[in] limit The number to limit results(value 0 is used for get all records)
761 * @param[in] range The search range
762 * @param[out] record_list The record list
764 * @return @c 0 on success,
765 * otherwise a negative error value
767 * @retval #CONTACTS_ERROR_NONE Successful
768 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
769 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
770 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
771 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
772 * @retval #CONTACTS_ERROR_DB Database operation failure
773 * @retval #CONTACTS_ERROR_IPC IPC error
775 * @pre contacts_connect() should be called to open a connection to the contacts service.
777 * @see contacts_connect()
778 * @see contacts_list_destroy()
780 int contacts_db_search_records_with_range(const char *view_uri, const char *keyword, int offset, int limit, int range, contacts_list_h *record_list);
783 * @brief Gets the number of records in a specific view.
785 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
787 * @privilege %http://tizen.org/privilege/contact.read
788 * @privilege %http://tizen.org/privilege/callhistory.read
790 * @remarks %http://tizen.org/privilege/contact.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person, \n
791 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_simple_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile, \n
792 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, \n
793 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, \n
794 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, \n
795 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, \n
796 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_sdn and all read-only views except views which is related to phone log. \n\n
797 * %http://tizen.org/privilege/callhistory.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log_stat. \n
798 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_phone_log view is needed both privilege.
800 * @param[in] view_uri The view URI
801 * @param[out] count The count of records
803 * @return @c 0 on success,
804 * otherwise a negative error value
806 * @retval #CONTACTS_ERROR_NONE Successful
807 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
808 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
809 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
810 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
811 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
812 * @retval #CONTACTS_ERROR_DB Database operation failure
813 * @retval #CONTACTS_ERROR_IPC IPC error
815 * @pre contacts_connect() should be called to open a connection to the contacts service.
817 * @see contacts_connect()
819 int contacts_db_get_count(const char *view_uri, int *count);
822 * @brief Gets the number of records matching a query.
824 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
826 * @privilege %http://tizen.org/privilege/contact.read
827 * @privilege %http://tizen.org/privilege/callhistory.read
829 * @remarks %http://tizen.org/privilege/contact.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address_book, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person, \n
830 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_simple_contact, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_group, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_my_profile, \n
831 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_name, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_number, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_email, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_address, \n
832 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_note, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_url, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_event, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_image, \n
833 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_company, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_nickname, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_messenger, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_extension, \n
834 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_profile, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_relationship, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_activity_photo, \n
835 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_speeddial, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_sdn and all read-only views except views which is related to phone log. \n\n
836 * %http://tizen.org/privilege/callhistory.read is needed for record which is related to @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log, @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_phone_log_stat. \n
837 * @ref CAPI_SOCIAL_CONTACTS_SVC_VIEW_MODULE_contacts_person_phone_log view is needed both privilege.
839 * @param[in] query The query handle
840 * @param[out] count The count of records
842 * @return @c 0 on success,
843 * otherwise a negative error value
845 * @retval #CONTACTS_ERROR_NONE Successful
846 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
847 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
848 * @retval #CONTACTS_ERROR_NO_DATA Requested data does not exist
849 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
850 * @retval #CONTACTS_ERROR_NOT_SUPPORTED Not supported
851 * @retval #CONTACTS_ERROR_DB Database operation failure
852 * @retval #CONTACTS_ERROR_IPC IPC error
854 * @pre contacts_connect() should be called to open a connection to the contacts service.
856 * @see contacts_connect()
858 int contacts_db_get_count_with_query(contacts_query_h query, int *count);
861 * @brief Gets the last successful changed contacts database version on the current connection.
863 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.4 @endif
865 * @privilege %http://tizen.org/privilege/contact.read
866 * @privilege %http://tizen.org/privilege/callhistory.read
868 * @param[out] last_change_version The database version
870 * @return @c 0 on success,
871 * otherwise a negative error value
873 * @retval #CONTACTS_ERROR_NONE Successful
874 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
875 * @retval #CONTACTS_ERROR_DB Database operation failure
876 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
878 * @pre contacts_connect() should be called to open a connection to the contacts service.
880 * @see contacts_connect()
881 * @see contacts_db_get_current_version()
883 int contacts_db_get_last_change_version(int *last_change_version);
894 #endif /* __TIZEN_SOCIAL_CONTACTS_DB_H__ */