639d3ed36515d45d710bcb58e849073e579f0ba8
[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  * @see account_get_display_name()
594  */
595 int account_set_display_name(account_h account, const char *display_name);
596
597 /**
598  * @brief  Gets the capability detail of an account.
599  *
600  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
601  * @param[in]   account           The account handle
602  * @param[in]   capability_type   The capability type to get the capability value
603  * @param[out]  capability_value  The capability value (on/off) of the specified capability_type
604  *
605  * @return  @c 0 on success,
606  *          otherwise a negative error value
607  * @retval  #ACCOUNT_ERROR_NONE               Successful
608  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
609  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   There is no given capability_type in the account
610  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
611  *
612  * @see account_set_capability()
613  */
614 int account_get_capability(account_h account, const char *capability_type, account_capability_state_e *capability_value);
615
616 /**
617  * @brief  Gets all the capabilities of an account.
618  *
619  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
620  * @param[in]  account    The account handle
621  * @param[in]  callback   The callback function
622  * @param[in]  user_data  The user data to be passed to the callback function
623  *
624  * @return  @c 0 on success,
625  *          otherwise a negative error value
626  * @retval  #ACCOUNT_ERROR_NONE               Successful
627  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
628  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
629  *
630  * @see account_set_capability()
631  */
632 int account_get_capability_all(account_h account, capability_cb callback, void *user_data);
633
634 /**
635  * @brief  Sets the capability.
636  *
637  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
638  * @param[in]  account           The account handle
639  * @param[in]  capability_type   The capability type
640  * @param[in]  capability_state  The capability state
641  *
642  * @return  @c 0 on success,
643  *          otherwise a negative error value
644  * @retval  #ACCOUNT_ERROR_NONE               Successful
645  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
646  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
647  *
648  * @see account_get_capability()
649  */
650 int account_set_capability(account_h account, const char *capability_type, account_capability_state_e capability_state);
651
652
653 /**
654  * @brief  Gets the icon path.
655  *
656  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
657  * @remarks    You must release @a icon_path using free().
658  *
659  * @param[in]   account    The account handle
660  * @param[out]  icon_path  The icon path
661  *
662  * @return  @c 0 on success,
663  *          otherwise a negative error value
664  * @retval  #ACCOUNT_ERROR_NONE               Successful
665  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
666  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
667  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
668  *
669  * @see account_set_icon_path()
670  */
671 int account_get_icon_path(account_h account, char **icon_path);
672
673
674 /**
675  * @brief  Sets the icon path.
676  *
677  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
678  * @param[in]  account    The account handle
679  * @param[in]  icon_path  The text string to set as the icon path
680  *
681  * @return  @c 0 on success,
682  *          otherwise a negative error value
683  * @retval  #ACCOUNT_ERROR_NONE               Successful
684  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
685  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
686  *
687  * @see account_get_icon_path()
688  */
689 int account_set_icon_path(account_h account, const char *icon_path);
690
691
692 /**
693  * @brief  Gets the domain name.
694  *
695  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
696  * @remarks    You must release @a domain_name using free().
697  *
698  * @param[in]   account      The account handle
699  * @param[out]  domain_name  The domain name
700  *
701  * @return  @c 0 on success,
702  *          otherwise a negative error value
703  * @retval  #ACCOUNT_ERROR_NONE               Successful
704  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
705  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
706  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
707  *
708  * @see account_set_domain_name()
709  */
710 int account_get_domain_name(account_h account, char **domain_name);
711
712
713 /**
714  * @brief  Sets the domain name.
715  *
716  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
717  * @param[in]  account      The account handle
718  * @param[in]  domain_name  The text string to set as the domain name
719  *
720  * @return  @c 0 on success,
721  *          otherwise a negative error value
722  * @retval  #ACCOUNT_ERROR_NONE               Successful
723  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
724  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
725  *
726  * @see account_get_domain_name()
727  */
728 int account_set_domain_name(account_h account, const char *domain_name);
729
730
731 /**
732  * @brief  Gets the email address.
733  *
734  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
735  * @remarks    You must release @a email_address using free().
736  *
737  * @param[in]   account        The account handle
738  * @param[out]  email_address  The email address
739  *
740  * @return  @c 0 on success,
741  *          otherwise a negative error value
742  * @retval  #ACCOUNT_ERROR_NONE               Successful
743  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
744  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
745  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
746  *
747  * @see account_set_email_address()
748  */
749 int account_get_email_address(account_h account, char **email_address);
750
751
752 /**
753  * @brief  Sets the email address.
754  *
755  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
756  * @param[in]  account        The account handle
757  * @param[in]  email_address  The text string to set as the email address
758  *
759  * @return  @c 0 on success,
760  *          otherwise a negative error value
761  * @retval  #ACCOUNT_ERROR_NONE               Successful
762  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
763  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
764  *
765  * @see account_get_email_address()
766  */
767 int account_set_email_address(account_h account, const char *email_address);
768
769
770 /**
771  * @brief  Gets the package name.
772  *
773  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
774  * @remarks    You must release @a package_name using free().
775  *
776  * @param[in]   account       The account handle
777  * @param[out]  package_name  The package name
778  *
779  * @return  @c 0 on success,
780  *          otherwise a negative error value
781  * @retval  #ACCOUNT_ERROR_NONE               Successful
782  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
783  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
784  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
785  *
786  * @see account_set_package_name()
787  */
788 int account_get_package_name(account_h account, char **package_name);
789
790
791 /**
792  * @brief  Sets the package name.
793  *
794  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
795  * @param[in]  account       The account handle
796  * @param[in]  package_name  The text string to set as the package name
797  *
798  * @return  @c 0 on success,
799  *          otherwise a negative error value
800  * @retval  #ACCOUNT_ERROR_NONE               Successful
801  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
802  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
803  *
804  * @see account_get_email_address()
805  */
806 int account_set_package_name(account_h account, const char *package_name);
807
808
809 /**
810  * @brief  Gets the access token. Access token field is used to store account secrets (such as password or master token).
811  *
812  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
813  * @remarks    You must release @a access_token using free().
814  * @remarks    Access token field is used for storing account secret (password / master token etc)
815  *
816  * @param[in]   account       The account handle
817  * @param[out]  access_token  The access token
818  *
819  * @return  @c 0 on success,
820  *          otherwise a negative error value
821  * @retval  #ACCOUNT_ERROR_NONE               Successful
822  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
823  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
824  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
825  *
826  * Only account owner application can retrieve account password / access_token. For others this field will be null.
827  * @see account_set_access_token()
828  */
829 int account_get_access_token(account_h account, char **access_token);
830
831
832 /**
833  * @brief  Sets the access token. Access token field is used to store account secrets (such as password or master token).
834  *
835  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
836  * @remarks    Only account owner application can retrieve account password / access_token. For others this field will be null.
837  *
838  * @param[in]  account       The account handle
839  * @param[in]  access_token  The text string to set as the access token
840  *
841  * @return  @c 0 on success,
842  *          otherwise a negative error value
843  * @retval  #ACCOUNT_ERROR_NONE               Successful
844  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
845  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
846  * @see account_get_access_token()
847  */
848 int account_set_access_token(account_h account, const char *access_token);
849
850
851 /**
852  * @brief  Gets the user text.
853  *
854  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
855  * @remarks    You must release @a user_text using free().
856  *
857  * @param[in]   account          The account handle
858  * @param[in]   user_text_index  The index of the user text (range: 0 ~ 4)
859  * @param[out]  user_text        The user text
860  *
861  * @return  @c 0 on success,
862  *          otherwise a negative error value
863  * @retval  #ACCOUNT_ERROR_NONE               Successful
864  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
865  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
866  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
867  *
868  * @see account_set_user_text()
869  */
870 int account_get_user_text(account_h account, int user_text_index, char **user_text);
871
872
873 /**
874  * @brief  Sets the user text.
875  *
876  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
877  * @param[in]  account          The account handle
878  * @param[in]  user_text_index  The index of the user text (must be in range from @c 0 to @c 4)
879  * @param[in]  user_text        The text string to set as the user text
880  *
881  * @return  @c 0 on success,
882  *          otherwise a negative error value
883  * @retval  #ACCOUNT_ERROR_NONE               Successful
884  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
885  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
886  *
887  * @see account_get_user_text()
888  */
889 int account_set_user_text(account_h account, int user_text_index, const char *user_text);
890
891
892 /**
893  * @brief  Gets the user integer.
894  *
895  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
896  * @param[in]   account         The account handle
897  * @param[in]   user_int_index  The index of the user integer (must be in range from @c 0 to @c 4)
898  * @param[out]  user_integer    The user integer
899  *
900  * @return  @c 0 on success,
901  *          otherwise a negative error value
902  * @retval  #ACCOUNT_ERROR_NONE               Successful
903  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
904  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
905  *
906  * @see account_set_user_int()
907  */
908 int account_get_user_int(account_h account, int user_int_index, int *user_integer);
909
910
911 /**
912  * @brief  Sets the user integer.
913  *
914  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
915  * @param[in]  account         The account handle
916  * @param[in]  user_int_index  The index of the user integer (must be in range from @c 0 to @c 4)
917  * @param[in]  user_integer    The integer to set as the user integer
918  *
919  * @return  @c 0 on success,
920  *          otherwise a negative error value
921  * @retval  #ACCOUNT_ERROR_NONE               Successful
922  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
923  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
924  *
925  * @see account_get_user_int()
926  */
927 int account_set_user_int(account_h account, int user_int_index, int user_integer);
928
929
930 /**
931  * @brief  Gets the authentication type.
932  *
933  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
934  * @param[in]   account    The account handle
935  * @param[out]  auth_type  The authentication type
936  *
937  * @return  @c 0 on success,
938  *          otherwise a negative error value
939  * @retval  #ACCOUNT_ERROR_NONE               Successful
940  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
941  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
942  *
943  * @see account_set_auth_type()
944  */
945 int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
946
947
948 /**
949  * @brief  Sets the authentication type.
950  *
951  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
952   * @param[in]  account    The account handle
953  * @param[in]  auth_type  The integer to be set as the authentication type
954  *
955  * @return  @c 0 on success,
956  *          otherwise a negative error value
957  * @retval  #ACCOUNT_ERROR_NONE               Successful
958  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
959  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
960  *
961  * @see account_get_auth_type()
962  */
963 int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
964
965
966 /**
967  * @brief  Gets the secret.
968  *
969  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
970  * @param[in]   account  The account handle
971  * @param[out]  secret   The secret
972  *
973  * @return  @c 0 on success,
974  *          otherwise a negative error value
975  * @retval  #ACCOUNT_ERROR_NONE               Successful
976  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
977  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
978  *
979  * @see account_set_secret()
980  */
981 int account_get_secret(account_h account, account_secrecy_state_e *secret);
982
983
984 /**
985  * @brief  Sets the secret.
986  *
987  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
988  * @param[in]  account  The account handle
989  * @param[in]  secret   The secrecy to be set
990  *
991  * @return  @c 0 on success,
992  *          otherwise a negative error value
993  * @retval  #ACCOUNT_ERROR_NONE               Successful
994  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
995  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
996  *
997  * @see account_get_secret()
998  */
999 int account_set_secret(account_h account, const account_secrecy_state_e secret);
1000
1001 /**
1002  * @brief  Gets the sync support.
1003  *
1004  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1005  * @param[in]   account       The account handle
1006  * @param[out]  sync_support  The sync support
1007  *
1008  * @return  @c 0 on success,
1009  *          otherwise a negative error value
1010  * @retval  #ACCOUNT_ERROR_NONE               Successful
1011  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1012  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1013  *
1014  * @see account_set_sync_support()
1015  */
1016 int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
1017
1018
1019 /**
1020  * @brief  Sets the sync support.
1021  *
1022  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1023  * @param[in]  account       The account handle
1024  * @param[in]  sync_support  The sync state to be set
1025  *
1026  * @return  @c 0 on success,
1027  *          otherwise a negative error value
1028  * @retval  #ACCOUNT_ERROR_NONE               Successful
1029  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1030  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1031  *
1032  * @see account_get_sync_support()
1033  */
1034 int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
1035
1036
1037 /**
1038  * @brief  Gets the source.
1039  *
1040  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1041  * @remarks    You must release @a source using free().
1042  *
1043  * @param[in]   account  The account handle
1044  * @param[out]  source   The source
1045  *
1046  * @return  @c 0 on success,
1047  *          otherwise a negative error value
1048  * @retval  #ACCOUNT_ERROR_NONE               Successful
1049  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1050  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1051  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1052  *
1053  * @see account_set_source()
1054  */
1055 int account_get_source(account_h account, char **source);
1056
1057
1058 /**
1059  * @brief  Sets the source.
1060  *
1061  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1062  * @param[in]  account  The account handle
1063  * @param[in]  source   The text string to set as the source
1064  *
1065  * @return  @c 0 on success,
1066  *          otherwise a negative error value
1067  * @retval  #ACCOUNT_ERROR_NONE               Successful
1068  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1069  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1070  *
1071  * @see account_get_source()
1072  */
1073 int account_set_source(account_h account, const char *source);
1074
1075 /**
1076  * @brief  Sets the custom.
1077  *
1078  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1079  * @param[in]  account  The account handle
1080  * @param[in]  key      The user custom key for the specific value
1081  * @param[in]  value    The user custom value about the given key
1082  *
1083  * @return  @c 0 on success,
1084  *          otherwise a negative error value
1085  * @retval  #ACCOUNT_ERROR_NONE               Successful
1086  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1087  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1088  *
1089  * @see account_get_custom()
1090  */
1091 int account_set_custom(account_h account, const char *key, const char *value);
1092
1093 /**
1094  * @brief  Gets the user specific custom text of an account key.
1095  *
1096  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1097  * @remarks    You must release @a value using free().
1098  *
1099  * @param[in]   account   The account handle
1100  * @param[in]   key       The key to retrieve custom text
1101  * @param[out]  value     The text of the given key
1102  *
1103  * @return  @c 0 on success,
1104  *          otherwise a negative error value
1105  * @retval  #ACCOUNT_ERROR_NONE               Successful
1106  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1107  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   There is no given capability type in the account
1108  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1109  *
1110  * @see account_set_custom()
1111  */
1112 int account_get_custom(account_h account, const char *key, char **value);
1113
1114
1115 /**
1116  * @brief  Gets all the user custom texts of an account.
1117  *
1118  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1119  * @param[in]  account    The account handle
1120  * @param[in]  callback   The callback function to retrieve all custom text \n
1121  *                        The callback function gives the key and value.
1122  * @param[in]  user_data  The user data to be passed to the callback function
1123  *
1124  * @return  @c 0 on success,
1125  *          otherwise a negative error value
1126  * @retval  #ACCOUNT_ERROR_NONE               Successful
1127  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1128  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1129  *
1130  * @see account_set_custom()
1131  */
1132 int account_get_custom_all(account_h account, account_custom_cb callback, void *user_data);
1133
1134 /**
1135  * @brief  Retrieves all accounts details by invoking the given callback function iteratively.
1136  *
1137  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1138  * @privlevel   public
1139  * @privilege   %http://tizen.org/privilege/account.read
1140  * @param[in]   callback   The callback function to invoke
1141  * @param[in]   user_data  The user data to be passed to the callback function
1142  *
1143  * @return  @c 0 on success,
1144  *          otherwise a negative error value
1145  * @retval  #ACCOUNT_ERROR_NONE               Successful
1146  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1147  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1148  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1149  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Related record does not exist
1150  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1151  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1152  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1153  *
1154  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1155  *        But the account_connect() is not required to use this function since tizen 2.4.
1156  * @post  This function invokes account_cb().
1157  *
1158  * @see account_query_account_by_account_id()
1159  * @see account_query_account_by_user_name()
1160  * @see account_query_account_by_package_name()
1161  * @see account_query_account_by_capability()
1162  */
1163 int account_foreach_account_from_db(account_cb callback, void *user_data);
1164
1165 /**
1166  * @brief  Retrieves an account with the account ID.
1167  *
1168  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1169  * @privlevel   public
1170  * @privilege   %http://tizen.org/privilege/account.read
1171  * @remarks     You must allocate @a account using account_create() and release using account_destroy().
1172  *
1173  * @param[in]   account_db_id  The account database ID to search
1174  * @param[out]  account        The account handle \n
1175  *
1176  * @return  @c 0 on success,
1177  *          otherwise a negative error value
1178  * @retval  #ACCOUNT_ERROR_NONE               Successful
1179  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1180  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1181  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1182  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1183  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1184  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1185  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1186  *
1187  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1188  *       But the account_connect() is not required to use this function since tizen 2.4.
1189  *
1190  * @see account_query_account_by_user_name()
1191  * @see account_query_account_by_package_name()
1192  * @see account_query_account_by_capability()
1193  */
1194 int account_query_account_by_account_id(int account_db_id, account_h *account);
1195
1196 /**
1197  * @brief  Retrieves deleted account with the account ID.
1198  *
1199  * @since_tizen 5.5
1200  * @privlevel   public
1201  * @privilege   %http://tizen.org/privilege/account.read
1202  * @remarks     The  @a account should be released using account_destroy().
1203  *
1204  * @param[in]   account_db_id  The id of the account to find in the database
1205  * @param[out]  account        The account handle
1206  *
1207  * @return  @c 0 on success,
1208  *          otherwise a negative error value
1209  * @retval  #ACCOUNT_ERROR_NONE               Successful
1210  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1211  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1212  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1213  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1214  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1215  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1216  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1217  *
1218  * @see account_query_account_by_account_id()
1219  * @see account_query_account_by_user_name()
1220  * @see account_query_account_by_package_name()
1221  * @see account_query_account_by_capability()
1222  */
1223 int account_query_deleted_account_info_by_account_id(int account_db_id, account_h *account);
1224
1225 /**
1226  * @brief  Retrieves all accounts with the user name.
1227  *
1228  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1229  * @privlevel   public
1230  * @privilege   %http://tizen.org/privilege/account.read
1231  * @param[in]   callback   The callback function to invoke
1232  * @param[in]   user_name  The user name to search
1233  * @param[in]   user_data  The user data to be passed to the callback function
1234  *
1235  * @return  @c 0 on success,
1236  *          otherwise a negative error value
1237  * @retval  #ACCOUNT_ERROR_NONE               Successful
1238  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1239  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1240  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1241  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1242  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1243  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1244  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1245  *
1246  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1247  *        But the account_connect() is not required to use this function since tizen 2.4.
1248  * @post  This function invokes account_cb().
1249  *
1250  * @see account_foreach_account_from_db()
1251  * @see account_query_account_by_account_id()
1252  * @see account_query_account_by_package_name()
1253  * @see account_query_account_by_capability()
1254  *
1255  */
1256 int account_query_account_by_user_name(account_cb callback, const char *user_name, void *user_data);
1257
1258 /**
1259  * @brief  Retrieves all accounts with the package name.
1260  *
1261  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1262  * @privlevel  public
1263  * @privilege  %http://tizen.org/privilege/account.read
1264  * @param[in]  callback      The callback function to invoke
1265  * @param[in]  package_name  The package name to search
1266  * @param[in]  user_data     The user data to be passed to the callback function
1267  *
1268  * @return  @c 0 on success,
1269  *          otherwise a negative error value
1270  * @retval  #ACCOUNT_ERROR_NONE               Successful
1271  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1272  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1273  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1274  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1275  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1276  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1277  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1278  *
1279  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1280  *        But the account_connect() is not required to use this function since tizen 2.4.
1281  * @post  This function invokes account_cb().
1282  *
1283  * @see account_foreach_account_from_db()
1284  * @see account_query_account_by_account_id()
1285  * @see account_query_account_by_user_name()
1286  * @see account_query_account_by_capability()
1287  */
1288 int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
1289
1290 /**
1291  * @brief  Retrieves all accounts with the capability type and capability value.
1292  *
1293  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1294  * @privlevel   public
1295  * @privilege   %http://tizen.org/privilege/account.read
1296  * @param[in]   callback          The callback function to invoke
1297  * @param[in]   capability_type   The capability type to search
1298  * @param[in]   capability_value  The capability value to search
1299  * @param[in]   user_data         The user data to be passed to the callback function
1300  *
1301  * @return  @c 0 on success,
1302  *          otherwise a negative error value
1303  * @retval  #ACCOUNT_ERROR_NONE               Successful
1304  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1305  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1306  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1307  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1308  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1309  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1310  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1311  *
1312  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1313  *        But the account_connect() is not required to use this function since tizen 2.4.
1314  * @post  This function invokes account_cb().
1315  *
1316  * @see account_foreach_account_from_db()
1317  * @see account_query_account_by_account_id()
1318  * @see account_query_account_by_user_name()
1319  * @see account_query_account_by_package_name()
1320  */
1321 int account_query_account_by_capability(account_cb callback, const char *capability_type, account_capability_state_e capability_value, void *user_data);
1322
1323 /**
1324  * @brief  Retrieves all accounts with the capability type.
1325  *
1326  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1327  * @privlevel   public
1328  * @privilege   %http://tizen.org/privilege/account.read
1329  * @param[in]   callback         The callback function to invoke
1330  * @param[in]   capability_type  The capability type to search
1331  * @param[in]   user_data        The user data to be passed to the callback function
1332  *
1333  * @return  @c 0 on success,
1334  *          otherwise a negative error value
1335  * @retval  #ACCOUNT_ERROR_NONE               Successful
1336  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1337  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1338  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1339  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1340  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1341  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1342  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1343  *
1344  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1345  *        But the account_connect() is not required to use this function since tizen 2.4.
1346  * @post  This function invokes account_cb().
1347  *
1348  * @see account_foreach_account_from_db()
1349  * @see account_query_account_by_account_id()
1350  * @see account_query_account_by_user_name()
1351  * @see account_query_account_by_package_name()
1352  */
1353 int account_query_account_by_capability_type(account_cb callback, const char *capability_type, void *user_data);
1354
1355 /**
1356  * @brief  Retrieves all capabilities with the account database ID.
1357  *
1358  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1359  * @privlevel   public
1360  * @privilege   %http://tizen.org/privilege/account.read
1361  * @param[in]   callback       The callback function to invoke
1362  * @param[in]   account_db_id  The account database ID to search
1363  * @param[in]   user_data      The user data to be passed to the callback function
1364  *
1365  * @return  @c 0 on success,
1366  *          otherwise a negative error value
1367  * @retval  #ACCOUNT_ERROR_NONE               Successful
1368  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1369  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1370  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1371  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1372  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1373  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1374  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1375  *
1376  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1377  *        But the account_connect() is not required to use this function since tizen 2.4.
1378  * @post  This function invokes capability_cb().
1379  *
1380  * @see account_get_capability()
1381  * @see account_set_capability()
1382  */
1383 int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
1384
1385
1386 /**
1387  * @brief  Gets the count of accounts in the account database.
1388  *
1389  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1390  * @privlevel   public
1391  * @privilege   %http://tizen.org/privilege/account.read
1392  * @param[out]  count  The out parameter for count of all accounts
1393  *
1394  * @return  @c 0 on success,
1395  *          otherwise a negative error value
1396  * @retval  #ACCOUNT_ERROR_NONE               Successful
1397  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1398  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1399  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1400  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1401  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1402  *
1403  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1404  *       But the account_connect() is not required to use this function since tizen 2.4.
1405  */
1406 int account_get_total_count_from_db(int *count);
1407
1408 /**
1409  * @brief  Updates the sync status of an account with the given account ID.
1410  *
1411  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1412  * @privlevel   public
1413  * @privilege   %http://tizen.org/privilege/account.read \n
1414  *              %http://tizen.org/privilege/account.write
1415  * @remarks     This API need both privileges \n
1416  *              Only can update an account which was added by same package applications
1417  * @param[in]   account_db_id  The account ID for which sync status needs to be changed
1418  * @param[in]   sync_status    The new sync status
1419  *
1420  * @return  @c 0 on success,
1421  *          otherwise a negative error value
1422  * @retval  #ACCOUNT_ERROR_NONE               Successful
1423  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1424  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1425  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1426  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1427  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1428  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1429  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1430  *
1431  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1432  *       But the account_connect() is not required to use this function since tizen 2.4.
1433  */
1434 int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
1435
1436
1437 /* Account type API */
1438
1439
1440 /**
1441  * @brief  Creates a handle to the account provider.
1442  *
1443  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1444  * @remarks     You must release @a account_type handle using account_type_destroy().\n
1445  *
1446  * @param[in]  account_type  The account provider handle
1447  *
1448  * @return  @c 0 on success,
1449  *          otherwise a negative error value
1450  * @retval  #ACCOUNT_ERROR_NONE               Successful
1451  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1452  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1453  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1454  *
1455  * @see account_type_destroy()
1456  */
1457 int account_type_create(account_type_h *account_type);
1458
1459 /**
1460  * @brief  Destroys the account provider handle and releases all its resources.
1461  *
1462  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1463  *
1464  * @remarks    When you get @a account_type using account_type_create(), you must release the handle using account_destroy() to avoid the memory leak.
1465  *
1466  * @param[in]  account_type  The account provider handle
1467  *
1468  * @return  @c 0 on success,
1469  *          otherwise a negative error value
1470  * @retval  #ACCOUNT_ERROR_NONE               Successful
1471  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1472  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1473  *
1474  * @see account_type_create()
1475  */
1476 int account_type_destroy(account_type_h account_type);
1477
1478 /**
1479  * @brief  Retrieves capability information with your application ID.
1480  *
1481  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1482  * @privlevel   public
1483  * @privilege   %http://tizen.org/privilege/account.read
1484  * @param[in]   callback   The callback function carries the capability name of an app ID
1485  * @param[in]   app_id     The application ID to search
1486  * @param[in]   user_data  The user data \n
1487  *                         If you have your private data to carry into callback function, then you can use it.
1488  *
1489  * @return  @c 0 on success,
1490  *          otherwise a negative error value
1491  * @retval  #ACCOUNT_ERROR_NONE               Successful
1492  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1493  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1494  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1495  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1496  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1497  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1498  *
1499  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1500  *       But the account_connect() is not required to use this function since tizen 2.4.
1501  */
1502 int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char *app_id, void *user_data);
1503
1504 /**
1505  * @brief   Checks whether the given application ID supports the capability.
1506  *
1507  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1508  * @privlevel   public
1509  * @privilege   %http://tizen.org/privilege/account.read
1510  * @remarks     The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1511  * @param[in]   app_id      The application ID
1512  * @param[in]   capability  The capability \n
1513  *                          For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
1514  *
1515  * @return  @c TRUE if the application supports the given capability, \n
1516  *          otherwise @c FALSE if the application does not support the given capability
1517  * @retval  @c TRUE means the application supports the given capability
1518  * @retval  @c FALSE means the application does not support the given capability
1519  * @exception #ACCOUNT_ERROR_NONE               Successful
1520  * @exception #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1521  * @exception #ACCOUNT_ERROR_RECORD_NOT_FOUND   Related record does not exist
1522  * @exception #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1523  * @exception #ACCOUNT_ERROR_PERMISSION_DENIED  DB access fail by permission
1524  * @exception #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1525  * @exception #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1526  * @exception #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1527  *
1528  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1529  *       But the account_connect() is not required to use this function since tizen 2.4.
1530  */
1531 bool account_type_query_supported_feature(const char *app_id, const char *capability);
1532
1533 /**
1534  * @brief  Gets the application ID of an account provider.
1535  *
1536  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1537  * @remarks     You must release @a app_id using free().
1538  *
1539  * @param[in]   account_type  The account provider handle \n
1540  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1541  * @param[out]  app_id        The application ID of an account provider item
1542  *
1543  * @return  @c 0 on success,
1544  *          otherwise a negative error value
1545  * @retval  #ACCOUNT_ERROR_NONE               Successful
1546  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1547  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1548  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1549  *
1550  * @see account_type_foreach_account_type_from_db()
1551  * @see account_type_query_by_app_id()
1552  */
1553 int account_type_get_app_id(account_type_h account_type, char **app_id);
1554
1555 /**
1556  * @brief  Gets the service provider ID of an account provider.
1557  *
1558  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1559  * @remarks     You must release @a service_provider_id using free().
1560  *
1561  * @param[in]   account_type         The account provider handle \n
1562  *                                   It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1563  * @param[out]  service_provider_id  The service provider text ID of an account provider item
1564  *
1565  * @return  @c 0 on success,
1566  *          otherwise a negative error value
1567  * @retval  #ACCOUNT_ERROR_NONE               Successful
1568  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1569  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1570  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1571  *
1572  * @see account_type_foreach_account_type_from_db()
1573  * @see account_type_query_by_app_id()
1574  */
1575 int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
1576
1577 /**
1578  * @brief  Gets the icon path of an account provider.
1579  *
1580  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1581  * @remarks     You must release @a icon_path using free().
1582  *
1583  * @param[in]   account_type  The account provider handle \n
1584  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1585  * @param[out]  icon_path     The icon path of the account provider item
1586  *
1587  * @return  @c 0 on success,
1588  *          otherwise a negative error value
1589  * @retval  #ACCOUNT_ERROR_NONE               Successful
1590  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1591  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1592  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1593  *
1594  * @see account_type_foreach_account_type_from_db()
1595  * @see account_type_query_by_app_id()
1596  */
1597 int account_type_get_icon_path(account_type_h account_type, char **icon_path);
1598
1599 /**
1600  * @brief  Gets the small icon path of an account provider.
1601  *
1602  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1603  * @remarks    You must release @a small_icon_path using free().
1604  *
1605  * @param[in]   account_type     The account provider handle\n
1606  *                               It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1607  * @param[out]  small_icon_path  The small icon path of the account provider item
1608  *
1609  * @return  @c 0 on success,
1610  *          otherwise a negative error value
1611  * @retval  #ACCOUNT_ERROR_NONE               Successful
1612  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1613  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1614  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1615  *
1616  * @see account_type_foreach_account_type_from_db()
1617  * @see account_type_query_by_app_id()
1618  */
1619 int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
1620
1621 /**
1622  * @brief  Checks whether the given account provider supports multiple accounts.
1623  *
1624  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1625  * @param[in]   account_type              The account provider handle \n
1626  *                                        It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1627  * @param[out]  multiple_account_support  The flag indicating support for multiple accounts accounts\n
1628  *                                        TRUE or FALSE.
1629  *
1630  * @return  @c 0 on success,
1631  *          otherwise a negative error value
1632  * @retval  #ACCOUNT_ERROR_NONE               Successful
1633  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1634  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1635  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1636  *
1637  * @see account_type_foreach_account_type_from_db()
1638  * @see account_type_query_by_app_id()
1639  */
1640 int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
1641
1642 /**
1643  * @brief  Gets capability information with the given account provider handle.
1644  *
1645  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1646  * @param[in]   account_type  The account provider handle\n
1647  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1648  * @param[in]   callback      The callback function that carries the capability name of the app ID
1649  * @param[in]   user_data     The user data \n
1650  *                            If you have your private data to carry into callback function, then you can use it.
1651  *
1652  * @return  @c 0 on success,
1653  *          otherwise a negative error value
1654  * @retval  #ACCOUNT_ERROR_NONE               Successful
1655  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1656  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1657  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1658  *
1659  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1660  *       But the account_connect() is not required to use this function since tizen 2.4.
1661  */
1662 int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void *user_data);
1663
1664 /**
1665  * @brief  Gets the specific label information detail of an account provider.
1666  *
1667  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1668  * @remarks    You must release @a label using free().
1669  *
1670  * @param[in]   account_type The account provider handle\n
1671  *                           It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1672  * @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
1673  *                           For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
1674  * @param[out]  label        The label text given for the locale
1675  *
1676  * @return  @c 0 on success,
1677  *          otherwise a negative error value
1678  * @retval  #ACCOUNT_ERROR_NONE               Successful
1679  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   No label for the given locale
1680  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1681  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1682  *
1683  * @see account_type_foreach_account_type_from_db()
1684  * @see account_type_query_by_app_id()
1685  */
1686
1687 int account_type_get_label_by_locale(account_type_h account_type, const char *locale, char **label);
1688
1689 /**
1690  * @brief  Gets the label information detail of an account provider.
1691  *
1692  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1693  * @param[in]   account_type  The account provider handle\n
1694  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1695  * @param[in]   callback      The callback function carrying the label information
1696  * @param[in]   user_data     The user data to be passed to the callback function
1697  *
1698  * @return  @c 0 on success,
1699  *          otherwise a negative error value
1700  * @retval  #ACCOUNT_ERROR_NONE               Successful
1701  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1702  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1703  *
1704  * @see account_type_foreach_account_type_from_db()
1705  * @see account_type_query_by_app_id()
1706  */
1707 int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data);
1708
1709 /**
1710  * @brief  Retrieves the label information with your application ID.
1711  *
1712  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1713  * @privlevel   public
1714  * @privilege   %http://tizen.org/privilege/account.read
1715  * @param[in]   callback    The callback function that carries label_h for label information \n
1716  *                         label_h contains label info as parameter.
1717  * @param[in]   app_id     The application ID to search
1718  * @param[in]   user_data  The user data \n
1719  *                         If you have your private data to carry into callback function, then you can use it.
1720  *
1721  * @return  @c 0 on success,
1722  *          otherwise a negative error value
1723  * @retval  #ACCOUNT_ERROR_NONE               Successful
1724  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1725  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1726  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1727  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1728  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1729  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1730  *
1731  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1732  *       But the account_connect() is not required to use this function since tizen 2.4.
1733  *
1734  * @see account_type_query_by_app_id()
1735  * @see account_type_foreach_account_type_from_db()
1736  */
1737 int account_type_query_label_by_app_id(account_label_cb callback, const char *app_id, void *user_data);
1738
1739 /**
1740  * @brief  Retrieves the account provider information with your application ID.
1741  *
1742  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1743  * @privlevel     public
1744  * @privilege     %http://tizen.org/privilege/account.read
1745  * @param[in]     app_id        The application ID to search
1746  * @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.
1747  *
1748  * @return  @c 0 on success,
1749  *          otherwise a negative error value
1750  * @retval  #ACCOUNT_ERROR_NONE               Successful
1751  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1752  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1753  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Queried data does not exist
1754  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1755  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1756  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1757  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1758  *
1759  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1760  *       But the account_connect() is not required to use this function since tizen 2.4.
1761  *
1762  * @see account_type_create()
1763  * @see account_type_get_app_id()
1764  * @see account_type_get_service_provider_id()
1765  * @see account_type_get_icon_path()
1766  * @see account_type_get_small_icon_path()
1767  * @see account_type_get_multiple_account_support()
1768  * @see account_type_get_label()
1769  * @see account_type_destroy()
1770  */
1771 int account_type_query_by_app_id(const char *app_id, account_type_h *account_type);
1772
1773 /**
1774  * @brief  Retrieves all account provider information.
1775  *
1776  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1777  * @privlevel   public
1778  * @privilege   %http://tizen.org/privilege/account.read
1779  * @param[in]   callback   The account provider information \n
1780  *                         You can get the account information through account_type_get_* with the carried account_type_handle.
1781  * @param[in]   user_data  The user data \n
1782  *                         It will be carried through your callback function.
1783  *
1784  * @return  @c 0 on success,
1785  *          otherwise a negative error value
1786  * @retval  #ACCOUNT_ERROR_NONE               Successful
1787  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1788  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1789  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1790  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1791  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1792  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1793  *
1794  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1795  *       But the account_connect() is not required to use this function since tizen 2.4.
1796  *
1797  * @see account_type_create()
1798  * @see account_type_get_app_id()
1799  * @see account_type_get_service_provider_id()
1800  * @see account_type_get_icon_path()
1801  * @see account_type_get_small_icon_path()
1802  * @see account_type_get_multiple_account_support()
1803  * @see account_type_get_label()
1804  * @see account_type_destroy()
1805  */
1806 int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
1807
1808 /**
1809  * @brief  Retrieves the label information with the given application ID and locale.
1810  *
1811  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1812  * @privlevel   public
1813  * @privilege   %http://tizen.org/privilege/account.read
1814  * @param[in]   app_id  The application ID
1815  * @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
1816  *                      For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
1817  * @param[out]  label   The label text corresponding app_id and locale \n
1818  *                      It must be free text.
1819  *
1820  * @return  @c 0 on success,
1821  *          otherwise a negative error value
1822  * @retval  #ACCOUNT_ERROR_NONE               Successful
1823  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1824  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1825  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1826  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1827  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1828  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1829  *
1830  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1831  *       But the account_connect() is not required to use this function since tizen 2.4.
1832  */
1833 int account_type_query_label_by_locale(const char *app_id, const char *locale, char **label);
1834
1835 /**
1836  * @brief  Retrieves account provider information with the capability name.
1837  *
1838  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1839  * @privlevel   public
1840  * @privilege   %http://tizen.org/privilege/account.read
1841  * @param[in]   callback        The callback function to retrieve account provider information
1842  * @param[in]   key             The capability value to search account provider \n
1843  *                              For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
1844  * @param[in]  user_data        If you have your private data to carry into callback function, then you can use it
1845  *
1846  * @return  @c 0 on success,
1847  *          otherwise a negative error value
1848  * @retval  #ACCOUNT_ERROR_NONE               Successful
1849  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Record not found
1850  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1851  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1852  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1853  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1854  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1855  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1856  *
1857  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1858  *       But the account_connect() is not required to use this function since tizen 2.4.
1859  */
1860 int account_type_query_by_provider_feature(account_type_cb callback, const char *key, void *user_data);
1861
1862 /**
1863  * @brief  Checks whether the given app_id exists in the account provider DB.
1864  *
1865  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1866  * @privlevel   public
1867  * @privilege   %http://tizen.org/privilege/account.read
1868  * @param[in]   app_id  The application ID to check
1869  *
1870  * @return  @c 0 on success,
1871  *          otherwise a negative error value
1872  * @retval  #ACCOUNT_ERROR_NONE               Successful
1873  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Record not found
1874  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid app ID
1875  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1876  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1877  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1878  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1879  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1880  *
1881  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1882  *       But the account_connect() is not required to use this function since tizen 2.4.
1883  *
1884  * @see account_type_query_by_app_id()
1885  */
1886 int account_type_query_app_id_exist(const char *app_id);
1887
1888
1889
1890 /* End of account provider API  */
1891
1892 /**
1893  * @brief  Creates a handle for the account event subscription.
1894  *
1895  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1896  * @remarks     You must release @a account_subscribe handle using account_unsubscribe_notification().
1897  *
1898  * @param[in]   account_subscribe  The account subscription handle
1899  *
1900  * @return  @c 0 on success,
1901  *          otherwise a negative error value
1902  * @retval  #ACCOUNT_ERROR_NONE               Successful
1903  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1904  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1905  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED      Not supported
1906  *
1907  * @see account_unsubscribe_notification()
1908  * @see account_subscribe_notification()
1909  */
1910 int account_subscribe_create(account_subscribe_h *account_subscribe);
1911
1912 /**
1913  * @brief  Starts to subscribe account event through the given callback function.
1914  *
1915  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1916  * @privlevel   public
1917  * @privilege   %http://tizen.org/privilege/account.read \n
1918  * @param[in]   account_subscribe  The account subscription handle
1919  * @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
1920  *                                 It will be called with event message and account ID.
1921  * @param[in]   user_data          The user_data that is delivered to callback
1922  *
1923  * @return  @c 0 on success,
1924  *          otherwise a negative error value
1925  * @retval  #ACCOUNT_ERROR_NONE                     Successful
1926  * @retval  #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL  Subscription fail
1927  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER        Invalid parameter
1928  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED            Not supported
1929  *
1930  * @see account_unsubscribe_notification()
1931  * @see account_subscribe_notification()
1932  */
1933 int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void *user_data);
1934
1935 /**
1936  * @brief  Destroys the account subscribe handle and releases all its resources.
1937  *
1938  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1939  * @privlevel   public
1940  * @privilege   %http://tizen.org/privilege/account.read \n
1941  * @remarks     You must call account_unsubscribe_notification() when you do not need to subscribe account event.
1942  *
1943  * @param[in]   account_subscribe  The account subscription handle
1944  *
1945  * @return  @c 0 on success,
1946  *          otherwise a negative error value
1947  * @retval  #ACCOUNT_ERROR_NONE                     Successful
1948  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER        Invalid parameter
1949  * @retval  #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL  Unsubscription failed
1950  * @retval  #ACCOUNT_ERROR_NOT_SUPPORTED            Not supported
1951  *
1952  * @see account_create()
1953  */
1954 int account_unsubscribe_notification(account_subscribe_h account_subscribe);
1955
1956
1957 /* End of Account APIs */
1958 /**
1959  * @}
1960  */
1961
1962
1963 #ifdef __cplusplus
1964 }
1965 #endif
1966
1967
1968 #endif /* __ACCOUNT_H__ */