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