3 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5 * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@samsung.com>
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include <account-types.h>
25 #include <account-error.h>
33 #define ACCOUNT_API __attribute__ ((visibility("default")))
38 * @brief This file contains the Account API for account management.
42 * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
47 * @brief Called once for each account from the database.
50 * @param[in] account The account handle
51 * @param[in] user_data The user data passed from the foreach function
53 * @return @c true to continue with the next iteration of the loop, \n
54 * otherwise @c false to break out of the loop
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.
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()
63 typedef bool (*account_cb)(account_h account, void *user_data);
66 * @brief Called once for each capability of an account in the database.
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
73 * @return @c true to continue with the next iteration of the loop, \n
74 * otherwise @c false to break out of the loop
76 * @pre account_query_capability_by_account_id() must be called.
78 * @see account_query_capability_by_account_id()
80 typedef bool (*capability_cb)(const char* capability_type, account_capability_state_e capability_state, void *user_data);
83 * @brief Called once for each custom data of an account in the database.
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
90 * @return @c true to continue with the next iteration of the loop, \n
91 * otherwise @c false to break out of the loop
93 * @pre account_query_capability_by_account_id() must be called.
95 * @see account_query_capability_by_account_id()
97 typedef bool (*account_custom_cb)(char* key, char* value, void *user_data);
101 * @brief Called once for each account provider in the database.
104 * @param[in] account_type The account provider handle
105 * @param[in] user_data The user data passed
107 * @return @c true to continue with the next iteration of the loop, \n
108 * otherwise @c false to break out of the loop
110 * @pre account_type_foreach_account_type_from_db(), account_type_query_by_provider_feature() must be called.
112 * @see account_type_foreach_account_type_from_db()
113 * @see account_type_query_by_provider_feature()
115 typedef bool (*account_type_cb)(account_type_h account_type, void *user_data);
119 * @brief Called once for each account label.
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
128 * @return @c true to continue with the next iteration of the loop, \n
129 * otherwise @c false to break out of the loop
131 * @pre account_type_get_label(), account_type_query_label_by_app_id() must be called.
133 * @see account_type_get_label()
134 * @see account_type_query_label_by_app_id()
136 typedef bool (*account_label_cb)(char* app_id, char* label, char* locale, void *user_data);
140 * @brief Called once for each capability of an account provider in the database.
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
147 * @return @c true to continue with the next iteration of the loop, \n
148 * otherwise @c false to break out of the loop
150 * @pre account_type_query_provider_feature_by_app_id(), account_type_get_provider_feature_all() must be called.
152 * @see account_type_query_provider_feature_by_app_id()
153 * @see account_type_get_provider_feature_all()
155 typedef bool (*provider_feature_cb)(char* app_id, char* key, void* user_data);
159 * @brief Called once when an event occurs.
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
166 * @return @c true to continue with the next iteration of the loop, \n
167 * otherwise @c false to break out of the loop
169 * @pre account_subscribe_notification() must be called.
171 * @see account_subscribe_notification()
173 typedef bool (*account_event_cb)(const char* event_type, int account_id, void* user_data);
177 * @brief Connects to the account database by readwrite mode.
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
190 * @see account_disconnect()
192 ACCOUNT_API int account_connect(void);
196 * @brief Connects to the account database by readonly mode.
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
207 * @see account_disconnect()
209 ACCOUNT_API int account_connect_readonly(void);
213 * @brief Disconnects from the account database.
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
224 * @see account_connect()
226 ACCOUNT_API int account_disconnect(void);
230 * @brief Creates a handle to the account.
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.
236 * @param[in] account The account handle
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
244 * @see account_destroy()
246 ACCOUNT_API int account_create(account_h *account);
250 * @brief Destroys the account handle and releases all its resources.
253 * @param[in] account The account handle
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
260 * @see account_create()
262 ACCOUNT_API int account_destroy(account_h account);
266 * @brief Inserts the account details to the account database.
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
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
285 * @pre This function requires an open connection to an account service by account_connect().
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()
294 ACCOUNT_API int account_insert_to_db(account_h account, int *account_db_id);
298 * @brief Deletes an account from the account database by account DB ID.
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
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
314 * @pre This function requires an open connection to an account service by account_connect().
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()
323 ACCOUNT_API int account_delete_from_db_by_id(int account_db_id);
327 * @brief Deletes an account from the account database by user name.
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
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
344 * @pre This function requires an open connection to an account service by account_connect().
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()
353 ACCOUNT_API int account_delete_from_db_by_user_name(char *user_name, char *package_name);
357 * @brief Deletes an account from the account database by package name.
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
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
373 * @pre This function requires an open connection to an account service by account_connect().
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()
382 ACCOUNT_API int account_delete_from_db_by_package_name(const char *package_name);
386 * @brief Updates the account details to the account database.
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
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
404 * @pre This function requires an open connection to an account service by account_connect().
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()
413 ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id);
417 * @brief Updates the account details to the account database without checking provider's permission.
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
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
435 * @pre This function requires an open connection to an account service by account_connect().
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()
444 ACCOUNT_API int account_update_to_db_by_id_ex(account_h account, int account_id);
447 * @brief Updates the account details to the account database.
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
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
466 * @pre This function requires an open connection to an account service by account_connect().
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()
476 ACCOUNT_API int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
479 * @brief Gets the ID of an account.
482 * @param[in] account The account handle
483 * @param[out] account_id The account ID
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
491 ACCOUNT_API int account_get_account_id(account_h account, int *account_id);
494 * @brief Gets the user name of an account.
497 * @remarks You must release @a user_name using free().
499 * @param[in] account The account handle
500 * @param[out] user_name The user name of the account
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
508 * @see account_set_user_name()
510 ACCOUNT_API int account_get_user_name(account_h account, char **user_name);
514 * @brief Sets the user name of an account.
517 * @param[in] account The account handle
518 * @param[in] user_name The string to set as user name
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
525 * @see account_get_user_name()
527 ACCOUNT_API int account_set_user_name(account_h account, const char *user_name);
531 * @brief Gets the display name of an account.
534 * @remarks You must release @a display_name using free().
536 * @param[in] account The account handle
537 * @param[out] display_name The display name of the account
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
545 * @see account_get_display_name()
547 ACCOUNT_API int account_get_display_name(account_h account, char **display_name);
551 * @brief Sets the display name of an account.
554 * @param[in] account The account handle
555 * @param[in] display_name The text string to set as the display name
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
562 * @see account_get_display_name()
564 ACCOUNT_API int account_set_display_name(account_h account, const char *display_name);
567 * @brief Gets the capability detail of an account.
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
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
580 * @see account_set_capability()
582 ACCOUNT_API int account_get_capability(account_h account, const char* capability_type, account_capability_state_e* capability_value);
585 * @brief Gets all the capabilities of an account.
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
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
597 * @see account_set_capability()
599 ACCOUNT_API int account_get_capability_all(account_h account, capability_cb callback, void *user_data);
602 * @brief Sets the capability.
605 * @param[in] account The account handle
606 * @param[in] capability_type The capability type
607 * @param[in] capability_state The capability state
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
614 * @see account_get_capability()
616 ACCOUNT_API int account_set_capability(account_h account, const char* capability_type, account_capability_state_e capability_state);
620 * @brief Gets the icon path.
623 * @remarks You must release @a icon_path using free().
625 * @param[in] account The account handle
626 * @param[out] icon_path The icon path
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
634 * @see account_set_icon_path()
636 ACCOUNT_API int account_get_icon_path(account_h account, char **icon_path);
640 * @brief Sets the icon path.
643 * @param[in] account The account handle
644 * @param[in] icon_path The text string to set as the icon path
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
651 * @see account_get_icon_path()
653 ACCOUNT_API int account_set_icon_path(account_h account, const char *icon_path);
657 * @brief Gets the domain name.
660 * @remarks You must release @a domain_name using free().
662 * @param[in] account The account handle
663 * @param[out] domain_name The domain name
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
671 * @see account_set_domain_name()
673 ACCOUNT_API int account_get_domain_name(account_h account, char **domain_name);
677 * @brief Sets the domain name.
680 * @param[in] account The account handle
681 * @param[in] domain_name The text string to set as the domain name
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
688 * @see account_get_domain_name()
690 ACCOUNT_API int account_set_domain_name(account_h account, const char *domain_name);
694 * @brief Gets the email address.
697 * @remarks You must release @a email_address using free().
699 * @param[in] account The account handle
700 * @param[out] email_address The email address
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
708 * @see account_set_email_address()
710 ACCOUNT_API int account_get_email_address(account_h account, char **email_address);
714 * @brief Sets the email address.
717 * @param[in] account The account handle
718 * @param[in] email_address The text string to set as the email address
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
725 * @see account_get_email_address()
727 ACCOUNT_API int account_set_email_address(account_h account, const char *email_address);
731 * @brief Gets the package name.
734 * @remarks You must release @a package_name using free().
736 * @param[in] account The account handle
737 * @param[out] package_name The package name
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
745 * @see account_set_package_name()
747 ACCOUNT_API int account_get_package_name(account_h account, char **package_name);
751 * @brief Sets the package name.
754 * @param[in] account The account handle
755 * @param[in] package_name The text string to set as the package name
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
762 * @see account_get_email_address()
764 ACCOUNT_API int account_set_package_name(account_h account, const char *package_name);
768 * @brief Gets the access token.
771 * @remarks You must release @a access_token using free().
773 * @param[in] account The account handle
774 * @param[out] access_token The access token
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
782 * @see account_set_access_token()
784 ACCOUNT_API int account_get_access_token(account_h account, char **access_token);
788 * @brief Sets the access token.
791 * @param[in] account The account handle
792 * @param[in] access_token The text string to set as the access token
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
799 * @see account_get_access_token()
801 ACCOUNT_API int account_set_access_token(account_h account, const char *access_token);
805 * @brief Gets the user text.
808 * @remarks You must release @a user_text using free().
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
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
820 * @see account_set_user_text()
822 ACCOUNT_API int account_get_user_text(account_h account, int user_text_index, char **user_text);
826 * @brief Sets the user text.
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
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
838 * @see account_get_user_text()
840 ACCOUNT_API int account_set_user_text(account_h account, int user_text_index, const char *user_text);
844 * @brief Gets the user integer.
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
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
856 * @see account_set_user_int()
858 ACCOUNT_API int account_get_user_int(account_h account, int user_int_index, int *user_integer);
862 * @brief Sets the user integer.
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
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
874 * @see account_get_user_int()
876 ACCOUNT_API int account_set_user_int(account_h account, int user_int_index, int user_integer);
880 * @brief Gets the auth type.
883 * @param[in] account The account handle
884 * @param[out] auth_type The auth type
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
891 * @see account_set_auth_type()
893 ACCOUNT_API int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
897 * @brief Sets the auth type.
900 * @param[in] account The account handle
901 * @param[in] auth_type The integer to be set as the auth type
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
908 * @see account_get_auth_type()
910 ACCOUNT_API int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
914 * @brief Gets the secret.
917 * @param[in] account The account handle
918 * @param[out] secret The secret
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
925 * @see account_set_secret()
927 ACCOUNT_API int account_get_secret(account_h account, account_secrecy_state_e *secret);
931 * @brief Sets the secret.
934 * @param[in] account The account handle
935 * @param[in] secret The secrecy to be set
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
942 * @see account_get_secret()
944 ACCOUNT_API int account_set_secret(account_h account, const account_secrecy_state_e secret);
947 * @brief Gets the sync support.
950 * @param[in] account The account handle
951 * @param[out] sync_support The sync support
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
958 * @see account_set_sync_support()
960 ACCOUNT_API int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
964 * @brief Sets the sync support.
967 * @param[in] account The account handle
968 * @param[in] sync_support The sync state to be set
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
975 * @see account_get_sync_support()
977 ACCOUNT_API int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
981 * @brief Gets the source.
984 * @remarks You must release @a user_text using free().
986 * @param[in] account The account handle
987 * @param[out] source The source
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
995 * @see account_set_source()
997 ACCOUNT_API int account_get_source(account_h account, char **source);
1001 * @brief Sets the source.
1004 * @param[in] account The account handle
1005 * @param[in] source The text string to set as the source
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
1012 * @see account_get_source()
1014 ACCOUNT_API int account_set_source(account_h account, const char *source);
1017 * @brief Sets the custom.
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
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
1029 * @see account_get_custom()
1031 ACCOUNT_API int account_set_custom(account_h account, const char* key, const char* value);
1034 * @brief Gets the user specific custom text of an account key.
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
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
1047 * @see account_set_custom()
1049 ACCOUNT_API int account_get_custom(account_h account, const char* key, char** value);
1053 * @brief Gets all the user custom texts of an account.
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
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
1066 * @see account_set_custom()
1068 ACCOUNT_API int account_get_custom_all(account_h account, account_custom_cb callback, void* user_data);
1071 * @brief Retrieves all accounts details by invoking the given callback function iteratively.
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
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
1087 * @pre This function requires an open connection to an account service by account_connect().
1088 * @post This function invokes account_cb().
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()
1096 ACCOUNT_API int account_foreach_account_from_db(account_cb callback, void *user_data);
1100 * @brief Retrieve an account with the account ID.
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().
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
1116 * @pre This function requires an open connection to an account service by account_connect().
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()
1123 ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h *account);
1126 * @brief Retrieves all accounts with the user name.
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
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
1142 * @pre This function requires an open connection to an account service by account_connect().
1143 * @post This function invokes account_cb().
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()
1152 ACCOUNT_API int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data);
1155 * @brief Retrieves all accounts with the package name.
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
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
1171 * @pre This function requires an open connection to an account service by account_connect().
1172 * @post This function invokes account_cb().
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()
1180 ACCOUNT_API int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
1183 * @brief Retrieves all accounts with the capability type and capability value.
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
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
1200 * @pre This function requires an open connection to an account service by account_connect().
1201 * @post This function invokes account_cb().
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()
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);
1212 * @brief Retrieves all accounts with the capability type.
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
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
1228 * @pre This function requires an open connection to an account service by account_connect().
1229 * @post This function invokes account_cb().
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()
1237 ACCOUNT_API int account_query_account_by_capability_type(account_cb callback, const char* capability_type, void* user_data);
1240 * @brief Retrieves all capabilities with the account database ID.
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
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
1256 * @pre This function requires an open connection to an account service by account_connect().
1257 * @post This function invokes capability_cb().
1259 * @see account_connect()
1260 * @see account_get_capability()
1261 * @see account_set_capability()
1263 ACCOUNT_API int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
1267 * @brief Gets the count of accounts in the account database.
1271 * @privilege %http://tizen.org/privilege/account.read
1272 * @param[out] count The out parameter for count of all accounts
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
1280 * @pre This function requires an open connection to an account service by account_connect().
1282 * @see account_connect()
1284 ACCOUNT_API int account_get_total_count_from_db(int *count);
1287 * @brief Updates the sync status of an account with the given account ID.
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
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
1304 * @pre This function requires an open connection to an account service by account_connect().
1306 * @see account_connect()
1308 ACCOUNT_API int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
1311 /* Account type API */
1315 * @brief Creates a handle to the account provider.
1318 * @remarks You must release @a account_type handle using account_type_destroy().\n
1320 * @param[in] account_type The account provider handle
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
1328 * @see account_type_destroy()
1330 ACCOUNT_API int account_type_create(account_type_h *account_type);
1333 * @brief Destroys the account provider handle and releases all its resources.
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.
1339 * @param[in] account_type The account provider handle
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
1346 * @see account_type_create()
1348 ACCOUNT_API int account_type_destroy(account_type_h account_type);
1352 * @brief Sets the app ID.
1353 * It should be filled with your application ID. For example, com.tizen.testapp.
1356 * @remarks @a app_id is a mandatory field and does not allow duplicate app ID in the account provider database.
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
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
1368 * @see account_type_get_app_id()
1370 ACCOUNT_API int account_type_set_app_id(account_type_h account_type, const char *app_id);
1374 * @brief Sets the service provider ID.
1375 * It should be filled with your service provider ID.
1378 * @remarks @a service_provider_id is a mandatory field.
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
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
1390 * @see account_type_get_service_provider_id()
1392 ACCOUNT_API int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id);
1396 * @brief Sets icon path.
1397 * It represents your service provider or an application.
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.
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
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
1412 * @see account_type_get_icon_path()
1414 ACCOUNT_API int account_type_set_icon_path(account_type_h account_type, const char *icon_path);
1418 * @brief Sets small icon path.
1419 * It also represents your service provider or an application.
1422 * @remarks @a small_icon_path is not a mandatory field.
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
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
1434 * @see account_type_get_small_icon_path()
1436 ACCOUNT_API int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path);
1440 * @brief Sets support for multiple accounts.
1441 * It represents whether your application supports multiple accounts.
1444 * @remarks The default value of multiple account support is @c FALSE.
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
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
1457 * @see account_type_get_multiple_account_support()
1459 ACCOUNT_API int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support);
1463 * @brief Sets label and locale.
1464 * Label represents the name of an account provider.
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.
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
1479 * @see account_type_get_label()
1481 ACCOUNT_API int account_type_set_label(account_type_h account_type, const char* label, const char* locale);
1485 * @brief Sets the capability.
1488 * @param[in] account_type The account provider handle
1489 * @param[in] provider_feature Th capability key of the account
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
1496 * @see account_set_capability()
1498 ACCOUNT_API int account_type_set_provider_feature(account_type_h account_type, const char* provider_feature);
1501 * @brief Retrieves capability information with your application ID.
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.
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
1518 * @pre This function requires an open connection to an account service by account_connect().
1520 * @see account_connect()
1521 * @see account_disconnect()
1523 ACCOUNT_API int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char* app_id, void *user_data );
1526 * @brief Checks whether the given application ID supports the capability.
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"
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
1545 * @pre This function requires an open connection to an account service by account_connect().
1547 * @see account_connect()
1548 * @see account_disconnect()
1550 ACCOUNT_API bool account_type_query_supported_feature(const char* app_id, const char* capability);
1553 * @brief Gets the application ID of an account provider.
1556 * @remarks You must release @a app_id using free().
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
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
1568 * @see account_type_foreach_account_type_from_db()
1569 * @see account_type_query_by_app_id()
1571 ACCOUNT_API int account_type_get_app_id(account_type_h account_type, char **app_id);
1574 * @brief Gets the service provider ID of an account provider.
1577 * @remarks You must release @a service_provider_id using free().
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
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
1589 * @see account_type_foreach_account_type_from_db()
1590 * @see account_type_query_by_app_id()
1592 ACCOUNT_API int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
1595 * @brief Gets the icon path of an account provider.
1598 * @remarks You must release @a icon_path using free().
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
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
1610 * @see account_type_foreach_account_type_from_db()
1611 * @see account_type_query_by_app_id()
1613 ACCOUNT_API int account_type_get_icon_path(account_type_h account_type, char **icon_path);
1616 * @brief Gets the small icon path of an account provider.
1619 * @remarks You must release @a small_icon_path using free().
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
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
1631 * @see account_type_foreach_account_type_from_db()
1632 * @see account_type_query_by_app_id()
1634 ACCOUNT_API int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
1637 * @brief Checks whether the given account provider supports multiple accounts.
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
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
1651 * @see account_type_foreach_account_type_from_db()
1652 * @see account_type_query_by_app_id()
1654 ACCOUNT_API int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
1657 * @brief Gets capability information with the given account provider handle.
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.
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
1672 * @pre This function requires an open connection to an account service by account_connect().
1674 * @see account_connect()
1675 * @see account_disconnect()
1677 ACCOUNT_API int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void* user_data);
1680 * @brief Gets the specific label information detail of an account provider.
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
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
1695 * @see account_type_foreach_account_type_from_db()
1696 * @see account_type_query_by_app_id()
1699 ACCOUNT_API int account_type_get_label_by_locale(account_type_h account_type, const char* locale, char** label);
1702 * @brief Gets the label information detail of an account provider.
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
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
1715 * @see account_type_foreach_account_type_from_db()
1716 * @see account_type_query_by_app_id()
1718 ACCOUNT_API int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data);
1722 * @brief Inserts the account provider details to the database.
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
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
1739 * @pre This function requires an open connection to an account service by account_connect().
1740 * @post account_disconnect() is recommended after insertion.
1742 * @see account_connect()
1743 * @see account_disconnect()
1745 ACCOUNT_API int account_type_insert_to_db(account_type_h account_type, int* account_type_id);
1749 * @brief Updates the account details to the account database.
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
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
1766 * @pre This function requires an open connection to an account service by account_connect().
1767 * @post account_disconnect() is recommended after update.
1769 * @see account_connect()
1770 * @see account_disconnect()
1772 ACCOUNT_API int account_type_update_to_db_by_app_id(const account_type_h account_type, const char* app_id);
1776 * @brief Deletes the account provider from the account database by application ID.
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
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
1792 * @pre This function requires an open connection to an account service by account_connect().
1794 * @see account_connect()
1795 * @see account_disconnect()
1797 ACCOUNT_API int account_type_delete_by_app_id(const char* app_id);
1800 * @brief Retrieves the label information with your application ID.
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.
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
1818 * @pre This function requires an open connection to an account service by account_connect().
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()
1825 ACCOUNT_API int account_type_query_label_by_app_id(account_label_cb callback, const char* app_id, void *user_data );
1828 * @brief Retrieves the account provider information with your application ID.
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()
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
1844 * @pre This function requires an open connection to an account service by account_connect().
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()
1856 ACCOUNT_API int account_type_query_by_app_id(const char* app_id, account_type_h *account_type);
1859 * @brief Retrieves all account priovider information.
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.
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
1876 * @pre This function requires an open connection to an account service by account_connect().
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()
1888 ACCOUNT_API int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
1891 * @brief Retrieves the label information with the given application ID and locale.
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.
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
1909 * @pre This function requires an open connection to an account service by account_connect().
1911 * @see account_connect()
1913 ACCOUNT_API int account_type_query_label_by_locale(const char* app_id, const char* locale, char** label);
1916 * @brief Retrieves account provider information with the capability name.
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
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
1934 * @pre This function requires an open connection to an account service by account_connect().
1936 * @see account_connect()
1938 ACCOUNT_API int account_type_query_by_provider_feature(account_type_cb callback, const char* key, void* user_data);
1941 * @brief Checks whether the given app_id exists in the account provider DB.
1945 * @privilege %http://tizen.org/privilege/account.read
1946 * @param[in] app_id The application ID to check
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
1955 * @pre This function requires an open connection to an account service by account_connect().
1957 * @see account_type_query_by_app_id()
1959 ACCOUNT_API int account_type_query_app_id_exist(const char* app_id);
1963 /* End of account provider API */
1966 * @brief Creates a handle for the account event subscription.
1969 * @remarks You must release @a account_subscribe handle using account_unsubscribe_notification().
1971 * @param[in] account_subscribe The account subscription handle
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
1979 * @see account_unsubscribe_notification()
1980 * @see account_subscribe_notification()
1982 ACCOUNT_API int account_subscribe_create(account_subscribe_h* account_subscribe);
1985 * @brief Starts to subscribe account event through the given callback function.
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
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
2001 * @pre account_subscribe_create()
2003 * @see account_unsubscribe_notification()
2004 * @see account_subscribe_notification()
2006 ACCOUNT_API int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void* user_data);
2009 * @brief Destroys the account subscribe handle and releases all its resources.
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.
2016 * @param[in] account_subscribe The account subscription handle
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
2024 * @see account_create()
2026 ACCOUNT_API int account_unsubscribe_notification(account_subscribe_h account_subscribe);
2036 #endif /* __ACCOUNT_H__ */