1b782e1c59aaaa265f859c298fc2d013c2584660
[platform/core/api/libaccount-service.git] / include / account.h
1 /*
2  *
3  * Copyright (c) 2012 - 2013 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.wirte
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 exprired
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  *
237  * @see account_destroy()
238  */
239 int account_create(account_h *account);
240
241
242 /**
243  * @brief  Destroys the account handle and releases all its resources.
244  *
245  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
246  * @param[in]  account  The account handle
247  *
248  * @return     @c 0 on success,
249  *             otherwise a negative error value
250  * @retval     #ACCOUNT_ERROR_NONE               Successful
251  * @retval     #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
252  *
253  * @see account_create()
254  */
255 int account_destroy(account_h account);
256
257
258 /**
259  * @brief  Inserts the account details to the account database.
260  *
261  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
262  * @privlevel   public
263  * @privilege   %http://tizen.org/privilege/account.read \n
264  *              %http://tizen.org/privilege/account.write
265  * @remarks     This API need both privileges
266  * @param[in]   account        The account handle
267  * @param[out]  account_db_id  The account ID to be assigned to an account
268  *
269  * @return  @c 0 on success,
270  *          otherwise a negative error value
271  * @retval  #ACCOUNT_ERROR_NONE Successful
272  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER        Invalid parameter
273  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY            Out of Memory
274  * @retval  #ACCOUNT_ERROR_DB_FAILED                Database operation failed
275  * @retval  #ACCOUNT_ERROR_DUPLICATED               Same user name exists in your application
276  * @retval  #ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE       Tried to add an account in spite of multiple false accounts
277  * @retval  #ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER  Tried to add an account though you did not register the account type in manifest
278  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED        DB Access fail by permission
279  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY            SQLite handler is busy
280  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED            Account database did not opened
281  *
282  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
283  *       But the account_connect() is not required to use this function since tizen 2.4.
284  *
285  * @see account_delete_from_db_by_id()
286  * @see account_delete_from_db_by_user_name()
287  * @see account_delete_from_db_by_package_name()
288  * @see account_update_to_db_by_id()
289  * @see account_update_to_db_by_user_name()
290  */
291 int account_insert_to_db(account_h account, int *account_db_id);
292
293
294 /**
295  * @brief  Deletes an account from the account database by account DB ID.
296  *
297  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
298  * @privlevel  public
299  * @privilege  %http://tizen.org/privilege/account.read \n
300  *             %http://tizen.org/privilege/account.write
301  * @remarks    This API need both privileges \n
302  *             Only can delete an account which was added by same package applications
303  * @param[in]  account_db_id  The account ID to delete
304  *
305  * @return  @c 0 on success,
306  *          otherwise a negative error value
307  * @retval  #ACCOUNT_ERROR_NONE               Successful
308  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
309  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
310  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
311  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  The account owner is different from the caller or DB Access fail by permission
312  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
313  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
314  *
315  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
316  *       But the account_connect() is not required to use this function since tizen 2.4.
317  *
318  * @see account_insert_to_db()
319  * @see account_delete_from_db_by_user_name()
320  * @see account_delete_from_db_by_package_name()
321  * @see account_update_to_db_by_id()
322  * @see account_update_to_db_by_user_name()
323  */
324 int account_delete_from_db_by_id(int account_db_id);
325
326
327 /**
328  * @brief  Deletes an account from the account database by user name.
329  *
330  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
331  * @privlevel  public
332  * @privilege  %http://tizen.org/privilege/account.read \n
333  *             %http://tizen.org/privilege/account.write
334  * @remarks    This API need both privileges \n
335  *             Only can delete accounts which were added by same package applications
336  * @param[in]  user_name     The user name of the account to delete
337  * @param[in]  package_name  The package name of the account to delete
338  *
339  * @return  @c 0 on success,
340  *          otherwise a negative error value
341  * @retval  #ACCOUNT_ERROR_NONE               Successful
342  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
343  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
344  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
345  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
346  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
347  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
348  *
349  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
350  *       But the account_connect() is not required to use this function since tizen 2.4.
351  *
352  * @see account_insert_to_db()
353  * @see account_delete_from_db_by_id()
354  * @see account_delete_from_db_by_package_name()
355  * @see account_update_to_db_by_id()
356  * @see account_update_to_db_by_user_name()
357  */
358 int account_delete_from_db_by_user_name(char *user_name, char *package_name);
359
360
361 /**
362  * @brief  Deletes an account from the account database by package name.
363  *
364  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
365  * @privlevel  public
366  * @privilege  %http://tizen.org/privilege/account.read \n
367  *             %http://tizen.org/privilege/account.write
368  * @remarks    This API need both privileges \n
369  *             Only can delete accounts which was added by same package applications
370  * @param[in]  package_name  The package name of account(s) to delete
371  *
372  * @return  @c 0 on success,
373  *          otherwise a negative error value
374  * @retval  #ACCOUNT_ERROR_NONE               Successful
375  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
376  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
377  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
378  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
379  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
380  *
381  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
382  *       But the account_connect() is not required to use this function since tizen 2.4.
383  *
384  * @see account_insert_to_db()
385  * @see account_delete_from_db_by_id()
386  * @see account_delete_from_db_by_user_name()
387  * @see account_update_to_db_by_id()
388  * @see account_update_to_db_by_user_name()
389  */
390 int account_delete_from_db_by_package_name(const char *package_name);
391
392 /**
393  * @brief  Updates the account details to the account database.
394  *
395  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
396  * @privlevel  public
397  * @privilege  %http://tizen.org/privilege/account.read \n
398  *             %http://tizen.org/privilege/account.write
399  * @remarks    This API need both privileges \n
400  *             Only can update an account which was added by same package applications
401  * @param[in]  account     The account handle
402  * @param[in]  account_id  The account ID to update
403  *
404  * @return  @c 0 on success,
405  *          otherwise a negative error value
406  * @retval  #ACCOUNT_ERROR_NONE               Successful
407  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
408  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
409  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   The account to update does not exist
410  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
411  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
412  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
413  *
414  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
415  *       But the account_connect() is not required to use this function since tizen 2.4.
416  *
417  * @see account_insert_to_db()
418  * @see account_delete_from_db_by_id()
419  * @see account_delete_from_db_by_user_name()
420  * @see account_delete_from_db_by_package_name()
421  * @see account_update_to_db_by_user_name()
422  */
423 int account_update_to_db_by_id(account_h account, int account_id);
424
425 /**
426  * @brief      Updates the account details to the account database.
427  *             The provider permission check has been added since tizen 2.4.
428  *
429  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
430  * @privlevel  public
431  * @privilege  %http://tizen.org/privilege/account.read \n
432  *             %http://tizen.org/privilege/account.write
433  * @remarks    This API need both privileges \n
434  *             Only can update an account which was added by same package applications
435  * @param[in]  account     The account handle
436  * @param[in]  account_id  The account ID to update
437  *
438  * @return  @c 0 on success,
439  *          otherwise a negative error value
440  * @retval  #ACCOUNT_ERROR_NONE               Successful
441  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
442  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
443  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
444  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   The account to update does not exist
445  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
446  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
447  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
448  *
449  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
450  *       But the account_connect() is not required to use this function since tizen 2.4.
451  *
452  * @see account_insert_to_db()
453  * @see account_delete_from_db_by_id()
454  * @see account_delete_from_db_by_user_name()
455  * @see account_delete_from_db_by_package_name()
456  * @see account_update_to_db_by_user_name()
457  */
458 int account_update_to_db_by_id_ex(account_h account, int account_id);
459
460 /**
461  * @brief  Updates the account details to the account database.
462  *
463  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
464  * @privlevel  public
465  * @privilege  %http://tizen.org/privilege/account.read \n
466  *             %http://tizen.org/privilege/account.write
467  * @remarks    This API need both privileges \n
468  *             Only can update accounts which were added by same package applications
469  * @param[in]  account       The account handle
470  * @param[in]  user_name     The user name of the account to update
471  * @param[in]  package_name  The package name for the user name
472  *
473  * @return  @c 0 on success,
474  *          otherwise a negative error value
475  * @retval  #ACCOUNT_ERROR_NONE               Successful
476  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
477  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
478  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   The account to update does not exist
479  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
480  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
481  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
482  *
483  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
484  *       But the account_connect() is not required to use this function since tizen 2.4.
485  *
486  * @see account_insert_to_db()
487  * @see account_delete_from_db_by_id()
488  * @see account_delete_from_db_by_user_name()
489  * @see account_delete_from_db_by_package_name()
490  * @see account_update_to_db_by_id()
491  *
492  */
493 int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
494
495 /**
496  * @brief  Gets the ID of an account.
497  *
498  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
499  * @param[in]   account     The account handle
500  * @param[out]  account_id  The account ID
501  *
502  * @return  @c 0 on success,
503  *          otherwise a negative error value
504  * @retval  #ACCOUNT_ERROR_NONE               Successful
505  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
506  *
507  */
508 int account_get_account_id(account_h account, int *account_id);
509
510 /**
511  * @brief  Gets the user name of an account.
512  *
513  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
514  * @remarks    You must release @a user_name using free().
515  *
516  * @param[in]   account    The account handle
517  * @param[out]  user_name  The user name of the account
518  *
519  * @return  @c 0 on success,
520  *          otherwise a negative error value
521  * @retval  #ACCOUNT_ERROR_NONE               Successful
522  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
523  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
524  *
525  * @see account_set_user_name()
526  */
527 int account_get_user_name(account_h account, char **user_name);
528
529
530 /**
531  * @brief  Sets the user name of an account.
532  *
533  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
534  * @param[in]  account    The account handle
535  * @param[in]  user_name  The string to set as user name
536  *
537  * @return  @c 0 on success,
538  *          otherwise a negative error value
539  * @retval  #ACCOUNT_ERROR_NONE               Successful
540  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
541  *
542  * @see account_get_user_name()
543  */
544 int account_set_user_name(account_h account, const char *user_name);
545
546
547 /**
548  * @brief  Gets the display name of an account.
549  *
550  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
551  * @remarks    You must release @a display_name using free().
552  *
553  * @param[in]   account       The account handle
554  * @param[out]  display_name  The display name of the account
555  *
556  * @return  @c 0 on success,
557  *          otherwise a negative error value
558  * @retval  #ACCOUNT_ERROR_NONE               Successful
559  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
560  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
561  *
562  * @see account_get_display_name()
563  */
564 int account_get_display_name(account_h account, char **display_name);
565
566
567 /**
568  * @brief  Sets the display name of an account.
569  *
570  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
571  * @param[in]  account      The account handle
572  * @param[in]  display_name The text string to set as the display name
573  *
574  * @return  @c 0 on success,
575  *          otherwise a negative error value
576  * @retval  #ACCOUNT_ERROR_NONE               Successful
577  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
578  *
579  * @see account_get_display_name()
580  */
581 int account_set_display_name(account_h account, const char *display_name);
582
583 /**
584  * @brief  Gets the capability detail of an account.
585  *
586  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
587  * @param[in]   account           The account handle
588  * @param[in]   capability_type   The capability type to get the capability value
589  * @param[out]  capability_value  The capability value (on/off) of the specified capability_type
590  *
591  * @return  @c 0 on success,
592  *          otherwise a negative error value
593  * @retval  #ACCOUNT_ERROR_NONE               Successful
594  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
595  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   There is no given capability_type in the account
596  *
597  * @see account_set_capability()
598  */
599 int account_get_capability(account_h account, const char *capability_type, account_capability_state_e *capability_value);
600
601 /**
602  * @brief  Gets all the capabilities of an account.
603  *
604  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
605  * @param[in]  account    The account handle
606  * @param[in]  callback   The callback function
607  * @param[in]  user_data  The user data to be passed to the callback function
608  *
609  * @return  @c 0 on success,
610  *          otherwise a negative error value
611  * @retval  #ACCOUNT_ERROR_NONE               Successful
612  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
613  *
614  * @see account_set_capability()
615  */
616 int account_get_capability_all(account_h account, capability_cb callback, void *user_data);
617
618 /**
619  * @brief  Sets the capability.
620  *
621  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
622  * @param[in]  account           The account handle
623  * @param[in]  capability_type   The capability type
624  * @param[in]  capability_state  The capability state
625  *
626  * @return  @c 0 on success,
627  *          otherwise a negative error value
628  * @retval  #ACCOUNT_ERROR_NONE               Successful
629  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
630  *
631  * @see account_get_capability()
632  */
633 int account_set_capability(account_h account, const char *capability_type, account_capability_state_e capability_state);
634
635
636 /**
637  * @brief  Gets the icon path.
638  *
639  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
640  * @remarks    You must release @a icon_path using free().
641  *
642  * @param[in]   account    The account handle
643  * @param[out]  icon_path  The icon path
644  *
645  * @return  @c 0 on success,
646  *          otherwise a negative error value
647  * @retval  #ACCOUNT_ERROR_NONE               Successful
648  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
649  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
650  *
651  * @see account_set_icon_path()
652  */
653 int account_get_icon_path(account_h account, char **icon_path);
654
655
656 /**
657  * @brief  Sets the icon path.
658  *
659  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
660  * @param[in]  account    The account handle
661  * @param[in]  icon_path  The text string to set as the icon path
662  *
663  * @return  @c 0 on success,
664  *          otherwise a negative error value
665  * @retval  #ACCOUNT_ERROR_NONE               Successful
666  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
667  *
668  * @see account_get_icon_path()
669  */
670 int account_set_icon_path(account_h account, const char *icon_path);
671
672
673 /**
674  * @brief  Gets the domain name.
675  *
676  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
677  * @remarks    You must release @a domain_name using free().
678  *
679  * @param[in]   account      The account handle
680  * @param[out]  domain_name  The domain name
681  *
682  * @return  @c 0 on success,
683  *          otherwise a negative error value
684  * @retval  #ACCOUNT_ERROR_NONE               Successful
685  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
686  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
687  *
688  * @see account_set_domain_name()
689  */
690 int account_get_domain_name(account_h account, char **domain_name);
691
692
693 /**
694  * @brief  Sets the domain name.
695  *
696  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
697  * @param[in]  account      The account handle
698  * @param[in]  domain_name  The text string to set as 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  *
705  * @see account_get_domain_name()
706  */
707 int account_set_domain_name(account_h account, const char *domain_name);
708
709
710 /**
711  * @brief  Gets the email address.
712  *
713  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
714  * @remarks    You must release @a email_address using free().
715  *
716  * @param[in]   account        The account handle
717  * @param[out]  email_address  The email address
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_OUT_OF_MEMORY      Out of memory
724  *
725  * @see account_set_email_address()
726  */
727 int account_get_email_address(account_h account, char **email_address);
728
729
730 /**
731  * @brief  Sets the email address.
732  *
733  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
734  * @param[in]  account        The account handle
735  * @param[in]  email_address  The text string to set as the email address
736  *
737  * @return  @c 0 on success,
738  *          otherwise a negative error value
739  * @retval  #ACCOUNT_ERROR_NONE               Successful
740  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
741  *
742  * @see account_get_email_address()
743  */
744 int account_set_email_address(account_h account, const char *email_address);
745
746
747 /**
748  * @brief  Gets the package name.
749  *
750  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
751  * @remarks    You must release @a package_name using free().
752  *
753  * @param[in]   account       The account handle
754  * @param[out]  package_name  The package name
755  *
756  * @return  @c 0 on success,
757  *          otherwise a negative error value
758  * @retval  #ACCOUNT_ERROR_NONE               Successful
759  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
760  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
761  *
762  * @see account_set_package_name()
763  */
764 int account_get_package_name(account_h account, char **package_name);
765
766
767 /**
768  * @brief  Sets the package name.
769  *
770  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
771  * @param[in]  account       The account handle
772  * @param[in]  package_name  The text string to set as the package name
773  *
774  * @return  @c 0 on success,
775  *          otherwise a negative error value
776  * @retval  #ACCOUNT_ERROR_NONE               Successful
777  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
778  *
779  * @see account_get_email_address()
780  */
781 int account_set_package_name(account_h account, const char *package_name);
782
783
784 /**
785  * @brief  Gets the access token. Access token field is used to store account secrets (such as password or master token).
786  *
787  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
788  * @remarks    You must release @a access_token using free().
789  *
790  * @param[in]   account       The account handle
791  * @param[out]  access_token  The access token
792  *
793  * @return  @c 0 on success,
794  *          otherwise a negative error value
795  * @retval  #ACCOUNT_ERROR_NONE               Successful
796  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
797  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
798  *
799  * @remarks Access token field is used for storing account secret (password / master token etc)
800  * Only account owner application can retrieve account password / access_token. For others this field will be null.
801  * @see account_set_access_token()
802  */
803 int account_get_access_token(account_h account, char **access_token);
804
805
806 /**
807  * @brief  Sets the access token. Access token field is used to store account secrets (such as password or master token).
808  *
809  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
810  * @param[in]  account       The account handle
811  * @param[in]  access_token  The text string to set as the access token
812  *
813  * @return  @c 0 on success,
814  *          otherwise a negative error value
815  * @retval  #ACCOUNT_ERROR_NONE               Successful
816  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
817  * @remarks Only account owner application can retrieve account password / access_token. For others this field will be null.
818  * @see account_get_access_token()
819  */
820 int account_set_access_token(account_h account, const char *access_token);
821
822
823 /**
824  * @brief  Gets the user text.
825  *
826  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
827  * @remarks    You must release @a user_text using free().
828  *
829  * @param[in]   account          The account handle
830  * @param[in]   user_text_index  The index of the user text (range: 0 ~ 4)
831  * @param[out]  user_text        The user text
832  *
833  * @return  @c 0 on success,
834  *          otherwise a negative error value
835  * @retval  #ACCOUNT_ERROR_NONE               Successful
836  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
837  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
838  *
839  * @see account_set_user_text()
840  */
841 int account_get_user_text(account_h account, int user_text_index, char **user_text);
842
843
844 /**
845  * @brief  Sets the user text.
846  *
847  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
848  * @param[in]  account          The account handle
849  * @param[in]  user_text_index  The index of the user text (must be in range from @c 0 to @c 4)
850  * @param[in]  user_text        The text string to set as the user text
851  *
852  * @return  @c 0 on success,
853  *          otherwise a negative error value
854  * @retval  #ACCOUNT_ERROR_NONE               Successful
855  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
856  *
857  * @see account_get_user_text()
858  */
859 int account_set_user_text(account_h account, int user_text_index, const char *user_text);
860
861
862 /**
863  * @brief  Gets the user integer.
864  *
865  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
866  * @param[in]   account         The account handle
867  * @param[in]   user_int_index  The index of the user integer (must be in range from @c 0 to @c 4)
868  * @param[out]  user_integer    The user integer
869  *
870  * @return  @c 0 on success,
871  *          otherwise a negative error value
872  * @retval  #ACCOUNT_ERROR_NONE               Successful
873  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
874  *
875  * @see account_set_user_int()
876  */
877 int account_get_user_int(account_h account, int user_int_index, int *user_integer);
878
879
880 /**
881  * @brief  Sets the user integer.
882  *
883  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
884  * @param[in]  account         The account handle
885  * @param[in]  user_int_index  The index of the user integer (must be in range from @c 0 to @c 4)
886  * @param[in]  user_integer    The integer to set as the user integer
887  *
888  * @return  @c 0 on success,
889  *          otherwise a negative error value
890  * @retval  #ACCOUNT_ERROR_NONE               Successful
891  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
892  *
893  * @see account_get_user_int()
894  */
895 int account_set_user_int(account_h account, int user_int_index, int user_integer);
896
897
898 /**
899  * @brief  Gets the auth type.
900  *
901  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
902  * @param[in]   account    The account handle
903  * @param[out]  auth_type  The auth type
904  *
905  * @return  @c 0 on success,
906  *          otherwise a negative error value
907  * @retval  #ACCOUNT_ERROR_NONE               Successful
908  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
909  *
910  * @see account_set_auth_type()
911  */
912 int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
913
914
915 /**
916  * @brief  Sets the auth type.
917  *
918  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
919   * @param[in]  account    The account handle
920  * @param[in]  auth_type  The integer to be set as the auth type
921  *
922  * @return  @c 0 on success,
923  *          otherwise a negative error value
924  * @retval  #ACCOUNT_ERROR_NONE               Successful
925  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
926  *
927  * @see account_get_auth_type()
928  */
929 int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
930
931
932 /**
933  * @brief  Gets the secret.
934  *
935  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
936  * @param[in]   account  The account handle
937  * @param[out]  secret   The secret
938  *
939  * @return  @c 0 on success,
940  *          otherwise a negative error value
941  * @retval  #ACCOUNT_ERROR_NONE               Successful
942  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
943  *
944  * @see account_set_secret()
945  */
946 int account_get_secret(account_h account, account_secrecy_state_e *secret);
947
948
949 /**
950  * @brief  Sets the secret.
951  *
952  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
953  * @param[in]  account  The account handle
954  * @param[in]  secret   The secrecy to be set
955  *
956  * @return  @c 0 on success,
957  *          otherwise a negative error value
958  * @retval  #ACCOUNT_ERROR_NONE               Successful
959  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
960  *
961  * @see account_get_secret()
962  */
963 int account_set_secret(account_h account, const account_secrecy_state_e secret);
964
965 /**
966  * @brief  Gets the sync support.
967  *
968  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
969  * @param[in]   account       The account handle
970  * @param[out]  sync_support  The sync support
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  *
977  * @see account_set_sync_support()
978  */
979 int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
980
981
982 /**
983  * @brief  Sets the sync support.
984  *
985  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
986  * @param[in]  account       The account handle
987  * @param[in]  sync_support  The sync state to be set
988  *
989  * @return  @c 0 on success,
990  *          otherwise a negative error value
991  * @retval  #ACCOUNT_ERROR_NONE               Successful
992  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
993  *
994  * @see account_get_sync_support()
995  */
996 int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
997
998
999 /**
1000  * @brief  Gets the source.
1001  *
1002  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1003  * @remarks    You must release @a user_text using free().
1004  *
1005  * @param[in]   account  The account handle
1006  * @param[out]  source   The source
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_OUT_OF_MEMORY      Out of memory
1013  *
1014  * @see account_set_source()
1015  */
1016 int account_get_source(account_h account, char **source);
1017
1018
1019 /**
1020  * @brief  Sets the source.
1021  *
1022  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1023  * @param[in]  account  The account handle
1024  * @param[in]  source   The text string to set as the source
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  *
1031  * @see account_get_source()
1032  */
1033 int account_set_source(account_h account, const char *source);
1034
1035 /**
1036  * @brief  Sets the custom.
1037  *
1038  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1039  * @param[in]  account  The account handle
1040  * @param[in]  key      The user custom key for the specific value
1041  * @param[in]  value    The user custom value about the given key
1042  *
1043  * @return  @c 0 on success,
1044  *          otherwise a negative error value
1045  * @retval  #ACCOUNT_ERROR_NONE               Successful
1046  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1047  *
1048  * @see account_get_custom()
1049  */
1050 int account_set_custom(account_h account, const char *key, const char *value);
1051
1052 /**
1053  * @brief  Gets the user specific custom text of an account key.
1054  *
1055  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1056  * @param[in]   account   The account handle
1057  * @param[in]   key       The key to retrieve custom text
1058  * @param[out]  value     The text of the given key
1059  *
1060  * @return  @c 0 on success,
1061  *          otherwise a negative error value
1062  * @retval  #ACCOUNT_ERROR_NONE               Successful
1063  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1064  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   There is no given capability type in the account
1065  *
1066  * @see account_set_custom()
1067  */
1068 int account_get_custom(account_h account, const char *key, char **value);
1069
1070
1071 /**
1072  * @brief  Gets all the user custom texts of an account.
1073  *
1074  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1075  * @param[in]  account    The account handle
1076  * @param[in]  callback   The callback function to retrieve all custom text \n
1077  *                        The callback function gives the key and value.
1078  * @param[in]  user_data  The user data to be passed to the callback function
1079  *
1080  * @return  @c 0 on success,
1081  *          otherwise a negative error value
1082  * @retval  #ACCOUNT_ERROR_NONE               Successful
1083  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1084  *
1085  * @see account_set_custom()
1086  */
1087 int account_get_custom_all(account_h account, account_custom_cb callback, void *user_data);
1088
1089 /**
1090  * @brief  Retrieves all accounts details by invoking the given callback function iteratively.
1091  *
1092  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1093  * @privlevel   public
1094  * @privilege   %http://tizen.org/privilege/account.read
1095  * @param[in]   callback   The callback function to invoke
1096  * @param[in]   user_data  The user data to be passed to the callback function
1097  *
1098  * @return  @c 0 on success,
1099  *          otherwise a negative error value
1100  * @retval  #ACCOUNT_ERROR_NONE               Successful
1101  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1102  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1103  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1104  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Related record does not exist
1105  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1106  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1107  *
1108  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1109  *        But the account_connect() is not required to use this function since tizen 2.4.
1110  * @post  This function invokes account_cb().
1111  *
1112  * @see account_query_account_by_account_id()
1113  * @see account_query_account_by_user_name()
1114  * @see account_query_account_by_package_name()
1115  * @see account_query_account_by_capability()
1116  */
1117 int account_foreach_account_from_db(account_cb callback, void *user_data);
1118
1119
1120 /**
1121  * @brief  Retrieve an account with the account ID.
1122  *
1123  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1124  * @privlevel   public
1125  * @privilege   %http://tizen.org/privilege/account.read
1126  * @param[in]   account_db_id  The account database ID to search
1127  * @param[out]  account        The account handle \n
1128  *                             Must be allocated by account_create() and freed after using by account_destroy().
1129  *
1130  * @return  @c 0 on success,
1131  *          otherwise a negative error value
1132  * @retval  #ACCOUNT_ERROR_NONE               Successful
1133  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1134  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1135  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1136  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1137  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1138  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1139  *
1140  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1141  *       But the account_connect() is not required to use this function since tizen 2.4.
1142  *
1143  * @see account_query_account_by_user_name()
1144  * @see account_query_account_by_package_name()
1145  * @see account_query_account_by_capability()
1146  */
1147 int account_query_account_by_account_id(int account_db_id, account_h *account);
1148
1149 /**
1150  * @brief  Retrieves all accounts with the user name.
1151  *
1152  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1153  * @privlevel   public
1154  * @privilege   %http://tizen.org/privilege/account.read
1155  * @param[in]   callback   The callback function to invoke
1156  * @param[in]   user_name  The user name to search
1157  * @param[in]   user_data  The user data to be passed to the callback function
1158  *
1159  * @return  @c 0 on success,
1160  *          otherwise a negative error value
1161  * @retval  #ACCOUNT_ERROR_NONE               Successful
1162  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1163  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1164  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1165  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1166  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1167  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1168  *
1169  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1170  *        But the account_connect() is not required to use this function since tizen 2.4.
1171  * @post  This function invokes account_cb().
1172  *
1173  * @see account_foreach_account_from_db()
1174  * @see account_query_account_by_account_id()
1175  * @see account_query_account_by_package_name()
1176  * @see account_query_account_by_capability()
1177  *
1178  */
1179 int account_query_account_by_user_name(account_cb callback, const char *user_name, void *user_data);
1180
1181 /**
1182  * @brief  Retrieves all accounts with the package name.
1183  *
1184  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1185  * @privlevel  public
1186  * @privilege  %http://tizen.org/privilege/account.read
1187  * @param[in]  callback      The callback function to invoke
1188  * @param[in]  package_name  The package name to search
1189  * @param[in]  user_data     The user data to be passed to the callback function
1190  *
1191  * @return  @c 0 on success,
1192  *          otherwise a negative error value
1193  * @retval  #ACCOUNT_ERROR_NONE               Successful
1194  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1195  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1196  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1197  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1198  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1199  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1200  *
1201  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1202  *        But the account_connect() is not required to use this function since tizen 2.4.
1203  * @post  This function invokes account_cb().
1204  *
1205  * @see account_foreach_account_from_db()
1206  * @see account_query_account_by_account_id()
1207  * @see account_query_account_by_user_name()
1208  * @see account_query_account_by_capability()
1209  */
1210 int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
1211
1212 /**
1213  * @brief  Retrieves all accounts with the capability type and capability value.
1214  *
1215  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1216  * @privlevel   public
1217  * @privilege   %http://tizen.org/privilege/account.read
1218  * @param[in]   callback          The callback function to invoke
1219  * @param[in]   capability_type   The capability type to search
1220  * @param[in]   capability_value  The capability value to search
1221  * @param[in]   user_data         The user data to be passed to the callback function
1222  *
1223  * @return  @c 0 on success,
1224  *          otherwise a negative error value
1225  * @retval  #ACCOUNT_ERROR_NONE               Successful
1226  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1227  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1228  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1229  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1230  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1231  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1232  *
1233  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1234  *        But the account_connect() is not required to use this function since tizen 2.4.
1235  * @post  This function invokes account_cb().
1236  *
1237  * @see account_foreach_account_from_db()
1238  * @see account_query_account_by_account_id()
1239  * @see account_query_account_by_user_name()
1240  * @see account_query_account_by_package_name()
1241  */
1242 int account_query_account_by_capability(account_cb callback, const char *capability_type, account_capability_state_e capability_value, void *user_data);
1243
1244 /**
1245  * @brief  Retrieves all accounts with the capability type.
1246  *
1247  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1248  * @privlevel   public
1249  * @privilege   %http://tizen.org/privilege/account.read
1250  * @param[in]   callback         The callback function to invoke
1251  * @param[in]   capability_type  The capability type to search
1252  * @param[in]   user_data        The user data to be passed to the callback function
1253  *
1254  * @return  @c 0 on success,
1255  *          otherwise a negative error value
1256  * @retval  #ACCOUNT_ERROR_NONE               Successful
1257  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1258  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1259  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1260  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1261  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1262  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1263  *
1264  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1265  *        But the account_connect() is not required to use this function since tizen 2.4.
1266  * @post  This function invokes account_cb().
1267  *
1268  * @see account_foreach_account_from_db()
1269  * @see account_query_account_by_account_id()
1270  * @see account_query_account_by_user_name()
1271  * @see account_query_account_by_package_name()
1272  */
1273 int account_query_account_by_capability_type(account_cb callback, const char *capability_type, void *user_data);
1274
1275 /**
1276  * @brief  Retrieves all capabilities with the account database ID.
1277  *
1278  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1279  * @privlevel   public
1280  * @privilege   %http://tizen.org/privilege/account.read
1281  * @param[in]   callback       The callback function to invoke
1282  * @param[in]   account_db_id  The account database ID to search
1283  * @param[in]   user_data      The user data to be passed to the callback function
1284  *
1285  * @return  @c 0 on success,
1286  *          otherwise a negative error value
1287  * @retval  #ACCOUNT_ERROR_NONE               Successful
1288  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1289  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1290  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1291  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1292  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1293  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1294  *
1295  * @pre   This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1296  *        But the account_connect() is not required to use this function since tizen 2.4.
1297  * @post  This function invokes capability_cb().
1298  *
1299  * @see account_get_capability()
1300  * @see account_set_capability()
1301  */
1302 int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
1303
1304
1305 /**
1306  * @brief  Gets the count of accounts in the account database.
1307  *
1308  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1309  * @privlevel   public
1310  * @privilege   %http://tizen.org/privilege/account.read
1311  * @param[out]  count  The out parameter for count of all accounts
1312  *
1313  * @return  @c 0 on success,
1314  *          otherwise a negative error value
1315  * @retval  #ACCOUNT_ERROR_NONE               Successful
1316  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1317  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1318  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1319  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1320  *
1321  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1322  *       But the account_connect() is not required to use this function since tizen 2.4.
1323  */
1324 int account_get_total_count_from_db(int *count);
1325
1326 /**
1327  * @brief  Updates the sync status of an account with the given account ID.
1328  *
1329  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1330  * @privlevel   public
1331  * @privilege   %http://tizen.org/privilege/account.read \n
1332  *              %http://tizen.org/privilege/account.write
1333  * @remarks     This API need both privileges \n
1334  *              Only can update an account which was added by same package applications
1335  * @param[in]   account_db_id  The account ID for which sync status needs to be changed
1336  * @param[in]   sync_status    The new sync status
1337  *
1338  * @return  @c 0 on success,
1339  *          otherwise a negative error value
1340  * @retval  #ACCOUNT_ERROR_NONE               Successful
1341  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1342  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1343  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1344  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1345  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1346  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1347  *
1348  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1349  *       But the account_connect() is not required to use this function since tizen 2.4.
1350  */
1351 int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
1352
1353
1354 /* Account type API */
1355
1356
1357 /**
1358  * @brief  Creates a handle to the account provider.
1359  *
1360  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1361  * @remarks     You must release @a account_type handle using account_type_destroy().\n
1362  *
1363  * @param[in]  account_type  The account provider handle
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  *
1371  * @see account_type_destroy()
1372  */
1373 int account_type_create(account_type_h *account_type);
1374
1375 /**
1376  * @brief  Destroys the account provider handle and releases all its resources.
1377  *
1378  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1379  *
1380  * @remarks    When you get @a account_type_h using account_type_create(), you must release the handle using account_destroy() to avoid the memory leak.
1381  *
1382  * @param[in]  account_type  The account provider handle
1383  *
1384  * @return  @c 0 on success,
1385  *          otherwise a negative error value
1386  * @retval  #ACCOUNT_ERROR_NONE               Successful
1387  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1388  *
1389  * @see account_type_create()
1390  */
1391 int account_type_destroy(account_type_h account_type);
1392
1393 /**
1394  * @brief  Retrieves capability information with your application ID.
1395  *
1396  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1397  * @privlevel   public
1398  * @privilege   %http://tizen.org/privilege/account.read
1399  * @param[in]   callback   The callback function carries the capability name of an app ID
1400  * @param[in]   app_id     The application ID to search
1401  * @param[in]   user_data  The user data \n
1402  *                         If you have your private data to carry into callback function, then you can use it.
1403  *
1404  * @return  @c 0 on success,
1405  *          otherwise a negative error value
1406  * @retval  #ACCOUNT_ERROR_NONE               Successful
1407  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1408  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1409  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1410  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1411  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1412  *
1413  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1414  *       But the account_connect() is not required to use this function since tizen 2.4.
1415  */
1416 int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char *app_id, void *user_data);
1417
1418 /**
1419  * @brief   Checks whether the given application ID supports the capability.
1420  *
1421  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1422  * @privlevel   public
1423  * @privilege   %http://tizen.org/privilege/account.read
1424  * @remarks     The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1425  * @param[in]   app_id      The application ID
1426  * @param[in]   capability  The capability \n
1427  *                          For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
1428  *
1429  * @return  @c TRUE if the application supports the given capability, \n
1430  *          otherwise @c FALSE if the application does not support the given capability
1431  * @retval  @c TRUE means the application supports the given capability
1432  * @retval  @c FALSE means the application does not support the given capability
1433  * @exception #ACCOUNT_ERROR_NONE               Successful
1434  * @exception #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1435  * @exception #ACCOUNT_ERROR_RECORD_NOT_FOUND   Related record does not exist
1436  * @exception #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1437  * @exception #ACCOUNT_ERROR_PERMISSION_DENIED  DB access fail by permission
1438  * @exception #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1439  * @exception #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1440  *
1441  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1442  *       But the account_connect() is not required to use this function since tizen 2.4.
1443  */
1444 bool account_type_query_supported_feature(const char *app_id, const char *capability);
1445
1446 /**
1447  * @brief  Gets the application ID of an account provider.
1448  *
1449  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1450  * @remarks     You must release @a app_id using free().
1451  *
1452  * @param[in]   account_type  The account provider handle \n
1453  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1454  * @param[out]  app_id        The application ID of an account provider item
1455  *
1456  * @return  @c 0 on success,
1457  *          otherwise a negative error value
1458  * @retval  #ACCOUNT_ERROR_NONE               Successful
1459  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1460  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1461  *
1462  * @see account_type_foreach_account_type_from_db()
1463  * @see account_type_query_by_app_id()
1464  */
1465 int account_type_get_app_id(account_type_h account_type, char **app_id);
1466
1467 /**
1468  * @brief  Gets the service provider ID of an account provider.
1469  *
1470  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1471  * @remarks     You must release @a service_provider_id using free().
1472  *
1473  * @param[in]   account_type         The account provider handle \n
1474  *                                   It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1475  * @param[out]  service_provider_id  The service provider text ID of an account provider item
1476  *
1477  * @return  @c 0 on success,
1478  *          otherwise a negative error value
1479  * @retval  #ACCOUNT_ERROR_NONE               Successful
1480  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1481  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1482  *
1483  * @see account_type_foreach_account_type_from_db()
1484  * @see account_type_query_by_app_id()
1485  */
1486 int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
1487
1488 /**
1489  * @brief  Gets the icon path of an account provider.
1490  *
1491  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1492  * @remarks     You must release @a icon_path using free().
1493  *
1494  * @param[in]   account_type  The account provider handle \n
1495  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1496  * @param[out]  icon_path     The icon path of the account provider item
1497  *
1498  * @return  @c 0 on success,
1499  *          otherwise a negative error value
1500  * @retval  #ACCOUNT_ERROR_NONE               Successful
1501  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1502  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1503  *
1504  * @see account_type_foreach_account_type_from_db()
1505  * @see account_type_query_by_app_id()
1506  */
1507 int account_type_get_icon_path(account_type_h account_type, char **icon_path);
1508
1509 /**
1510  * @brief  Gets the small icon path of an account provider.
1511  *
1512  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1513  * @remarks    You must release @a small_icon_path using free().
1514  *
1515  * @param[in]   account_type     The account provider handle\n
1516  *                               It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1517  * @param[out]  small_icon_path  The small icon path of the account provider item
1518  *
1519  * @return  @c 0 on success,
1520  *          otherwise a negative error value
1521  * @retval  #ACCOUNT_ERROR_NONE               Successful
1522  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1523  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1524  *
1525  * @see account_type_foreach_account_type_from_db()
1526  * @see account_type_query_by_app_id()
1527  */
1528 int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
1529
1530 /**
1531  * @brief  Checks whether the given account provider supports multiple accounts.
1532  *
1533  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1534  * @param[in]   account_type              The account provider handle \n
1535  *                                        It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db.
1536  * @param[out]  multiple_account_support  The flag indicating support for multiple accounts accounts\n
1537  *                                        TRUE or FALSE.
1538  *
1539  * @return  @c 0 on success,
1540  *          otherwise a negative error value
1541  * @retval  #ACCOUNT_ERROR_NONE               Successful
1542  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1543  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of memory
1544  *
1545  * @see account_type_foreach_account_type_from_db()
1546  * @see account_type_query_by_app_id()
1547  */
1548 int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
1549
1550 /**
1551  * @brief  Gets capability information with the given account provider handle.
1552  *
1553  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1554  * @param[in]   account_type  The account provider handle\n
1555  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1556  * @param[in]   callback      The callback function that carries the capability name of the app ID
1557  * @param[in]   user_data     The user data \n
1558  *                            If you have your private data to carry into callback function, then you can use it.
1559  *
1560  * @return  @c 0 on success,
1561  *          otherwise a negative error value
1562  * @retval  #ACCOUNT_ERROR_NONE               Successful
1563  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1564  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1565  *
1566  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1567  *       But the account_connect() is not required to use this function since tizen 2.4.
1568  */
1569 int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void *user_data);
1570
1571 /**
1572  * @brief  Gets the specific label information detail of an account provider.
1573  *
1574  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1575  * @param[in]   account_type The account provider handle\n
1576  *                           It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1577  * @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
1578  *                           For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
1579  * @param[out]  label        The label text given for the locale
1580  *
1581  * @return  @c 0 on success,
1582  *          otherwise a negative error value
1583  * @retval  #ACCOUNT_ERROR_NONE               Successful
1584  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   No label for the given locale
1585  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1586  *
1587  * @see account_type_foreach_account_type_from_db()
1588  * @see account_type_query_by_app_id()
1589  */
1590
1591 int account_type_get_label_by_locale(account_type_h account_type, const char *locale, char **label);
1592
1593 /**
1594  * @brief  Gets the label information detail of an account provider.
1595  *
1596  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1597  * @param[in]   account_type  The account provider handle\n
1598  *                            It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1599  * @param[in]   callback      The callback function carrying the label information
1600  * @param[in]   user_data     The user data to be passed to the callback function
1601  *
1602  * @return  @c 0 on success,
1603  *          otherwise a negative error value
1604  * @retval  #ACCOUNT_ERROR_NONE               Successful
1605  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1606  *
1607  * @see account_type_foreach_account_type_from_db()
1608  * @see account_type_query_by_app_id()
1609  */
1610 int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data);
1611
1612 /**
1613  * @brief  Retrieves the label information with your application ID.
1614  *
1615  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1616  * @privlevel   public
1617  * @privilege   %http://tizen.org/privilege/account.read
1618  * @param[in]   callback    The callback function that carries label_h for label information \n
1619  *                         label_h contains label info as parameter.
1620  * @param[in]   app_id     The application ID to search
1621  * @param[in]   user_data  The user data \n
1622  *                         If you have your private data to carry into callback function, then you can use it.
1623  *
1624  * @return  @c 0 on success,
1625  *          otherwise a negative error value
1626  * @retval  #ACCOUNT_ERROR_NONE               Successful
1627  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1628  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1629  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1630  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1631  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1632  *
1633  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1634  *       But the account_connect() is not required to use this function since tizen 2.4.
1635  *
1636  * @see account_type_query_by_app_id()
1637  * @see account_type_foreach_account_type_from_db()
1638  */
1639 int account_type_query_label_by_app_id(account_label_cb callback, const char *app_id, void *user_data);
1640
1641 /**
1642  * @brief  Retrieves the account provider information with your application ID.
1643  *
1644  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1645  * @privlevel     public
1646  * @privilege     %http://tizen.org/privilege/account.read
1647  * @param[in]     app_id        The application ID to search
1648  * @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.
1649  *
1650  * @return  @c 0 on success,
1651  *          otherwise a negative error value
1652  * @retval  #ACCOUNT_ERROR_NONE               Successful
1653  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1654  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1655  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Queried data does not exist
1656  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1657  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1658  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1659  *
1660  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1661  *       But the account_connect() is not required to use this function since tizen 2.4.
1662  *
1663  * @see account_type_create()
1664  * @see account_type_get_app_id()
1665  * @see account_type_get_service_provider_id()
1666  * @see account_type_get_icon_path()
1667  * @see account_type_get_small_icon_path()
1668  * @see account_type_get_multiple_account_support()
1669  * @see account_type_get_label()
1670  * @see account_type_destroy()
1671  */
1672 int account_type_query_by_app_id(const char *app_id, account_type_h *account_type);
1673
1674 /**
1675  * @brief  Retrieves all account priovider information.
1676  *
1677  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1678  * @privlevel   public
1679  * @privilege   %http://tizen.org/privilege/account.read
1680  * @param[in]   callback   The account provider information \n
1681  *                         You can get the account information through account_type_get_* with the carried account_type_handle.
1682  * @param[in]   user_data  The user data \n
1683  *                         It will be carried through your callback function.
1684  *
1685  * @return  @c 0 on success,
1686  *          otherwise a negative error value
1687  * @retval  #ACCOUNT_ERROR_NONE               Successful
1688  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1689  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1690  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1691  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1692  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1693  *
1694  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1695  *       But the account_connect() is not required to use this function since tizen 2.4.
1696  *
1697  * @see account_type_create()
1698  * @see account_type_get_app_id()
1699  * @see account_type_get_service_provider_id()
1700  * @see account_type_get_icon_path()
1701  * @see account_type_get_small_icon_path()
1702  * @see account_type_get_multiple_account_support()
1703  * @see account_type_get_label()
1704  * @see account_type_destroy()
1705  */
1706 int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
1707
1708 /**
1709  * @brief  Retrieves the label information with the given application ID and locale.
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]   app_id  The application ID
1715  * @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
1716  *                      For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
1717  * @param[out]  label   The label text corresponding app_id and locale \n
1718  *                      It must be free text.
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  *
1729  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1730  *       But the account_connect() is not required to use this function since tizen 2.4.
1731  */
1732 int account_type_query_label_by_locale(const char *app_id, const char *locale, char **label);
1733
1734 /**
1735  * @brief  Retrieves account provider information with the capability name.
1736  *
1737  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1738  * @privlevel   public
1739  * @privilege   %http://tizen.org/privilege/account.read
1740  * @param[in]   callback        The callback function to retrieve account provider information
1741  * @param[in]   key             The capability value to search account provider \n
1742  *                              For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
1743  * @param[in]  user_data        If you have your private data to carry into callback function, then you can use it
1744  *
1745  * @return  @c 0 on success,
1746  *          otherwise a negative error value
1747  * @retval  #ACCOUNT_ERROR_NONE               Successful
1748  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Record not found
1749  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1750  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1751  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1752  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1753  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1754  *
1755  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1756  *       But the account_connect() is not required to use this function since tizen 2.4.
1757  */
1758 int account_type_query_by_provider_feature(account_type_cb callback, const char *key, void *user_data);
1759
1760 /**
1761  * @brief  Checks whether the given app_id exists in the account provider DB.
1762  *
1763  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1764  * @privlevel   public
1765  * @privilege   %http://tizen.org/privilege/account.read
1766  * @param[in]   app_id  The application ID to check
1767  *
1768  * @return  @c 0 on success,
1769  *          otherwise a negative error value
1770  * @retval  #ACCOUNT_ERROR_NONE               Successful
1771  * @retval  #ACCOUNT_ERROR_RECORD_NOT_FOUND   Record not found
1772  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid app ID
1773  * @retval  #ACCOUNT_ERROR_DB_FAILED          Database operation failed
1774  * @retval  #ACCOUNT_ERROR_PERMISSION_DENIED  DB Access fail by permission
1775  * @retval  #ACCOUNT_ERROR_DATABASE_BUSY      SQLite handler is busy
1776  * @retval  #ACCOUNT_ERROR_DB_NOT_OPENED      Account database did not opened
1777  *
1778  * @pre  This function requires an open connection to an account service by account_connect() on tizen 2.3 (MOBILE).\n
1779  *       But the account_connect() is not required to use this function since tizen 2.4.
1780  *
1781  * @see account_type_query_by_app_id()
1782  */
1783 int account_type_query_app_id_exist(const char *app_id);
1784
1785
1786
1787 /* End of account provider API  */
1788
1789 /**
1790  * @brief  Creates a handle for the account event subscription.
1791  *
1792  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1793  * @remarks     You must release @a account_subscribe handle using account_unsubscribe_notification().
1794  *
1795  * @param[in]   account_subscribe  The account subscription handle
1796  *
1797  * @return  @c 0 on success,
1798  *          otherwise a negative error value
1799  * @retval  #ACCOUNT_ERROR_NONE               Successful
1800  * @retval  #ACCOUNT_ERROR_OUT_OF_MEMORY      Out of Memory
1801  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER  Invalid parameter
1802  *
1803  * @see account_unsubscribe_notification()
1804  * @see account_subscribe_notification()
1805  */
1806 int account_subscribe_create(account_subscribe_h *account_subscribe);
1807
1808 /**
1809  * @brief  Starts to subscribe account event through the given callback function.
1810  *
1811  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1812  * @privlevel   public
1813  * @privilege   %http://tizen.org/privilege/account.read \n
1814  * @param[in]   account_subscribe  The account subscription handle
1815  * @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
1816  *                                 It will be called with event message and account ID.
1817  * @param[in]   user_data          The user_data that is delivered to callback
1818  *
1819  * @return  @c 0 on success,
1820  *          otherwise a negative error value
1821  * @retval  #ACCOUNT_ERROR_NONE                     Successful
1822  * @retval  #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL  Subscription fail
1823  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER        Invalid parameter
1824  *
1825  * @pre account_subscribe_create()
1826  *
1827  * @see account_unsubscribe_notification()
1828  * @see account_subscribe_notification()
1829  */
1830 int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void *user_data);
1831
1832 /**
1833  * @brief  Destroys the account subscribe handle and releases all its resources.
1834  *
1835  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
1836  * @privlevel   public
1837  * @privilege   %http://tizen.org/privilege/account.read \n
1838  * @remarks     You must call @a account_unsubscribe_notification when you do not need to subscribe account event.
1839  *
1840  * @param[in]   account_subscribe  The account subscription handle
1841  *
1842  * @return  @c 0 on success,
1843  *          otherwise a negative error value
1844  * @retval  #ACCOUNT_ERROR_NONE                     Successful
1845  * @retval  #ACCOUNT_ERROR_INVALID_PARAMETER        Invalid parameter
1846  * @retval  #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL  Unsubscription failed
1847  *
1848  * @see account_create()
1849  */
1850 int account_unsubscribe_notification(account_subscribe_h account_subscribe);
1851
1852
1853 /* End of Account APIs */
1854 /**
1855  * @}
1856  */
1857
1858
1859 #ifdef __cplusplus
1860 }
1861 #endif
1862
1863
1864 #endif /* __ACCOUNT_H__ */