Resolved Native API Reference issues for libaccount-service
[platform/core/api/libaccount-service.git] / include / account.h
1 /*
2  *
3  * Copyright (c) 2012 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18
19 #ifndef __ACCOUNT_H__
20 #define __ACCOUNT_H__
21
22 #include <account-types.h>
23 #include <account-error.h>
24
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif
29
30 #ifndef ACCOUNT_API
31 #define ACCOUNT_API __attribute__ ((visibility("default")))
32 #endif
33
34 /**
35  * @file        account.h
36  * @brief       This file contains the Account API for account management.
37  */
38
39 /**
40  * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
41  * @{
42  */
43
44 /**
45  * @brief   Called once for each account from the database.
46  *
47  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
48  * @param[in]  account    The account handle
49  * @param[in]  user_data  The user data passed from the foreach function
50  *
51  * @return     @c true to continue with the next iteration of the loop, \n
52  *             otherwise @c false to break out of the loop
53  *
54  * @pre account_foreach_account_from_db(), account_query_account_by_account_id(), account_query_account_by_user_name() or account_query_account_by_package_name() must be called.
55  *
56  * @see account_foreach_account_from_db()
57  * @see account_query_account_by_account_id()
58  * @see account_query_account_by_user_name()
59  * @see account_query_account_by_package_name()
60  */
61 typedef bool (*account_cb)(account_h account, void *user_data);
62
63 /**
64  * @brief  Called once for each capability of an account in the database.
65  *
66  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
67  * @param[in]   capability_type  The capability type
68  * @param[in]   capability_state The capability state
69  * @param[in]   user_data        The user data passed from the foreach function
70  *
71  * @return      @c true to continue with the next iteration of the loop, \n
72  *              otherwise @c false to break out of the loop
73  *
74  * @pre account_query_capability_by_account_id() must be called.
75  *
76  * @see account_query_capability_by_account_id()
77  */
78 typedef bool (*capability_cb)(const char *capability_type, account_capability_state_e capability_state, void *user_data);
79
80 /**
81  * @brief  Called once for each custom data of an account in the database.
82  *
83  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
84  * @param[in]  key        The user custom key
85  * @param[in]  value      The user custom value of the specific key
86  * @param[in]  user_data  The user data passed
87  *
88  * @return     @c true to continue with the next iteration of the loop, \n
89  *             otherwise @c false to break out of the loop
90  *
91  * @pre account_query_capability_by_account_id() must be called.
92  *
93  * @see account_query_capability_by_account_id()
94  */
95 typedef bool (*account_custom_cb)(char *key, char *value, void *user_data);
96
97
98 /**
99  * @brief  Called once for each account provider in the database.
100  *
101  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
102  * @param[in]  account_type  The account provider handle
103  * @param[in]  user_data     The user data passed
104  *
105  * @return     @c true to continue with the next iteration of the loop, \n
106  *             otherwise @c false to break out of the loop
107  *
108  * @pre account_type_foreach_account_type_from_db(), account_type_query_by_provider_feature() must be called.
109  *
110  * @see account_type_foreach_account_type_from_db()
111  * @see account_type_query_by_provider_feature()
112  */
113 typedef bool (*account_type_cb)(account_type_h account_type, void *user_data);
114
115
116 /**
117  * @brief  Called once for each account label.
118  *
119  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
120  * @param[in]  app_id     The application ID
121  * @param[in]  label      The name of the account depends on the specified locale
122  * @param[in]  locale     The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
123  *                        For example, "ko_KR" for Korean, "en_US" for American English.
124  * @param[in]  user_data  The user data passed
125  *
126  * @return     @c true to continue with the next iteration of the loop, \n
127  *             otherwise @c false to break out of the loop
128  *
129  * @pre account_type_get_label(), account_type_query_label_by_app_id() must be called.
130  *
131  * @see account_type_get_label()
132  * @see account_type_query_label_by_app_id()
133  */
134 typedef bool (*account_label_cb)(char *app_id, char *label, char *locale, void *user_data);
135
136
137 /**
138  * @brief  Called once for each capability of an account provider in the database.
139  *
140  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
141  * @param[in]  app_id     The application ID
142  * @param[in]  key        The user custom key
143  * @param[in]  user_data  The user data passed
144  *
145  * @return     @c true to continue with the next iteration of the loop, \n
146  *             otherwise @c false to break out of the loop
147  *
148  * @pre account_type_query_provider_feature_by_app_id(), account_type_get_provider_feature_all() must be called.
149  *
150  * @see account_type_query_provider_feature_by_app_id()
151  * @see account_type_get_provider_feature_all()
152  */
153 typedef bool (*provider_feature_cb)(char *app_id, char *key, void *user_data);
154
155
156 /**
157  * @brief Called once when an event occurs.
158  *
159  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
160  * @param[in]  event_type  The account event type
161  * @param[in]  account_id  The account ID to update
162  * @param[in]  user_data   The user data passed
163  *
164  * @return     @c true to continue with the next iteration of the loop, \n
165  *             otherwise @c false to break out of the loop
166  *
167  * @pre account_subscribe_notification() must be called.
168  *
169  * @see account_subscribe_notification()
170  */
171 typedef bool (*account_event_cb)(const char *event_type, int account_id, void *user_data);
172
173
174 /**
175  * @deprecated Deprecated since Tizen 2.4.\n
176  *             This API is not necessary to use since Tizen 2.4.
177  * @brief      Connects to the account database by readwrite mode.
178  *
179  * @since_tizen @if MOBILE 2.3 @endif
180  * @privlevel  public
181  * @privilege  %http://tizen.org/privilege/account.read \n
182  *             %http://tizen.org/privilege/account.write
183  * @remarks    This API need both privileges
184  * @return     @c 0 on success,
185  *             otherwise a negative error value
186  * @retval     #ACCOUNT_ERROR_NONE               Successful
187  * @retval     #ACCOUNT_ERROR_DB_NOT_OPENED      DB is not connected
188  * @retval     #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
189  */
190 int account_connect(void) TIZEN_DEPRECATED_API;
191
192
193 /**
194  * @deprecated Deprecated since Tizen 2.4.\n
195  *             This API is not necessary to use since Tizen 2.4.
196  * @brief      Connects to the account database by readonly mode.
197  *
198  * @since_tizen @if MOBILE 2.3 @endif
199  * @return     @c 0 on success,
200  *             otherwise a negative error value
201  * @retval     #ACCOUNT_ERROR_NONE               Successful
202  * @retval     #ACCOUNT_ERROR_DB_NOT_OPENED      DB is not connected
203  * @retval     #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
204  */
205 int account_connect_readonly(void) TIZEN_DEPRECATED_API;
206
207
208 /**
209  * @deprecated Deprecated since Tizen 2.4.\n
210  *             This API is not necessary to use since Tizen 2.4.
211  * @brief      Disconnects from the account database.
212  *
213  * @since_tizen @if MOBILE 2.3 @endif
214  * @return     @c 0 on success,
215  *             otherwise a negative error value
216  * @retval     #ACCOUNT_ERROR_NONE               Successful
217  * @retval     #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
218  * @retval     #ACCOUNT_ERROR_DATABASE_BUSY      SQLite busy handler expired
219  */
220 int account_disconnect(void) TIZEN_DEPRECATED_API;
221
222 /**
223  * @brief  Creates a handle to the account.
224  *
225  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
226  * @remarks    Release @a account using account_destroy().
227  * @remarks    The created handle is not added to the account database until account_insert_to_db() is called.
228  *
229  * @param[in]  account  The account handle
230  *
231  * @return     @c 0 on success,
232  *             otherwise a negative error value
233  * @retval     #ACCOUNT_ERROR_NONE               Successful
234  * @retval     #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
235  * @retval     #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
236  * @retval     #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
237  *
238  * @see account_destroy()
239  */
240 int account_create(account_h *account);
241
242
243 /**
244  * @brief  Destroys the account handle and releases all its resources.
245  *
246  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
247  * @param[in]  account  The account handle
248  *
249  * @return     @c 0 on success,
250  *             otherwise a negative error value
251  * @retval     #ACCOUNT_ERROR_NONE               Successful
252  * @retval     #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
253  * @retval     #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
254  *
255  * @see account_create()
256  */
257 int account_destroy(account_h account);
258
259
260 /**
261  * @brief  Inserts the account details to the account database.
262  *
263  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
264  * @privlevel   public
265  * @privilege   %http://tizen.org/privilege/account.read \n
266  *              %http://tizen.org/privilege/account.write
267  * @remarks     This API need both privileges
268  * @param[in]   account        The account handle
269  * @param[out]  account_db_id  The account ID to be assigned to an account
270  *
271  * @return  @c 0 on success,
272  *          otherwise a negative error value
273  * @retval  #ACCOUNT_ERROR_NONE Successful
274  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER        Invalid parameter
275  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY            Out of Memory
276  * @retval  #ACCOUNT_ERROR_DB_FAILED                Database operation failed
277  * @retval  #ACCOUNT_ERROR_DUPLICATED               Same user name exists in your application
278  * @retval  #ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE       Tried to add an account in spite of multiple false accounts
279  * @retval  #ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER  Tried to add an account though you did not register the account type in manifest
280  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED        DB Access fail by permission
281  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY            SQLite handler is busy
282  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED            Account database did not opened
283  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED            Not supported
284  *
285  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
286  *       But the account_connect() is not required to use this function since tizen 2.4.
287  *
288  * @see account_delete_from_db_by_id()
289  * @see account_delete_from_db_by_user_name()
290  * @see account_delete_from_db_by_package_name()
291  * @see account_update_to_db_by_id()
292  * @see account_update_to_db_by_user_name()
293  */
294 int account_insert_to_db(account_h account, int *account_db_id);
295
296
297 /**
298  * @brief  Deletes an account from the account database by account DB ID.
299  *
300  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
301  * @privlevel  public
302  * @privilege  %http://tizen.org/privilege/account.read \n
303  *             %http://tizen.org/privilege/account.write
304  * @remarks    This API need both privileges \n
305  *             Only can delete an account which was added by same package applications
306  * @param[in]  account_db_id  The account ID to delete
307  *
308  * @return  @c 0 on success,
309  *          otherwise a negative error value
310  * @retval  #ACCOUNT_ERROR_NONE               Successful
311  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
312  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
313  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
314  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  The account owner is different from the caller or DB Access fail by permission
315  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
316  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
317  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
318  *
319  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
320  *       But the account_connect() is not required to use this function since tizen 2.4.
321  *
322  * @see account_insert_to_db()
323  * @see account_delete_from_db_by_user_name()
324  * @see account_delete_from_db_by_package_name()
325  * @see account_update_to_db_by_id()
326  * @see account_update_to_db_by_user_name()
327  */
328 int account_delete_from_db_by_id(int account_db_id);
329
330
331 /**
332  * @brief  Deletes an account from the account database by user name.
333  *
334  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
335  * @privlevel  public
336  * @privilege  %http://tizen.org/privilege/account.read \n
337  *             %http://tizen.org/privilege/account.write
338  * @remarks    This API need both privileges \n
339  *             Only can delete accounts which were added by same package applications
340  * @param[in]  user_name     The user name of the account to delete
341  * @param[in]  package_name  The package name of the account to delete
342  *
343  * @return  @c 0 on success,
344  *          otherwise a negative error value
345  * @retval  #ACCOUNT_ERROR_NONE               Successful
346  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
347  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
348  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
349  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
350  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
351  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
352  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
353  *
354  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
355  *       But the account_connect() is not required to use this function since tizen 2.4.
356  *
357  * @see account_insert_to_db()
358  * @see account_delete_from_db_by_id()
359  * @see account_delete_from_db_by_package_name()
360  * @see account_update_to_db_by_id()
361  * @see account_update_to_db_by_user_name()
362  */
363 int account_delete_from_db_by_user_name(char *user_name, char *package_name);
364
365
366 /**
367  * @brief  Deletes an account from the account database by package name.
368  *
369  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
370  * @privlevel  public
371  * @privilege  %http://tizen.org/privilege/account.read \n
372  *             %http://tizen.org/privilege/account.write
373  * @remarks    This API need both privileges \n
374  *             Only can delete accounts which was added by same package applications
375  * @param[in]  package_name  The package name of account(s) to delete
376  *
377  * @return  @c 0 on success,
378  *          otherwise a negative error value
379  * @retval  #ACCOUNT_ERROR_NONE               Successful
380  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
381  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
382  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
383  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
384  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
385  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
386  *
387  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
388  *       But the account_connect() is not required to use this function since tizen 2.4.
389  *
390  * @see account_insert_to_db()
391  * @see account_delete_from_db_by_id()
392  * @see account_delete_from_db_by_user_name()
393  * @see account_update_to_db_by_id()
394  * @see account_update_to_db_by_user_name()
395  */
396 int account_delete_from_db_by_package_name(const char *package_name);
397
398 /**
399  * @brief  Updates the account details to the account database.
400  *
401  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
402  * @privlevel  public
403  * @privilege  %http://tizen.org/privilege/account.read \n
404  *             %http://tizen.org/privilege/account.write
405  * @remarks    This API need both privileges \n
406  *             Only can update an account which was added by same package applications
407  * @param[in]  account     The account handle
408  * @param[in]  account_id  The account ID to update
409  *
410  * @return  @c 0 on success,
411  *          otherwise a negative error value
412  * @retval  #ACCOUNT_ERROR_NONE               Successful
413  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
414  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
415  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   The account to update does not exist
416  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
417  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
418  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
419  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
420  *
421  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
422  *       But the account_connect() is not required to use this function since tizen 2.4.
423  *
424  * @see account_insert_to_db()
425  * @see account_delete_from_db_by_id()
426  * @see account_delete_from_db_by_user_name()
427  * @see account_delete_from_db_by_package_name()
428  * @see account_update_to_db_by_user_name()
429  */
430 int account_update_to_db_by_id(account_h account, int account_id);
431
432 /**
433  * @brief      Updates the account details to the account database.
434  *             The provider permission check has been added since tizen 2.4.
435  *
436  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
437  * @privlevel  public
438  * @privilege  %http://tizen.org/privilege/account.read \n
439  *             %http://tizen.org/privilege/account.write
440  * @remarks    This API need both privileges \n
441  *             Only can update an account which was added by same package applications
442  * @param[in]  account     The account handle
443  * @param[in]  account_id  The account ID to update
444  *
445  * @return  @c 0 on success,
446  *          otherwise a negative error value
447  * @retval  #ACCOUNT_ERROR_NONE               Successful
448  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
449  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
450  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
451  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   The account to update does not exist
452  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
453  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
454  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
455  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
456  *
457  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
458  *       But the account_connect() is not required to use this function since tizen 2.4.
459  *
460  * @see account_insert_to_db()
461  * @see account_delete_from_db_by_id()
462  * @see account_delete_from_db_by_user_name()
463  * @see account_delete_from_db_by_package_name()
464  * @see account_update_to_db_by_user_name()
465  */
466 int account_update_to_db_by_id_ex(account_h account, int account_id);
467
468 /**
469  * @brief  Updates the account details to the account database.
470  *
471  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
472  * @privlevel  public
473  * @privilege  %http://tizen.org/privilege/account.read \n
474  *             %http://tizen.org/privilege/account.write
475  * @remarks    This API need both privileges \n
476  *             Only can update accounts which were added by same package applications
477  * @param[in]  account       The account handle
478  * @param[in]  user_name     The user name of the account to update
479  * @param[in]  package_name  The package name for the user name
480  *
481  * @return  @c 0 on success,
482  *          otherwise a negative error value
483  * @retval  #ACCOUNT_ERROR_NONE               Successful
484  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
485  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
486  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   The account to update does not exist
487  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
488  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
489  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
490  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
491  *
492  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
493  *       But the account_connect() is not required to use this function since tizen 2.4.
494  *
495  * @see account_insert_to_db()
496  * @see account_delete_from_db_by_id()
497  * @see account_delete_from_db_by_user_name()
498  * @see account_delete_from_db_by_package_name()
499  * @see account_update_to_db_by_id()
500  *
501  */
502 int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
503
504 /**
505  * @brief  Gets the ID of an account.
506  *
507  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
508  * @param[in]   account     The account handle
509  * @param[out]  account_id  The account ID
510  *
511  * @return  @c 0 on success,
512  *          otherwise a negative error value
513  * @retval  #ACCOUNT_ERROR_NONE               Successful
514  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
515  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
516  *
517  */
518 int account_get_account_id(account_h account, int *account_id);
519
520 /**
521  * @brief  Gets the user name of an account.
522  *
523  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
524  * @remarks    You must release @a user_name using free().
525  *
526  * @param[in]   account    The account handle
527  * @param[out]  user_name  The user name of the account
528  *
529  * @return  @c 0 on success,
530  *          otherwise a negative error value
531  * @retval  #ACCOUNT_ERROR_NONE               Successful
532  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
533  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
534  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
535  *
536  * @see account_set_user_name()
537  */
538 int account_get_user_name(account_h account, char **user_name);
539
540
541 /**
542  * @brief  Sets the user name of an account.
543  *
544  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
545  * @param[in]  account    The account handle
546  * @param[in]  user_name  The string to set as user name
547  *
548  * @return  @c 0 on success,
549  *          otherwise a negative error value
550  * @retval  #ACCOUNT_ERROR_NONE               Successful
551  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
552  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
553  *
554  * @see account_get_user_name()
555  */
556 int account_set_user_name(account_h account, const char *user_name);
557
558
559 /**
560  * @brief  Gets the display name of an account.
561  *
562  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
563  * @remarks    You must release @a display_name using free().
564  *
565  * @param[in]   account       The account handle
566  * @param[out]  display_name  The display name of the account
567  *
568  * @return  @c 0 on success,
569  *          otherwise a negative error value
570  * @retval  #ACCOUNT_ERROR_NONE               Successful
571  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
572  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
573  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
574  *
575  * @see account_set_display_name()
576  */
577 int account_get_display_name(account_h account, char **display_name);
578
579
580 /**
581  * @brief  Sets the display name of an account.
582  *
583  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
584  * @param[in]  account      The account handle
585  * @param[in]  display_name The text string to set as the display name
586  *
587  * @return  @c 0 on success,
588  *          otherwise a negative error value
589  * @retval  #ACCOUNT_ERROR_NONE               Successful
590  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
591  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
592  *
593  */
594 int account_set_display_name(account_h account, const char *display_name);
595
596 /**
597  * @brief  Gets the capability detail of an account.
598  *
599  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
600  * @param[in]   account           The account handle
601  * @param[in]   capability_type   The capability type to get the capability value
602  * @param[out]  capability_value  The capability value (on/off) of the specified capability_type
603  *
604  * @return  @c 0 on success,
605  *          otherwise a negative error value
606  * @retval  #ACCOUNT_ERROR_NONE               Successful
607  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
608  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   There is no given capability_type in the account
609  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
610  *
611  * @see account_set_capability()
612  */
613 int account_get_capability(account_h account, const char *capability_type, account_capability_state_e *capability_value);
614
615 /**
616  * @brief  Gets all the capabilities of an account.
617  *
618  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
619  * @param[in]  account    The account handle
620  * @param[in]  callback   The callback function
621  * @param[in]  user_data  The user data to be passed to the callback function
622  *
623  * @return  @c 0 on success,
624  *          otherwise a negative error value
625  * @retval  #ACCOUNT_ERROR_NONE               Successful
626  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
627  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
628  *
629  * @see account_set_capability()
630  */
631 int account_get_capability_all(account_h account, capability_cb callback, void *user_data);
632
633 /**
634  * @brief  Sets the capability.
635  *
636  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
637  * @param[in]  account           The account handle
638  * @param[in]  capability_type   The capability type
639  * @param[in]  capability_state  The capability state
640  *
641  * @return  @c 0 on success,
642  *          otherwise a negative error value
643  * @retval  #ACCOUNT_ERROR_NONE               Successful
644  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
645  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
646  *
647  * @see account_get_capability()
648  */
649 int account_set_capability(account_h account, const char *capability_type, account_capability_state_e capability_state);
650
651
652 /**
653  * @brief  Gets the icon path.
654  *
655  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
656  * @remarks    You must release @a icon_path using free().
657  *
658  * @param[in]   account    The account handle
659  * @param[out]  icon_path  The icon path
660  *
661  * @return  @c 0 on success,
662  *          otherwise a negative error value
663  * @retval  #ACCOUNT_ERROR_NONE               Successful
664  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
665  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
666  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
667  *
668  * @see account_set_icon_path()
669  */
670 int account_get_icon_path(account_h account, char **icon_path);
671
672
673 /**
674  * @brief  Sets the icon path.
675  *
676  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
677  * @param[in]  account    The account handle
678  * @param[in]  icon_path  The text string to set as the icon path
679  *
680  * @return  @c 0 on success,
681  *          otherwise a negative error value
682  * @retval  #ACCOUNT_ERROR_NONE               Successful
683  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
684  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
685  *
686  * @see account_get_icon_path()
687  */
688 int account_set_icon_path(account_h account, const char *icon_path);
689
690
691 /**
692  * @brief  Gets the domain name.
693  *
694  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
695  * @remarks    You must release @a domain_name using free().
696  *
697  * @param[in]   account      The account handle
698  * @param[out]  domain_name  The domain name
699  *
700  * @return  @c 0 on success,
701  *          otherwise a negative error value
702  * @retval  #ACCOUNT_ERROR_NONE               Successful
703  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
704  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
705  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
706  *
707  * @see account_set_domain_name()
708  */
709 int account_get_domain_name(account_h account, char **domain_name);
710
711
712 /**
713  * @brief  Sets the domain name.
714  *
715  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
716  * @param[in]  account      The account handle
717  * @param[in]  domain_name  The text string to set as the domain name
718  *
719  * @return  @c 0 on success,
720  *          otherwise a negative error value
721  * @retval  #ACCOUNT_ERROR_NONE               Successful
722  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
723  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
724  *
725  * @see account_get_domain_name()
726  */
727 int account_set_domain_name(account_h account, const char *domain_name);
728
729
730 /**
731  * @brief  Gets the email address.
732  *
733  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
734  * @remarks    You must release @a email_address using free().
735  *
736  * @param[in]   account        The account handle
737  * @param[out]  email_address  The email address
738  *
739  * @return  @c 0 on success,
740  *          otherwise a negative error value
741  * @retval  #ACCOUNT_ERROR_NONE               Successful
742  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
743  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
744  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
745  *
746  * @see account_set_email_address()
747  */
748 int account_get_email_address(account_h account, char **email_address);
749
750
751 /**
752  * @brief  Sets the email address.
753  *
754  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
755  * @param[in]  account        The account handle
756  * @param[in]  email_address  The text string to set as the email address
757  *
758  * @return  @c 0 on success,
759  *          otherwise a negative error value
760  * @retval  #ACCOUNT_ERROR_NONE               Successful
761  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
762  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
763  *
764  * @see account_get_email_address()
765  */
766 int account_set_email_address(account_h account, const char *email_address);
767
768
769 /**
770  * @brief  Gets the package name.
771  *
772  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
773  * @remarks    You must release @a package_name using free().
774  *
775  * @param[in]   account       The account handle
776  * @param[out]  package_name  The package name
777  *
778  * @return  @c 0 on success,
779  *          otherwise a negative error value
780  * @retval  #ACCOUNT_ERROR_NONE               Successful
781  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
782  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
783  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
784  *
785  * @see account_set_package_name()
786  */
787 int account_get_package_name(account_h account, char **package_name);
788
789
790 /**
791  * @brief  Sets the package name.
792  *
793  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
794  * @param[in]  account       The account handle
795  * @param[in]  package_name  The text string to set as the package name
796  *
797  * @return  @c 0 on success,
798  *          otherwise a negative error value
799  * @retval  #ACCOUNT_ERROR_NONE               Successful
800  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
801  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
802  *
803  * @see account_get_email_address()
804  */
805 int account_set_package_name(account_h account, const char *package_name);
806
807
808 /**
809  * @brief  Gets the access token. Access token field is used to store account secrets (such as password or master token).
810  *
811  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
812  * @remarks    You must release @a access_token using free().
813  * @remarks    Access token field is used for storing account secret (password / master token etc)
814  *
815  * @param[in]   account       The account handle
816  * @param[out]  access_token  The access token
817  *
818  * @return  @c 0 on success,
819  *          otherwise a negative error value
820  * @retval  #ACCOUNT_ERROR_NONE               Successful
821  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
822  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
823  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
824  *
825  * Only account owner application can retrieve account password / access_token. For others this field will be null.
826  * @see account_set_access_token()
827  */
828 int account_get_access_token(account_h account, char **access_token);
829
830
831 /**
832  * @brief  Sets the access token. Access token field is used to store account secrets (such as password or master token).
833  *
834  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
835  * @remarks    Only account owner application can retrieve account password / access_token. For others this field will be null.
836  *
837  * @param[in]  account       The account handle
838  * @param[in]  access_token  The text string to set as the access token
839  *
840  * @return  @c 0 on success,
841  *          otherwise a negative error value
842  * @retval  #ACCOUNT_ERROR_NONE               Successful
843  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
844  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
845  * @see account_get_access_token()
846  */
847 int account_set_access_token(account_h account, const char *access_token);
848
849
850 /**
851  * @brief  Gets the user text.
852  *
853  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
854  * @remarks    You must release @a user_text using free().
855  *
856  * @param[in]   account          The account handle
857  * @param[in]   user_text_index  The index of the user text (range: 0 ~ 4)
858  * @param[out]  user_text        The user text
859  *
860  * @return  @c 0 on success,
861  *          otherwise a negative error value
862  * @retval  #ACCOUNT_ERROR_NONE               Successful
863  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
864  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
865  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
866  *
867  * @see account_set_user_text()
868  */
869 int account_get_user_text(account_h account, int user_text_index, char **user_text);
870
871
872 /**
873  * @brief  Sets the user text.
874  *
875  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
876  * @param[in]  account          The account handle
877  * @param[in]  user_text_index  The index of the user text (must be in range from @c 0 to @c 4)
878  * @param[in]  user_text        The text string to set as the user text
879  *
880  * @return  @c 0 on success,
881  *          otherwise a negative error value
882  * @retval  #ACCOUNT_ERROR_NONE               Successful
883  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
884  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
885  *
886  * @see account_get_user_text()
887  */
888 int account_set_user_text(account_h account, int user_text_index, const char *user_text);
889
890
891 /**
892  * @brief  Gets the user integer.
893  *
894  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
895  * @param[in]   account         The account handle
896  * @param[in]   user_int_index  The index of the user integer (must be in range from @c 0 to @c 4)
897  * @param[out]  user_integer    The user integer
898  *
899  * @return  @c 0 on success,
900  *          otherwise a negative error value
901  * @retval  #ACCOUNT_ERROR_NONE               Successful
902  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
903  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
904  *
905  * @see account_set_user_int()
906  */
907 int account_get_user_int(account_h account, int user_int_index, int *user_integer);
908
909
910 /**
911  * @brief  Sets the user integer.
912  *
913  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
914  * @param[in]  account         The account handle
915  * @param[in]  user_int_index  The index of the user integer (must be in range from @c 0 to @c 4)
916  * @param[in]  user_integer    The integer to set as the user integer
917  *
918  * @return  @c 0 on success,
919  *          otherwise a negative error value
920  * @retval  #ACCOUNT_ERROR_NONE               Successful
921  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
922  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
923  *
924  * @see account_get_user_int()
925  */
926 int account_set_user_int(account_h account, int user_int_index, int user_integer);
927
928
929 /**
930  * @brief  Gets the authentication type.
931  *
932  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
933  * @param[in]   account    The account handle
934  * @param[out]  auth_type  The authentication type
935  *
936  * @return  @c 0 on success,
937  *          otherwise a negative error value
938  * @retval  #ACCOUNT_ERROR_NONE               Successful
939  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
940  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
941  *
942  * @see account_set_auth_type()
943  */
944 int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
945
946
947 /**
948  * @brief  Sets the authentication type.
949  *
950  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
951   * @param[in]  account    The account handle
952  * @param[in]  auth_type  The integer to be set as the authentication type
953  *
954  * @return  @c 0 on success,
955  *          otherwise a negative error value
956  * @retval  #ACCOUNT_ERROR_NONE               Successful
957  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
958  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
959  *
960  * @see account_get_auth_type()
961  */
962 int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
963
964
965 /**
966  * @brief  Gets the secret.
967  *
968  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
969  * @param[in]   account  The account handle
970  * @param[out]  secret   The secret
971  *
972  * @return  @c 0 on success,
973  *          otherwise a negative error value
974  * @retval  #ACCOUNT_ERROR_NONE               Successful
975  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
976  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
977  *
978  * @see account_set_secret()
979  */
980 int account_get_secret(account_h account, account_secrecy_state_e *secret);
981
982
983 /**
984  * @brief  Sets the secret.
985  *
986  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
987  * @param[in]  account  The account handle
988  * @param[in]  secret   The secrecy to be set
989  *
990  * @return  @c 0 on success,
991  *          otherwise a negative error value
992  * @retval  #ACCOUNT_ERROR_NONE               Successful
993  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
994  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
995  *
996  * @see account_get_secret()
997  */
998 int account_set_secret(account_h account, const account_secrecy_state_e secret);
999
1000 /**
1001  * @brief  Gets the sync support.
1002  *
1003  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1004  * @param[in]   account       The account handle
1005  * @param[out]  sync_support  The sync support
1006  *
1007  * @return  @c 0 on success,
1008  *          otherwise a negative error value
1009  * @retval  #ACCOUNT_ERROR_NONE               Successful
1010  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1011  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1012  *
1013  * @see account_set_sync_support()
1014  */
1015 int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
1016
1017
1018 /**
1019  * @brief  Sets the sync support.
1020  *
1021  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1022  * @param[in]  account       The account handle
1023  * @param[in]  sync_support  The sync state to be set
1024  *
1025  * @return  @c 0 on success,
1026  *          otherwise a negative error value
1027  * @retval  #ACCOUNT_ERROR_NONE               Successful
1028  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1029  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1030  *
1031  * @see account_get_sync_support()
1032  */
1033 int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
1034
1035
1036 /**
1037  * @brief  Gets the source.
1038  *
1039  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1040  * @remarks    You must release @a source using free().
1041  *
1042  * @param[in]   account  The account handle
1043  * @param[out]  source   The source
1044  *
1045  * @return  @c 0 on success,
1046  *          otherwise a negative error value
1047  * @retval  #ACCOUNT_ERROR_NONE               Successful
1048  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1049  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1050  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1051  *
1052  * @see account_set_source()
1053  */
1054 int account_get_source(account_h account, char **source);
1055
1056
1057 /**
1058  * @brief  Sets the source.
1059  *
1060  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1061  * @param[in]  account  The account handle
1062  * @param[in]  source   The text string to set as the source
1063  *
1064  * @return  @c 0 on success,
1065  *          otherwise a negative error value
1066  * @retval  #ACCOUNT_ERROR_NONE               Successful
1067  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1068  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1069  *
1070  * @see account_get_source()
1071  */
1072 int account_set_source(account_h account, const char *source);
1073
1074 /**
1075  * @brief  Sets the custom.
1076  *
1077  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1078  * @param[in]  account  The account handle
1079  * @param[in]  key      The user custom key for the specific value
1080  * @param[in]  value    The user custom value about the given key
1081  *
1082  * @return  @c 0 on success,
1083  *          otherwise a negative error value
1084  * @retval  #ACCOUNT_ERROR_NONE               Successful
1085  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1086  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1087  *
1088  * @see account_get_custom()
1089  */
1090 int account_set_custom(account_h account, const char *key, const char *value);
1091
1092 /**
1093  * @brief  Gets the user specific custom text of an account key.
1094  *
1095  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1096  * @remarks    You must release @a value using free().
1097  *
1098  * @param[in]   account   The account handle
1099  * @param[in]   key       The key to retrieve custom text
1100  * @param[out]  value     The text of the given key
1101  *
1102  * @return  @c 0 on success,
1103  *          otherwise a negative error value
1104  * @retval  #ACCOUNT_ERROR_NONE               Successful
1105  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1106  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   There is no given capability type in the account
1107  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1108  *
1109  * @see account_set_custom()
1110  */
1111 int account_get_custom(account_h account, const char *key, char **value);
1112
1113
1114 /**
1115  * @brief  Gets all the user custom texts of an account.
1116  *
1117  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1118  * @param[in]  account    The account handle
1119  * @param[in]  callback   The callback function to retrieve all custom text \n
1120  *                        The callback function gives the key and value.
1121  * @param[in]  user_data  The user data to be passed to the callback function
1122  *
1123  * @return  @c 0 on success,
1124  *          otherwise a negative error value
1125  * @retval  #ACCOUNT_ERROR_NONE               Successful
1126  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1127  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1128  *
1129  * @see account_set_custom()
1130  */
1131 int account_get_custom_all(account_h account, account_custom_cb callback, void *user_data);
1132
1133 /**
1134  * @brief  Retrieves all accounts details by invoking the given callback function iteratively.
1135  *
1136  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1137  * @privlevel   public
1138  * @privilege   %http://tizen.org/privilege/account.read
1139  * @param[in]   callback   The callback function to invoke
1140  * @param[in]   user_data  The user data to be passed to the callback function
1141  *
1142  * @return  @c 0 on success,
1143  *          otherwise a negative error value
1144  * @retval  #ACCOUNT_ERROR_NONE               Successful
1145  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1146  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1147  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1148  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Related record does not exist
1149  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1150  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1151  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1152  *
1153  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1154  *        But the account_connect() is not required to use this function since tizen 2.4.
1155  * @post  This function invokes account_cb().
1156  *
1157  * @see account_query_account_by_account_id()
1158  * @see account_query_account_by_user_name()
1159  * @see account_query_account_by_package_name()
1160  * @see account_query_account_by_capability()
1161  */
1162 int account_foreach_account_from_db(account_cb callback, void *user_data);
1163
1164 /**
1165  * @brief  Retrieves an account with the account ID.
1166  *
1167  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1168  * @privlevel   public
1169  * @privilege   %http://tizen.org/privilege/account.read
1170  * @remarks     You must allocate @a account using account_create() and release using account_destroy().
1171  *
1172  * @param[in]   account_db_id  The account database ID to search
1173  * @param[out]  account        The account handle \n
1174  *
1175  * @return  @c 0 on success,
1176  *          otherwise a negative error value
1177  * @retval  #ACCOUNT_ERROR_NONE               Successful
1178  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1179  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1180  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1181  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1182  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1183  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1184  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1185  *
1186  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1187  *       But the account_connect() is not required to use this function since tizen 2.4.
1188  *
1189  * @see account_query_account_by_user_name()
1190  * @see account_query_account_by_package_name()
1191  * @see account_query_account_by_capability()
1192  */
1193 int account_query_account_by_account_id(int account_db_id, account_h *account);
1194
1195 /**
1196  * @brief  Retrieves deleted account with the account ID.
1197  *
1198  * @since_tizen 5.5
1199  * @privlevel   public
1200  * @privilege   %http://tizen.org/privilege/account.read
1201  * @remarks     The  @a account should be released using account_destroy().
1202  *
1203  * @param[in]   account_db_id  The id of the account to find in the database
1204  * @param[out]  account        The account handle
1205  *
1206  * @return  @c 0 on success,
1207  *          otherwise a negative error value
1208  * @retval  #ACCOUNT_ERROR_NONE               Successful
1209  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1210  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1211  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1212  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1213  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1214  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1215  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1216  *
1217  * @see account_query_account_by_account_id()
1218  * @see account_query_account_by_user_name()
1219  * @see account_query_account_by_package_name()
1220  * @see account_query_account_by_capability()
1221  */
1222 int account_query_deleted_account_info_by_account_id(int account_db_id, account_h *account);
1223
1224 /**
1225  * @brief  Retrieves all accounts with the user name.
1226  *
1227  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1228  * @privlevel   public
1229  * @privilege   %http://tizen.org/privilege/account.read
1230  * @param[in]   callback   The callback function to invoke
1231  * @param[in]   user_name  The user name to search
1232  * @param[in]   user_data  The user data to be passed to the callback function
1233  *
1234  * @return  @c 0 on success,
1235  *          otherwise a negative error value
1236  * @retval  #ACCOUNT_ERROR_NONE               Successful
1237  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1238  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1239  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1240  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1241  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1242  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1243  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1244  *
1245  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1246  *        But the account_connect() is not required to use this function since tizen 2.4.
1247  * @post  This function invokes account_cb().
1248  *
1249  * @see account_foreach_account_from_db()
1250  * @see account_query_account_by_account_id()
1251  * @see account_query_account_by_package_name()
1252  * @see account_query_account_by_capability()
1253  *
1254  */
1255 int account_query_account_by_user_name(account_cb callback, const char *user_name, void *user_data);
1256
1257 /**
1258  * @brief  Retrieves all accounts with the package name.
1259  *
1260  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1261  * @privlevel  public
1262  * @privilege  %http://tizen.org/privilege/account.read
1263  * @param[in]  callback      The callback function to invoke
1264  * @param[in]  package_name  The package name to search
1265  * @param[in]  user_data     The user data to be passed to the callback function
1266  *
1267  * @return  @c 0 on success,
1268  *          otherwise a negative error value
1269  * @retval  #ACCOUNT_ERROR_NONE               Successful
1270  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1271  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1272  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1273  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1274  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1275  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1276  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1277  *
1278  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1279  *        But the account_connect() is not required to use this function since tizen 2.4.
1280  * @post  This function invokes account_cb().
1281  *
1282  * @see account_foreach_account_from_db()
1283  * @see account_query_account_by_account_id()
1284  * @see account_query_account_by_user_name()
1285  * @see account_query_account_by_capability()
1286  */
1287 int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
1288
1289 /**
1290  * @brief  Retrieves all accounts with the capability type and capability value.
1291  *
1292  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1293  * @privlevel   public
1294  * @privilege   %http://tizen.org/privilege/account.read
1295  * @param[in]   callback          The callback function to invoke
1296  * @param[in]   capability_type   The capability type to search
1297  * @param[in]   capability_value  The capability value to search
1298  * @param[in]   user_data         The user data to be passed to the callback function
1299  *
1300  * @return  @c 0 on success,
1301  *          otherwise a negative error value
1302  * @retval  #ACCOUNT_ERROR_NONE               Successful
1303  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1304  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1305  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1306  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1307  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1308  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1309  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1310  *
1311  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1312  *        But the account_connect() is not required to use this function since tizen 2.4.
1313  * @post  This function invokes account_cb().
1314  *
1315  * @see account_foreach_account_from_db()
1316  * @see account_query_account_by_account_id()
1317  * @see account_query_account_by_user_name()
1318  * @see account_query_account_by_package_name()
1319  */
1320 int account_query_account_by_capability(account_cb callback, const char *capability_type, account_capability_state_e capability_value, void *user_data);
1321
1322 /**
1323  * @brief  Retrieves all accounts with the capability type.
1324  *
1325  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1326  * @privlevel   public
1327  * @privilege   %http://tizen.org/privilege/account.read
1328  * @param[in]   callback         The callback function to invoke
1329  * @param[in]   capability_type  The capability type to search
1330  * @param[in]   user_data        The user data to be passed to the callback function
1331  *
1332  * @return  @c 0 on success,
1333  *          otherwise a negative error value
1334  * @retval  #ACCOUNT_ERROR_NONE               Successful
1335  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1336  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1337  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1338  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1339  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1340  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1341  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1342  *
1343  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1344  *        But the account_connect() is not required to use this function since tizen 2.4.
1345  * @post  This function invokes account_cb().
1346  *
1347  * @see account_foreach_account_from_db()
1348  * @see account_query_account_by_account_id()
1349  * @see account_query_account_by_user_name()
1350  * @see account_query_account_by_package_name()
1351  */
1352 int account_query_account_by_capability_type(account_cb callback, const char *capability_type, void *user_data);
1353
1354 /**
1355  * @brief  Retrieves all capabilities with the account database ID.
1356  *
1357  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1358  * @privlevel   public
1359  * @privilege   %http://tizen.org/privilege/account.read
1360  * @param[in]   callback       The callback function to invoke
1361  * @param[in]   account_db_id  The account database ID to search
1362  * @param[in]   user_data      The user data to be passed to the callback function
1363  *
1364  * @return  @c 0 on success,
1365  *          otherwise a negative error value
1366  * @retval  #ACCOUNT_ERROR_NONE               Successful
1367  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1368  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1369  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1370  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1371  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1372  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1373  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1374  *
1375  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1376  *        But the account_connect() is not required to use this function since tizen 2.4.
1377  * @post  This function invokes capability_cb().
1378  *
1379  * @see account_get_capability()
1380  * @see account_set_capability()
1381  */
1382 int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
1383
1384
1385 /**
1386  * @brief  Gets the count of accounts in the account database.
1387  *
1388  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1389  * @privlevel   public
1390  * @privilege   %http://tizen.org/privilege/account.read
1391  * @param[out]  count  The out parameter for count of all accounts
1392  *
1393  * @return  @c 0 on success,
1394  *          otherwise a negative error value
1395  * @retval  #ACCOUNT_ERROR_NONE               Successful
1396  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1397  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1398  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1399  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1400  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1401  *
1402  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1403  *       But the account_connect() is not required to use this function since tizen 2.4.
1404  */
1405 int account_get_total_count_from_db(int *count);
1406
1407 /**
1408  * @brief  Updates the sync status of an account with the given account ID.
1409  *
1410  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1411  * @privlevel   public
1412  * @privilege   %http://tizen.org/privilege/account.read \n
1413  *              %http://tizen.org/privilege/account.write
1414  * @remarks     This API need both privileges \n
1415  *              Only can update an account which was added by same package applications
1416  * @param[in]   account_db_id  The account ID for which sync status needs to be changed
1417  * @param[in]   sync_status    The new sync status
1418  *
1419  * @return  @c 0 on success,
1420  *          otherwise a negative error value
1421  * @retval  #ACCOUNT_ERROR_NONE               Successful
1422  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1423  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1424  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1425  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1426  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1427  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1428  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1429  *
1430  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1431  *       But the account_connect() is not required to use this function since tizen 2.4.
1432  */
1433 int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
1434
1435
1436 /* Account type API */
1437
1438
1439 /**
1440  * @brief  Creates a handle to the account provider.
1441  *
1442  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1443  * @remarks     You must release @a account_type handle using account_type_destroy().\n
1444  *
1445  * @param[in]  account_type  The account provider handle
1446  *
1447  * @return  @c 0 on success,
1448  *          otherwise a negative error value
1449  * @retval  #ACCOUNT_ERROR_NONE               Successful
1450  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1451  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1452  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1453  *
1454  * @see account_type_destroy()
1455  */
1456 int account_type_create(account_type_h *account_type);
1457
1458 /**
1459  * @brief  Destroys the account provider handle and releases all its resources.
1460  *
1461  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1462  *
1463  * @remarks    When you get @a account_type using account_type_create(), you must release the handle using account_destroy() to avoid the memory leak.
1464  *
1465  * @param[in]  account_type  The account provider handle
1466  *
1467  * @return  @c 0 on success,
1468  *          otherwise a negative error value
1469  * @retval  #ACCOUNT_ERROR_NONE               Successful
1470  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1471  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1472  *
1473  * @see account_type_create()
1474  */
1475 int account_type_destroy(account_type_h account_type);
1476
1477 /**
1478  * @brief  Retrieves capability information with your application ID.
1479  *
1480  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1481  * @privlevel   public
1482  * @privilege   %http://tizen.org/privilege/account.read
1483  * @param[in]   callback   The callback function carries the capability name of an app ID
1484  * @param[in]   app_id     The application ID to search
1485  * @param[in]   user_data  The user data \n
1486  *                         If you have your private data to carry into callback function, then you can use it.
1487  *
1488  * @return  @c 0 on success,
1489  *          otherwise a negative error value
1490  * @retval  #ACCOUNT_ERROR_NONE               Successful
1491  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1492  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1493  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1494  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1495  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1496  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1497  *
1498  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1499  *       But the account_connect() is not required to use this function since tizen 2.4.
1500  */
1501 int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char *app_id, void *user_data);
1502
1503 /**
1504  * @brief   Checks whether the given application ID supports the capability.
1505  *
1506  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1507  * @privlevel   public
1508  * @privilege   %http://tizen.org/privilege/account.read
1509  * @remarks     The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1510  * @param[in]   app_id      The application ID
1511  * @param[in]   capability  The capability \n
1512  *                          For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
1513  *
1514  * @return  @c TRUE if the application supports the given capability, \n
1515  *          otherwise @c FALSE if the application does not support the given capability
1516  * @retval  @c TRUE means the application supports the given capability
1517  * @retval  @c FALSE means the application does not support the given capability
1518  * @exception #ACCOUNT_ERROR_NONE               Successful
1519  * @exception #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1520  * @exception #ACCOUNT_ERROR_RECORD_NOT_FOUND   Related record does not exist
1521  * @exception #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1522  * @exception #ACCOUNT_ERROR_PERMISSION_DENIED  DB access fail by permission
1523  * @exception #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1524  * @exception #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1525  * @exception #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1526  *
1527  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1528  *       But the account_connect() is not required to use this function since tizen 2.4.
1529  */
1530 bool account_type_query_supported_feature(const char *app_id, const char *capability);
1531
1532 /**
1533  * @brief  Gets the application ID of an account provider.
1534  *
1535  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1536  * @remarks     You must release @a app_id using free().
1537  *
1538  * @param[in]   account_type  The account provider handle \n
1539  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1540  * @param[out]  app_id        The application ID of an account provider item
1541  *
1542  * @return  @c 0 on success,
1543  *          otherwise a negative error value
1544  * @retval  #ACCOUNT_ERROR_NONE               Successful
1545  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1546  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1547  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1548  *
1549  * @see account_type_foreach_account_type_from_db()
1550  * @see account_type_query_by_app_id()
1551  */
1552 int account_type_get_app_id(account_type_h account_type, char **app_id);
1553
1554 /**
1555  * @brief  Gets the service provider ID of an account provider.
1556  *
1557  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1558  * @remarks     You must release @a service_provider_id using free().
1559  *
1560  * @param[in]   account_type         The account provider handle \n
1561  *                                   It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1562  * @param[out]  service_provider_id  The service provider text ID of an account provider item
1563  *
1564  * @return  @c 0 on success,
1565  *          otherwise a negative error value
1566  * @retval  #ACCOUNT_ERROR_NONE               Successful
1567  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1568  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1569  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1570  *
1571  * @see account_type_foreach_account_type_from_db()
1572  * @see account_type_query_by_app_id()
1573  */
1574 int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
1575
1576 /**
1577  * @brief  Gets the icon path of an account provider.
1578  *
1579  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1580  * @remarks     You must release @a icon_path using free().
1581  *
1582  * @param[in]   account_type  The account provider handle \n
1583  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1584  * @param[out]  icon_path     The icon path of the account provider item
1585  *
1586  * @return  @c 0 on success,
1587  *          otherwise a negative error value
1588  * @retval  #ACCOUNT_ERROR_NONE               Successful
1589  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1590  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1591  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1592  *
1593  * @see account_type_foreach_account_type_from_db()
1594  * @see account_type_query_by_app_id()
1595  */
1596 int account_type_get_icon_path(account_type_h account_type, char **icon_path);
1597
1598 /**
1599  * @brief  Gets the small icon path of an account provider.
1600  *
1601  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1602  * @remarks    You must release @a small_icon_path using free().
1603  *
1604  * @param[in]   account_type     The account provider handle\n
1605  *                               It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1606  * @param[out]  small_icon_path  The small icon path of the account provider item
1607  *
1608  * @return  @c 0 on success,
1609  *          otherwise a negative error value
1610  * @retval  #ACCOUNT_ERROR_NONE               Successful
1611  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1612  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1613  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1614  *
1615  * @see account_type_foreach_account_type_from_db()
1616  * @see account_type_query_by_app_id()
1617  */
1618 int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
1619
1620 /**
1621  * @brief  Checks whether the given account provider supports multiple accounts.
1622  *
1623  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1624  * @param[in]   account_type              The account provider handle \n
1625  *                                        It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1626  * @param[out]  multiple_account_support  The flag indicating support for multiple accounts accounts\n
1627  *                                        TRUE or FALSE.
1628  *
1629  * @return  @c 0 on success,
1630  *          otherwise a negative error value
1631  * @retval  #ACCOUNT_ERROR_NONE               Successful
1632  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1633  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1634  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1635  *
1636  * @see account_type_foreach_account_type_from_db()
1637  * @see account_type_query_by_app_id()
1638  */
1639 int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
1640
1641 /**
1642  * @brief  Gets capability information with the given account provider handle.
1643  *
1644  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1645  * @param[in]   account_type  The account provider handle\n
1646  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1647  * @param[in]   callback      The callback function that carries the capability name of the app ID
1648  * @param[in]   user_data     The user data \n
1649  *                            If you have your private data to carry into callback function, then you can use it.
1650  *
1651  * @return  @c 0 on success,
1652  *          otherwise a negative error value
1653  * @retval  #ACCOUNT_ERROR_NONE               Successful
1654  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1655  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1656  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1657  *
1658  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1659  *       But the account_connect() is not required to use this function since tizen 2.4.
1660  */
1661 int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void *user_data);
1662
1663 /**
1664  * @brief  Gets the specific label information detail of an account provider.
1665  *
1666  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1667  * @remarks    You must release @a label using free().
1668  *
1669  * @param[in]   account_type The account provider handle\n
1670  *                           It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1671  * @param[in]   locale       The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
1672  *                           For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
1673  * @param[out]  label        The label text given for the locale
1674  *
1675  * @return  @c 0 on success,
1676  *          otherwise a negative error value
1677  * @retval  #ACCOUNT_ERROR_NONE               Successful
1678  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   No label for the given locale
1679  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1680  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1681  *
1682  * @see account_type_foreach_account_type_from_db()
1683  * @see account_type_query_by_app_id()
1684  */
1685
1686 int account_type_get_label_by_locale(account_type_h account_type, const char *locale, char **label);
1687
1688 /**
1689  * @brief  Gets the label information detail of an account provider.
1690  *
1691  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1692  * @param[in]   account_type  The account provider handle\n
1693  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1694  * @param[in]   callback      The callback function carrying the label information
1695  * @param[in]   user_data     The user data to be passed to the callback function
1696  *
1697  * @return  @c 0 on success,
1698  *          otherwise a negative error value
1699  * @retval  #ACCOUNT_ERROR_NONE               Successful
1700  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1701  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1702  *
1703  * @see account_type_foreach_account_type_from_db()
1704  * @see account_type_query_by_app_id()
1705  */
1706 int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data);
1707
1708 /**
1709  * @brief  Retrieves the label information with your application ID.
1710  *
1711  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1712  * @privlevel   public
1713  * @privilege   %http://tizen.org/privilege/account.read
1714  * @param[in]   callback    The callback function that carries label_h for label information \n
1715  *                         label_h contains label info as parameter.
1716  * @param[in]   app_id     The application ID to search
1717  * @param[in]   user_data  The user data \n
1718  *                         If you have your private data to carry into callback function, then you can use it.
1719  *
1720  * @return  @c 0 on success,
1721  *          otherwise a negative error value
1722  * @retval  #ACCOUNT_ERROR_NONE               Successful
1723  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1724  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1725  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1726  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1727  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1728  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1729  *
1730  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1731  *       But the account_connect() is not required to use this function since tizen 2.4.
1732  *
1733  * @see account_type_query_by_app_id()
1734  * @see account_type_foreach_account_type_from_db()
1735  */
1736 int account_type_query_label_by_app_id(account_label_cb callback, const char *app_id, void *user_data);
1737
1738 /**
1739  * @brief  Retrieves the account provider information with your application ID.
1740  *
1741  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1742  * @privlevel     public
1743  * @privilege     %http://tizen.org/privilege/account.read
1744  * @param[in]     app_id        The application ID to search
1745  * @param[in,out] account_type  The account handle which has to be created by account_type_create() before calling this function and released by account_type_destroy() after calling this function.
1746  *
1747  * @return  @c 0 on success,
1748  *          otherwise a negative error value
1749  * @retval  #ACCOUNT_ERROR_NONE               Successful
1750  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1751  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1752  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Queried data does not exist
1753  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1754  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1755  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1756  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1757  *
1758  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1759  *       But the account_connect() is not required to use this function since tizen 2.4.
1760  *
1761  * @see account_type_create()
1762  * @see account_type_get_app_id()
1763  * @see account_type_get_service_provider_id()
1764  * @see account_type_get_icon_path()
1765  * @see account_type_get_small_icon_path()
1766  * @see account_type_get_multiple_account_support()
1767  * @see account_type_get_label()
1768  * @see account_type_destroy()
1769  */
1770 int account_type_query_by_app_id(const char *app_id, account_type_h *account_type);
1771
1772 /**
1773  * @brief  Retrieves all account provider information.
1774  *
1775  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1776  * @privlevel   public
1777  * @privilege   %http://tizen.org/privilege/account.read
1778  * @param[in]   callback   The account provider information \n
1779  *                         You can get the account information through account_type_get_* with the carried account_type_handle.
1780  * @param[in]   user_data  The user data \n
1781  *                         It will be carried through your callback function.
1782  *
1783  * @return  @c 0 on success,
1784  *          otherwise a negative error value
1785  * @retval  #ACCOUNT_ERROR_NONE               Successful
1786  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1787  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1788  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1789  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1790  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1791  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1792  *
1793  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1794  *       But the account_connect() is not required to use this function since tizen 2.4.
1795  *
1796  * @see account_type_create()
1797  * @see account_type_get_app_id()
1798  * @see account_type_get_service_provider_id()
1799  * @see account_type_get_icon_path()
1800  * @see account_type_get_small_icon_path()
1801  * @see account_type_get_multiple_account_support()
1802  * @see account_type_get_label()
1803  * @see account_type_destroy()
1804  */
1805 int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
1806
1807 /**
1808  * @brief  Retrieves the label information with the given application ID and locale.
1809  *
1810  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1811  * @privlevel   public
1812  * @privilege   %http://tizen.org/privilege/account.read
1813  * @param[in]   app_id  The application ID
1814  * @param[in]   locale  The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
1815  *                      For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
1816  * @param[out]  label   The label text corresponding app_id and locale \n
1817  *                      It must be free text.
1818  *
1819  * @return  @c 0 on success,
1820  *          otherwise a negative error value
1821  * @retval  #ACCOUNT_ERROR_NONE               Successful
1822  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1823  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1824  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1825  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1826  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1827  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1828  *
1829  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1830  *       But the account_connect() is not required to use this function since tizen 2.4.
1831  */
1832 int account_type_query_label_by_locale(const char *app_id, const char *locale, char **label);
1833
1834 /**
1835  * @brief  Retrieves account provider information with the capability name.
1836  *
1837  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1838  * @privlevel   public
1839  * @privilege   %http://tizen.org/privilege/account.read
1840  * @param[in]   callback        The callback function to retrieve account provider information
1841  * @param[in]   key             The capability value to search account provider \n
1842  *                              For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
1843  * @param[in]  user_data        If you have your private data to carry into callback function, then you can use it
1844  *
1845  * @return  @c 0 on success,
1846  *          otherwise a negative error value
1847  * @retval  #ACCOUNT_ERROR_NONE               Successful
1848  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Record not found
1849  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1850  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1851  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1852  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1853  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1854  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1855  *
1856  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1857  *       But the account_connect() is not required to use this function since tizen 2.4.
1858  */
1859 int account_type_query_by_provider_feature(account_type_cb callback, const char *key, void *user_data);
1860
1861 /**
1862  * @brief  Checks whether the given app_id exists in the account provider DB.
1863  *
1864  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1865  * @privlevel   public
1866  * @privilege   %http://tizen.org/privilege/account.read
1867  * @param[in]   app_id  The application ID to check
1868  *
1869  * @return  @c 0 on success,
1870  *          otherwise a negative error value
1871  * @retval  #ACCOUNT_ERROR_NONE               Successful
1872  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Record not found
1873  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid app ID
1874  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1875  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1876  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1877  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1878  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1879  *
1880  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1881  *       But the account_connect() is not required to use this function since tizen 2.4.
1882  *
1883  * @see account_type_query_by_app_id()
1884  */
1885 int account_type_query_app_id_exist(const char *app_id);
1886
1887
1888
1889 /* End of account provider API  */
1890
1891 /**
1892  * @brief  Creates a handle for the account event subscription.
1893  *
1894  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1895  * @remarks     You must release @a account_subscribe handle using account_unsubscribe_notification().
1896  *
1897  * @param[in]   account_subscribe  The account subscription handle
1898  *
1899  * @return  @c 0 on success,
1900  *          otherwise a negative error value
1901  * @retval  #ACCOUNT_ERROR_NONE               Successful
1902  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1903  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1904  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1905  *
1906  * @see account_unsubscribe_notification()
1907  * @see account_subscribe_notification()
1908  */
1909 int account_subscribe_create(account_subscribe_h *account_subscribe);
1910
1911 /**
1912  * @brief  Starts to subscribe account event through the given callback function.
1913  *
1914  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1915  * @privlevel   public
1916  * @privilege   %http://tizen.org/privilege/account.read \n
1917  * @param[in]   account_subscribe  The account subscription handle
1918  * @param[in]   callback           The callback function that is called when an account is removed and a data of account is updated from the account database \n
1919  *                                 It will be called with event message and account ID.
1920  * @param[in]   user_data          The user_data that is delivered to callback
1921  *
1922  * @return  @c 0 on success,
1923  *          otherwise a negative error value
1924  * @retval  #ACCOUNT_ERROR_NONE                     Successful
1925  * @retval  #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL  Subscription fail
1926  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER        Invalid parameter
1927  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED            Not supported
1928  *
1929  * @see account_unsubscribe_notification()
1930  */
1931 int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void *user_data);
1932
1933 /**
1934  * @brief  Destroys the account subscribe handle and releases all its resources.
1935  *
1936  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1937  * @privlevel   public
1938  * @privilege   %http://tizen.org/privilege/account.read \n
1939  * @remarks     You must call account_unsubscribe_notification() when you do not need to subscribe account event.
1940  *
1941  * @param[in]   account_subscribe  The account subscription handle
1942  *
1943  * @return  @c 0 on success,
1944  *          otherwise a negative error value
1945  * @retval  #ACCOUNT_ERROR_NONE                     Successful
1946  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER        Invalid parameter
1947  * @retval  #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL  Unsubscription failed
1948  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED            Not supported
1949  *
1950  * @see account_create()
1951  */
1952 int account_unsubscribe_notification(account_subscribe_h account_subscribe);
1953
1954
1955 /* End of Account APIs */
1956 /**
1957  * @}
1958  */
1959
1960
1961 #ifdef __cplusplus
1962 }
1963 #endif
1964
1965
1966 #endif /* __ACCOUNT_H__ */