3 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
22 #include <account-types.h>
23 #include <account-error.h>
31 #define ACCOUNT_API __attribute__ ((visibility("default")))
36 * @brief This file contains the Account API for account management.
40 * @addtogroup CAPI_ACCOUNT_MANAGER_MODULE
45 * @brief Called once for each account from the database.
48 * @param[in] account The account handle
49 * @param[in] user_data The user data passed from the foreach function
51 * @return @c true to continue with the next iteration of the loop, \n
52 * otherwise @c false to break out of the loop
54 * @pre account_foreach_account_from_db(), account_query_account_by_account_id(), account_query_account_by_user_name() or account_query_account_by_package_name() must be called.
56 * @see account_foreach_account_from_db()
57 * @see account_query_account_by_account_id()
58 * @see account_query_account_by_user_name()
59 * @see account_query_account_by_package_name()
61 typedef bool (*account_cb)(account_h account, void *user_data);
64 * @brief Called once for each capability of an account in the database.
67 * @param[in] capability_type The capability type
68 * @param[in] capability_state The capability state
69 * @param[in] user_data The user data passed from the foreach function
71 * @return @c true to continue with the next iteration of the loop, \n
72 * otherwise @c false to break out of the loop
74 * @pre account_query_capability_by_account_id() must be called.
76 * @see account_query_capability_by_account_id()
78 typedef bool (*capability_cb)(const char *capability_type, account_capability_state_e capability_state, void *user_data);
81 * @brief Called once for each custom data of an account in the database.
84 * @param[in] key The user custom key
85 * @param[in] value The user custom value of the specific key
86 * @param[in] user_data The user data passed
88 * @return @c true to continue with the next iteration of the loop, \n
89 * otherwise @c false to break out of the loop
91 * @pre account_query_capability_by_account_id() must be called.
93 * @see account_query_capability_by_account_id()
95 typedef bool (*account_custom_cb)(char *key, char *value, void *user_data);
99 * @brief Called once for each account provider in the database.
102 * @param[in] account_type The account provider handle
103 * @param[in] user_data The user data passed
105 * @return @c true to continue with the next iteration of the loop, \n
106 * otherwise @c false to break out of the loop
108 * @pre account_type_foreach_account_type_from_db(), account_type_query_by_provider_feature() must be called.
110 * @see account_type_foreach_account_type_from_db()
111 * @see account_type_query_by_provider_feature()
113 typedef bool (*account_type_cb)(account_type_h account_type, void *user_data);
117 * @brief Called once for each account label.
120 * @param[in] app_id The application ID
121 * @param[in] label The name of the account depends on the specified locale
122 * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
123 * For example, "ko_KR" for Korean, "en_US" for American English.
124 * @param[in] user_data The user data passed
126 * @return @c true to continue with the next iteration of the loop, \n
127 * otherwise @c false to break out of the loop
129 * @pre account_type_get_label(), account_type_query_label_by_app_id() must be called.
131 * @see account_type_get_label()
132 * @see account_type_query_label_by_app_id()
134 typedef bool (*account_label_cb)(char *app_id, char *label, char *locale, void *user_data);
138 * @brief Called once for each capability of an account provider in the database.
141 * @param[in] app_id The application ID
142 * @param[in] key The user custom key
143 * @param[in] user_data The user data passed
145 * @return @c true to continue with the next iteration of the loop, \n
146 * otherwise @c false to break out of the loop
148 * @pre account_type_query_provider_feature_by_app_id(), account_type_get_provider_feature_all() must be called.
150 * @see account_type_query_provider_feature_by_app_id()
151 * @see account_type_get_provider_feature_all()
153 typedef bool (*provider_feature_cb)(char *app_id, char *key, void *user_data);
157 * @brief Called once when an event occurs.
160 * @param[in] event_type The account event type
161 * @param[in] account_id The account ID to update
162 * @param[in] user_data The user data passed
164 * @return @c true to continue with the next iteration of the loop, \n
165 * otherwise @c false to break out of the loop
167 * @pre account_subscribe_notification() must be called.
169 * @see account_subscribe_notification()
171 typedef bool (*account_event_cb)(const char *event_type, int account_id, void *user_data);
175 * @deprecated Deprecated since Tizen 2.4.\n
176 * This API is not necessary to use since Tizen 2.4.
177 * @brief Connects to the account database by readwrite mode.
181 * @privilege %http://tizen.org/privilege/account.read \n
182 * %http://tizen.org/privilege/account.wirte
183 * @remarks This API need both privileges
184 * @return @c 0 on success,
185 * otherwise a negative error value
186 * @retval #ACCOUNT_ERROR_NONE Successful
187 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED DB is not connected
188 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
190 int account_connect(void);
194 * @deprecated Deprecated since Tizen 2.4.\n
195 * This API is not necessary to use since Tizen 2.4.
196 * @brief Connects to the account database by readonly mode.
199 * @return @c 0 on success,
200 * otherwise a negative error value
201 * @retval #ACCOUNT_ERROR_NONE Successful
202 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED DB is not connected
203 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
205 int account_connect_readonly(void);
209 * @deprecated Deprecated since Tizen 2.4.\n
210 * This API is not necessary to use since Tizen 2.4.
211 * @brief Disconnects from the account database.
214 * @return @c 0 on success,
215 * otherwise a negative error value
216 * @retval #ACCOUNT_ERROR_NONE Successful
217 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
218 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite busy handler exprired
220 int account_disconnect(void);
223 * @brief Creates a handle to the account.
226 * @remarks Release @a account using account_destroy().
227 * @remarks The created handle is not added to the account database until account_insert_to_db() is called.
229 * @param[in] account The account handle
231 * @return @c 0 on success,
232 * otherwise a negative error value
233 * @retval #ACCOUNT_ERROR_NONE Successful
234 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
235 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
237 * @see account_destroy()
239 int account_create(account_h *account);
243 * @brief Destroys the account handle and releases all its resources.
246 * @param[in] account The account handle
248 * @return @c 0 on success,
249 * otherwise a negative error value
250 * @retval #ACCOUNT_ERROR_NONE Successful
251 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
253 * @see account_create()
255 int account_destroy(account_h account);
259 * @brief Inserts the account details to the account database.
263 * @privilege %http://tizen.org/privilege/account.read \n
264 * %http://tizen.org/privilege/account.write
265 * @remarks This API need both privileges
266 * @param[in] account The account handle
267 * @param[out] account_db_id The account ID to be assigned to an account
269 * @return @c 0 on success,
270 * otherwise a negative error value
271 * @retval #ACCOUNT_ERROR_NONE Successful
272 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
273 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
274 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
275 * @retval #ACCOUNT_ERROR_DUPLICATED Same user name exists in your application
276 * @retval #ACCOUNT_ERROR_NOT_ALLOW_MULTIPLE Tried to add an account in spite of multiple false accounts
277 * @retval #ACCOUNT_ERROR_NOT_REGISTERED_PROVIDER Tried to add an account though you did not register the account type in manifest
278 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
279 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
280 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
282 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
283 * But the account_connect() is not required to use this function since tizen 2.4.
285 * @see account_delete_from_db_by_id()
286 * @see account_delete_from_db_by_user_name()
287 * @see account_delete_from_db_by_package_name()
288 * @see account_update_to_db_by_id()
289 * @see account_update_to_db_by_user_name()
291 int account_insert_to_db(account_h account, int *account_db_id);
295 * @brief Deletes an account from the account database by account DB ID.
299 * @privilege %http://tizen.org/privilege/account.read \n
300 * %http://tizen.org/privilege/account.write
301 * @remarks This API need both privileges \n
302 * Only can delete an account which was added by same package applications
303 * @param[in] account_db_id The account ID to delete
305 * @return @c 0 on success,
306 * otherwise a negative error value
307 * @retval #ACCOUNT_ERROR_NONE Successful
308 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
309 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
310 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
311 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED The account owner is different from the caller or DB Access fail by permission
312 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
313 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
315 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
316 * But the account_connect() is not required to use this function since tizen 2.4.
318 * @see account_insert_to_db()
319 * @see account_delete_from_db_by_user_name()
320 * @see account_delete_from_db_by_package_name()
321 * @see account_update_to_db_by_id()
322 * @see account_update_to_db_by_user_name()
324 int account_delete_from_db_by_id(int account_db_id);
328 * @brief Deletes an account from the account database by user name.
332 * @privilege %http://tizen.org/privilege/account.read \n
333 * %http://tizen.org/privilege/account.write
334 * @remarks This API need both privileges \n
335 * Only can delete accounts which were added by same package applications
336 * @param[in] user_name The user name of the account to delete
337 * @param[in] package_name The package name of the account to delete
339 * @return @c 0 on success,
340 * otherwise a negative error value
341 * @retval #ACCOUNT_ERROR_NONE Successful
342 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
343 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
344 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
345 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
346 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
347 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
349 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
350 * But the account_connect() is not required to use this function since tizen 2.4.
352 * @see account_insert_to_db()
353 * @see account_delete_from_db_by_id()
354 * @see account_delete_from_db_by_package_name()
355 * @see account_update_to_db_by_id()
356 * @see account_update_to_db_by_user_name()
358 int account_delete_from_db_by_user_name(char *user_name, char *package_name);
362 * @brief Deletes an account from the account database by package name.
366 * @privilege %http://tizen.org/privilege/account.read \n
367 * %http://tizen.org/privilege/account.write
368 * @remarks This API need both privileges \n
369 * Only can delete accounts which was added by same package applications
370 * @param[in] package_name The package name of account(s) to delete
372 * @return @c 0 on success,
373 * otherwise a negative error value
374 * @retval #ACCOUNT_ERROR_NONE Successful
375 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
376 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
377 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
378 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
379 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
381 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
382 * But the account_connect() is not required to use this function since tizen 2.4.
384 * @see account_insert_to_db()
385 * @see account_delete_from_db_by_id()
386 * @see account_delete_from_db_by_user_name()
387 * @see account_update_to_db_by_id()
388 * @see account_update_to_db_by_user_name()
390 int account_delete_from_db_by_package_name(const char *package_name);
393 * @brief Updates the account details to the account database.
397 * @privilege %http://tizen.org/privilege/account.read \n
398 * %http://tizen.org/privilege/account.write
399 * @remarks This API need both privileges \n
400 * Only can update an account which was added by same package applications
401 * @param[in] account The account handle
402 * @param[in] account_id The account ID to update
404 * @return @c 0 on success,
405 * otherwise a negative error value
406 * @retval #ACCOUNT_ERROR_NONE Successful
407 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
408 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
409 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
410 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
411 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
412 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
414 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
415 * But the account_connect() is not required to use this function since tizen 2.4.
417 * @see account_insert_to_db()
418 * @see account_delete_from_db_by_id()
419 * @see account_delete_from_db_by_user_name()
420 * @see account_delete_from_db_by_package_name()
421 * @see account_update_to_db_by_user_name()
423 int account_update_to_db_by_id(account_h account, int account_id);
426 * @brief Updates the account details to the account database.
427 * The provider permission check has been added since tizen 2.4.
431 * @privilege %http://tizen.org/privilege/account.read \n
432 * %http://tizen.org/privilege/account.write
433 * @remarks This API need both privileges \n
434 * Only can update an account which was added by same package applications
435 * @param[in] account The account handle
436 * @param[in] account_id The account ID to update
438 * @return @c 0 on success,
439 * otherwise a negative error value
440 * @retval #ACCOUNT_ERROR_NONE Successful
441 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
442 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
443 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
444 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
445 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
446 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
447 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
449 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
450 * But the account_connect() is not required to use this function since tizen 2.4.
452 * @see account_insert_to_db()
453 * @see account_delete_from_db_by_id()
454 * @see account_delete_from_db_by_user_name()
455 * @see account_delete_from_db_by_package_name()
456 * @see account_update_to_db_by_user_name()
458 int account_update_to_db_by_id_ex(account_h account, int account_id);
461 * @brief Updates the account details to the account database.
465 * @privilege %http://tizen.org/privilege/account.read \n
466 * %http://tizen.org/privilege/account.write
467 * @remarks This API need both privileges \n
468 * Only can update accounts which were added by same package applications
469 * @param[in] account The account handle
470 * @param[in] user_name The user name of the account to update
471 * @param[in] package_name The package name for the user name
473 * @return @c 0 on success,
474 * otherwise a negative error value
475 * @retval #ACCOUNT_ERROR_NONE Successful
476 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
477 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
478 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
479 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
480 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
481 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
483 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
484 * But the account_connect() is not required to use this function since tizen 2.4.
486 * @see account_insert_to_db()
487 * @see account_delete_from_db_by_id()
488 * @see account_delete_from_db_by_user_name()
489 * @see account_delete_from_db_by_package_name()
490 * @see account_update_to_db_by_id()
493 int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
496 * @brief Gets the ID of an account.
499 * @param[in] account The account handle
500 * @param[out] account_id The account ID
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
508 int account_get_account_id(account_h account, int *account_id);
511 * @brief Gets the user name of an account.
514 * @remarks You must release @a user_name using free().
516 * @param[in] account The account handle
517 * @param[out] user_name The user name of the account
519 * @return @c 0 on success,
520 * otherwise a negative error value
521 * @retval #ACCOUNT_ERROR_NONE Successful
522 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
523 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
525 * @see account_set_user_name()
527 int account_get_user_name(account_h account, char **user_name);
531 * @brief Sets the user name of an account.
534 * @param[in] account The account handle
535 * @param[in] user_name The string to set as user name
537 * @return @c 0 on success,
538 * otherwise a negative error value
539 * @retval #ACCOUNT_ERROR_NONE Successful
540 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
542 * @see account_get_user_name()
544 int account_set_user_name(account_h account, const char *user_name);
548 * @brief Gets the display name of an account.
551 * @remarks You must release @a display_name using free().
553 * @param[in] account The account handle
554 * @param[out] display_name The display name of the account
556 * @return @c 0 on success,
557 * otherwise a negative error value
558 * @retval #ACCOUNT_ERROR_NONE Successful
559 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
560 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
562 * @see account_get_display_name()
564 int account_get_display_name(account_h account, char **display_name);
568 * @brief Sets the display name of an account.
571 * @param[in] account The account handle
572 * @param[in] display_name The text string to set as the display name
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
579 * @see account_get_display_name()
581 int account_set_display_name(account_h account, const char *display_name);
584 * @brief Gets the capability detail of an account.
587 * @param[in] account The account handle
588 * @param[in] capability_type The capability type to get the capability value
589 * @param[out] capability_value The capability value (on/off) of the specified capability_type
591 * @return @c 0 on success,
592 * otherwise a negative error value
593 * @retval #ACCOUNT_ERROR_NONE Successful
594 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
595 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability_type in the account
597 * @see account_set_capability()
599 int account_get_capability(account_h account, const char *capability_type, account_capability_state_e *capability_value);
602 * @brief Gets all the capabilities of an account.
605 * @param[in] account The account handle
606 * @param[in] callback The callback function
607 * @param[in] user_data The user data to be passed to the callback function
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_set_capability()
616 int account_get_capability_all(account_h account, capability_cb callback, void *user_data);
619 * @brief Sets the capability.
622 * @param[in] account The account handle
623 * @param[in] capability_type The capability type
624 * @param[in] capability_state The capability state
626 * @return @c 0 on success,
627 * otherwise a negative error value
628 * @retval #ACCOUNT_ERROR_NONE Successful
629 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
631 * @see account_get_capability()
633 int account_set_capability(account_h account, const char *capability_type, account_capability_state_e capability_state);
637 * @brief Gets the icon path.
640 * @remarks You must release @a icon_path using free().
642 * @param[in] account The account handle
643 * @param[out] icon_path The icon path
645 * @return @c 0 on success,
646 * otherwise a negative error value
647 * @retval #ACCOUNT_ERROR_NONE Successful
648 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
649 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
651 * @see account_set_icon_path()
653 int account_get_icon_path(account_h account, char **icon_path);
657 * @brief Sets the icon path.
660 * @param[in] account The account handle
661 * @param[in] icon_path The text string to set as the icon path
663 * @return @c 0 on success,
664 * otherwise a negative error value
665 * @retval #ACCOUNT_ERROR_NONE Successful
666 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
668 * @see account_get_icon_path()
670 int account_set_icon_path(account_h account, const char *icon_path);
674 * @brief Gets the domain name.
677 * @remarks You must release @a domain_name using free().
679 * @param[in] account The account handle
680 * @param[out] domain_name The domain name
682 * @return @c 0 on success,
683 * otherwise a negative error value
684 * @retval #ACCOUNT_ERROR_NONE Successful
685 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
686 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
688 * @see account_set_domain_name()
690 int account_get_domain_name(account_h account, char **domain_name);
694 * @brief Sets the domain name.
697 * @param[in] account The account handle
698 * @param[in] domain_name The text string to set as the domain name
700 * @return @c 0 on success,
701 * otherwise a negative error value
702 * @retval #ACCOUNT_ERROR_NONE Successful
703 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
705 * @see account_get_domain_name()
707 int account_set_domain_name(account_h account, const char *domain_name);
711 * @brief Gets the email address.
714 * @remarks You must release @a email_address using free().
716 * @param[in] account The account handle
717 * @param[out] email_address The email address
719 * @return @c 0 on success,
720 * otherwise a negative error value
721 * @retval #ACCOUNT_ERROR_NONE Successful
722 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
723 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
725 * @see account_set_email_address()
727 int account_get_email_address(account_h account, char **email_address);
731 * @brief Sets the email address.
734 * @param[in] account The account handle
735 * @param[in] email_address The text string to set as the email address
737 * @return @c 0 on success,
738 * otherwise a negative error value
739 * @retval #ACCOUNT_ERROR_NONE Successful
740 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
742 * @see account_get_email_address()
744 int account_set_email_address(account_h account, const char *email_address);
748 * @brief Gets the package name.
751 * @remarks You must release @a package_name using free().
753 * @param[in] account The account handle
754 * @param[out] package_name The package name
756 * @return @c 0 on success,
757 * otherwise a negative error value
758 * @retval #ACCOUNT_ERROR_NONE Successful
759 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
760 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
762 * @see account_set_package_name()
764 int account_get_package_name(account_h account, char **package_name);
768 * @brief Sets the package name.
771 * @param[in] account The account handle
772 * @param[in] package_name The text string to set as the package name
774 * @return @c 0 on success,
775 * otherwise a negative error value
776 * @retval #ACCOUNT_ERROR_NONE Successful
777 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
779 * @see account_get_email_address()
781 int account_set_package_name(account_h account, const char *package_name);
785 * @brief Gets the access token. Access token field is used to store account secrets (such as password or master token).
788 * @remarks You must release @a access_token using free().
790 * @param[in] account The account handle
791 * @param[out] access_token The access token
793 * @return @c 0 on success,
794 * otherwise a negative error value
795 * @retval #ACCOUNT_ERROR_NONE Successful
796 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
797 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
799 * @remarks Access token field is used for storing account secret (password / master token etc)
800 * Only account owner application can retrieve account password / access_token. For others this field will be null.
801 * @see account_set_access_token()
803 int account_get_access_token(account_h account, char **access_token);
807 * @brief Sets the access token. Access token field is used to store account secrets (such as password or master token).
810 * @param[in] account The account handle
811 * @param[in] access_token The text string to set as the access token
813 * @return @c 0 on success,
814 * otherwise a negative error value
815 * @retval #ACCOUNT_ERROR_NONE Successful
816 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
817 * @remarks Only account owner application can retrieve account password / access_token. For others this field will be null.
818 * @see account_get_access_token()
820 int account_set_access_token(account_h account, const char *access_token);
824 * @brief Gets the user text.
827 * @remarks You must release @a user_text using free().
829 * @param[in] account The account handle
830 * @param[in] user_text_index The index of the user text (range: 0 ~ 4)
831 * @param[out] user_text The user text
833 * @return @c 0 on success,
834 * otherwise a negative error value
835 * @retval #ACCOUNT_ERROR_NONE Successful
836 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
837 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
839 * @see account_set_user_text()
841 int account_get_user_text(account_h account, int user_text_index, char **user_text);
845 * @brief Sets the user text.
848 * @param[in] account The account handle
849 * @param[in] user_text_index The index of the user text (must be in range from @c 0 to @c 4)
850 * @param[in] user_text The text string to set as the user text
852 * @return @c 0 on success,
853 * otherwise a negative error value
854 * @retval #ACCOUNT_ERROR_NONE Successful
855 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
857 * @see account_get_user_text()
859 int account_set_user_text(account_h account, int user_text_index, const char *user_text);
863 * @brief Gets the user integer.
866 * @param[in] account The account handle
867 * @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4)
868 * @param[out] user_integer The user integer
870 * @return @c 0 on success,
871 * otherwise a negative error value
872 * @retval #ACCOUNT_ERROR_NONE Successful
873 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
875 * @see account_set_user_int()
877 int account_get_user_int(account_h account, int user_int_index, int *user_integer);
881 * @brief Sets the user integer.
884 * @param[in] account The account handle
885 * @param[in] user_int_index The index of the user integer (must be in range from @c 0 to @c 4)
886 * @param[in] user_integer The integer to set as the user integer
888 * @return @c 0 on success,
889 * otherwise a negative error value
890 * @retval #ACCOUNT_ERROR_NONE Successful
891 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
893 * @see account_get_user_int()
895 int account_set_user_int(account_h account, int user_int_index, int user_integer);
899 * @brief Gets the auth type.
902 * @param[in] account The account handle
903 * @param[out] auth_type The auth type
905 * @return @c 0 on success,
906 * otherwise a negative error value
907 * @retval #ACCOUNT_ERROR_NONE Successful
908 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
910 * @see account_set_auth_type()
912 int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
916 * @brief Sets the auth type.
919 * @param[in] account The account handle
920 * @param[in] auth_type The integer to be set as the auth type
922 * @return @c 0 on success,
923 * otherwise a negative error value
924 * @retval #ACCOUNT_ERROR_NONE Successful
925 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
927 * @see account_get_auth_type()
929 int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
933 * @brief Gets the secret.
936 * @param[in] account The account handle
937 * @param[out] secret The secret
939 * @return @c 0 on success,
940 * otherwise a negative error value
941 * @retval #ACCOUNT_ERROR_NONE Successful
942 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
944 * @see account_set_secret()
946 int account_get_secret(account_h account, account_secrecy_state_e *secret);
950 * @brief Sets the secret.
953 * @param[in] account The account handle
954 * @param[in] secret The secrecy to be set
956 * @return @c 0 on success,
957 * otherwise a negative error value
958 * @retval #ACCOUNT_ERROR_NONE Successful
959 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
961 * @see account_get_secret()
963 int account_set_secret(account_h account, const account_secrecy_state_e secret);
966 * @brief Gets the sync support.
969 * @param[in] account The account handle
970 * @param[out] sync_support The sync support
972 * @return @c 0 on success,
973 * otherwise a negative error value
974 * @retval #ACCOUNT_ERROR_NONE Successful
975 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
977 * @see account_set_sync_support()
979 int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
983 * @brief Sets the sync support.
986 * @param[in] account The account handle
987 * @param[in] sync_support The sync state to be set
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
994 * @see account_get_sync_support()
996 int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
1000 * @brief Gets the source.
1003 * @remarks You must release @a user_text using free().
1005 * @param[in] account The account handle
1006 * @param[out] source The source
1008 * @return @c 0 on success,
1009 * otherwise a negative error value
1010 * @retval #ACCOUNT_ERROR_NONE Successful
1011 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1012 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
1014 * @see account_set_source()
1016 int account_get_source(account_h account, char **source);
1020 * @brief Sets the source.
1023 * @param[in] account The account handle
1024 * @param[in] source The text string to set as the source
1026 * @return @c 0 on success,
1027 * otherwise a negative error value
1028 * @retval #ACCOUNT_ERROR_NONE Successful
1029 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1031 * @see account_get_source()
1033 int account_set_source(account_h account, const char *source);
1036 * @brief Sets the custom.
1039 * @param[in] account The account handle
1040 * @param[in] key The user custom key for the specific value
1041 * @param[in] value The user custom value about the given key
1043 * @return @c 0 on success,
1044 * otherwise a negative error value
1045 * @retval #ACCOUNT_ERROR_NONE Successful
1046 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1048 * @see account_get_custom()
1050 int account_set_custom(account_h account, const char *key, const char *value);
1053 * @brief Gets the user specific custom text of an account key.
1056 * @param[in] account The account handle
1057 * @param[in] key The key to retrieve custom text
1058 * @param[out] value The text of the given key
1060 * @return @c 0 on success,
1061 * otherwise a negative error value
1062 * @retval #ACCOUNT_ERROR_NONE Successful
1063 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1064 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND There is no given capability type in the account
1066 * @see account_set_custom()
1068 int account_get_custom(account_h account, const char *key, char **value);
1072 * @brief Gets all the user custom texts of an account.
1075 * @param[in] account The account handle
1076 * @param[in] callback The callback function to retrieve all custom text \n
1077 * The callback function gives the key and value.
1078 * @param[in] user_data The user data to be passed to the callback function
1080 * @return @c 0 on success,
1081 * otherwise a negative error value
1082 * @retval #ACCOUNT_ERROR_NONE Successful
1083 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1085 * @see account_set_custom()
1087 int account_get_custom_all(account_h account, account_custom_cb callback, void *user_data);
1090 * @brief Retrieves all accounts details by invoking the given callback function iteratively.
1094 * @privilege %http://tizen.org/privilege/account.read
1095 * @param[in] callback The callback function to invoke
1096 * @param[in] user_data The user data to be passed to the callback function
1098 * @return @c 0 on success,
1099 * otherwise a negative error value
1100 * @retval #ACCOUNT_ERROR_NONE Successful
1101 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1102 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1103 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1104 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist
1105 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1106 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1108 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1109 * But the account_connect() is not required to use this function since tizen 2.4.
1110 * @post This function invokes account_cb().
1112 * @see account_query_account_by_account_id()
1113 * @see account_query_account_by_user_name()
1114 * @see account_query_account_by_package_name()
1115 * @see account_query_account_by_capability()
1117 int account_foreach_account_from_db(account_cb callback, void *user_data);
1121 * @brief Retrieve an account with the account ID.
1125 * @privilege %http://tizen.org/privilege/account.read
1126 * @param[in] account_db_id The account database ID to search
1127 * @param[out] account The account handle \n
1128 * Must be allocated by account_create() and freed after using by account_destroy().
1130 * @return @c 0 on success,
1131 * otherwise a negative error value
1132 * @retval #ACCOUNT_ERROR_NONE Successful
1133 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
1134 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1135 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1136 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1137 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1138 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1140 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1141 * But the account_connect() is not required to use this function since tizen 2.4.
1143 * @see account_query_account_by_user_name()
1144 * @see account_query_account_by_package_name()
1145 * @see account_query_account_by_capability()
1147 int account_query_account_by_account_id(int account_db_id, account_h *account);
1150 * @brief Retrieves all accounts with the user name.
1154 * @privilege %http://tizen.org/privilege/account.read
1155 * @param[in] callback The callback function to invoke
1156 * @param[in] user_name The user name to search
1157 * @param[in] user_data The user data to be passed to the callback function
1159 * @return @c 0 on success,
1160 * otherwise a negative error value
1161 * @retval #ACCOUNT_ERROR_NONE Successful
1162 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
1163 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1164 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1165 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1166 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1167 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1169 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1170 * But the account_connect() is not required to use this function since tizen 2.4.
1171 * @post This function invokes account_cb().
1173 * @see account_foreach_account_from_db()
1174 * @see account_query_account_by_account_id()
1175 * @see account_query_account_by_package_name()
1176 * @see account_query_account_by_capability()
1179 int account_query_account_by_user_name(account_cb callback, const char *user_name, void *user_data);
1182 * @brief Retrieves all accounts with the package name.
1186 * @privilege %http://tizen.org/privilege/account.read
1187 * @param[in] callback The callback function to invoke
1188 * @param[in] package_name The package name to search
1189 * @param[in] user_data The user data to be passed to the callback function
1191 * @return @c 0 on success,
1192 * otherwise a negative error value
1193 * @retval #ACCOUNT_ERROR_NONE Successful
1194 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
1195 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1196 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1197 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1198 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1199 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1201 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1202 * But the account_connect() is not required to use this function since tizen 2.4.
1203 * @post This function invokes account_cb().
1205 * @see account_foreach_account_from_db()
1206 * @see account_query_account_by_account_id()
1207 * @see account_query_account_by_user_name()
1208 * @see account_query_account_by_capability()
1210 int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
1213 * @brief Retrieves all accounts with the capability type and capability value.
1217 * @privilege %http://tizen.org/privilege/account.read
1218 * @param[in] callback The callback function to invoke
1219 * @param[in] capability_type The capability type to search
1220 * @param[in] capability_value The capability value to search
1221 * @param[in] user_data The user data to be passed to the callback function
1223 * @return @c 0 on success,
1224 * otherwise a negative error value
1225 * @retval #ACCOUNT_ERROR_NONE Successful
1226 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
1227 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1228 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1229 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1230 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1231 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1233 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1234 * But the account_connect() is not required to use this function since tizen 2.4.
1235 * @post This function invokes account_cb().
1237 * @see account_foreach_account_from_db()
1238 * @see account_query_account_by_account_id()
1239 * @see account_query_account_by_user_name()
1240 * @see account_query_account_by_package_name()
1242 int account_query_account_by_capability(account_cb callback, const char *capability_type, account_capability_state_e capability_value, void *user_data);
1245 * @brief Retrieves all accounts with the capability type.
1249 * @privilege %http://tizen.org/privilege/account.read
1250 * @param[in] callback The callback function to invoke
1251 * @param[in] capability_type The capability type to search
1252 * @param[in] user_data The user data to be passed to the callback function
1254 * @return @c 0 on success,
1255 * otherwise a negative error value
1256 * @retval #ACCOUNT_ERROR_NONE Successful
1257 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
1258 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1259 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1260 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1261 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1262 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1264 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1265 * But the account_connect() is not required to use this function since tizen 2.4.
1266 * @post This function invokes account_cb().
1268 * @see account_foreach_account_from_db()
1269 * @see account_query_account_by_account_id()
1270 * @see account_query_account_by_user_name()
1271 * @see account_query_account_by_package_name()
1273 int account_query_account_by_capability_type(account_cb callback, const char *capability_type, void *user_data);
1276 * @brief Retrieves all capabilities with the account database ID.
1280 * @privilege %http://tizen.org/privilege/account.read
1281 * @param[in] callback The callback function to invoke
1282 * @param[in] account_db_id The account database ID to search
1283 * @param[in] user_data The user data to be passed to the callback function
1285 * @return @c 0 on success,
1286 * otherwise a negative error value
1287 * @retval #ACCOUNT_ERROR_NONE Successful
1288 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
1289 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1290 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1291 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1292 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1293 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1295 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1296 * But the account_connect() is not required to use this function since tizen 2.4.
1297 * @post This function invokes capability_cb().
1299 * @see account_get_capability()
1300 * @see account_set_capability()
1302 int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
1306 * @brief Gets the count of accounts in the account database.
1310 * @privilege %http://tizen.org/privilege/account.read
1311 * @param[out] count The out parameter for count of all accounts
1313 * @return @c 0 on success,
1314 * otherwise a negative error value
1315 * @retval #ACCOUNT_ERROR_NONE Successful
1316 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1317 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1318 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1319 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1321 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1322 * But the account_connect() is not required to use this function since tizen 2.4.
1324 int account_get_total_count_from_db(int *count);
1327 * @brief Updates the sync status of an account with the given account ID.
1331 * @privilege %http://tizen.org/privilege/account.read \n
1332 * %http://tizen.org/privilege/account.write
1333 * @remarks This API need both privileges \n
1334 * Only can update an account which was added by same package applications
1335 * @param[in] account_db_id The account ID for which sync status needs to be changed
1336 * @param[in] sync_status The new sync status
1338 * @return @c 0 on success,
1339 * otherwise a negative error value
1340 * @retval #ACCOUNT_ERROR_NONE Successful
1341 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
1342 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1343 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1344 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1345 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1346 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1348 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1349 * But the account_connect() is not required to use this function since tizen 2.4.
1351 int account_update_sync_status_by_id(int account_db_id, const account_sync_state_e sync_status);
1354 /* Account type API */
1358 * @brief Creates a handle to the account provider.
1361 * @remarks You must release @a account_type handle using account_type_destroy().\n
1363 * @param[in] account_type The account provider handle
1365 * @return @c 0 on success,
1366 * otherwise a negative error value
1367 * @retval #ACCOUNT_ERROR_NONE Successful
1368 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
1369 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1371 * @see account_type_destroy()
1373 int account_type_create(account_type_h *account_type);
1376 * @brief Destroys the account provider handle and releases all its resources.
1380 * @remarks When you get @a account_type_h using account_type_create(), you must release the handle using account_destroy() to avoid the memory leak.
1382 * @param[in] account_type The account provider handle
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
1389 * @see account_type_create()
1391 int account_type_destroy(account_type_h account_type);
1394 * @brief Retrieves capability information with your application ID.
1398 * @privilege %http://tizen.org/privilege/account.read
1399 * @param[in] callback The callback function carries the capability name of an app ID
1400 * @param[in] app_id The application ID to search
1401 * @param[in] user_data The user data \n
1402 * If you have your private data to carry into callback function, then you can use it.
1404 * @return @c 0 on success,
1405 * otherwise a negative error value
1406 * @retval #ACCOUNT_ERROR_NONE Successful
1407 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1408 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1409 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1410 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1411 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1413 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1414 * But the account_connect() is not required to use this function since tizen 2.4.
1416 int account_type_query_provider_feature_by_app_id(provider_feature_cb callback, const char *app_id, void *user_data);
1419 * @brief Checks whether the given application ID supports the capability.
1423 * @privilege %http://tizen.org/privilege/account.read
1424 * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
1425 * @param[in] app_id The application ID
1426 * @param[in] capability The capability \n
1427 * For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
1429 * @return @c TRUE if the application supports the given capability, \n
1430 * otherwise @c FALSE if the application does not support the given capability
1431 * @retval @c TRUE means the application supports the given capability
1432 * @retval @c FALSE means the application does not support the given capability
1433 * @exception #ACCOUNT_ERROR_NONE Successful
1434 * @exception #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1435 * @exception #ACCOUNT_ERROR_RECORD_NOT_FOUND Related record does not exist
1436 * @exception #ACCOUNT_ERROR_DB_FAILED Database operation failed
1437 * @exception #ACCOUNT_ERROR_PERMISSION_DENIED DB access fail by permission
1438 * @exception #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1439 * @exception #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1441 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1442 * But the account_connect() is not required to use this function since tizen 2.4.
1444 bool account_type_query_supported_feature(const char *app_id, const char *capability);
1447 * @brief Gets the application ID of an account provider.
1450 * @remarks You must release @a app_id using free().
1452 * @param[in] account_type The account provider handle \n
1453 * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1454 * @param[out] app_id The application ID of an account provider item
1456 * @return @c 0 on success,
1457 * otherwise a negative error value
1458 * @retval #ACCOUNT_ERROR_NONE Successful
1459 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1460 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
1462 * @see account_type_foreach_account_type_from_db()
1463 * @see account_type_query_by_app_id()
1465 int account_type_get_app_id(account_type_h account_type, char **app_id);
1468 * @brief Gets the service provider ID of an account provider.
1471 * @remarks You must release @a service_provider_id using free().
1473 * @param[in] account_type The account provider handle \n
1474 * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1475 * @param[out] service_provider_id The service provider text ID of an account provider item
1477 * @return @c 0 on success,
1478 * otherwise a negative error value
1479 * @retval #ACCOUNT_ERROR_NONE Successful
1480 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1481 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
1483 * @see account_type_foreach_account_type_from_db()
1484 * @see account_type_query_by_app_id()
1486 int account_type_get_service_provider_id(account_type_h account_type, char **service_provider_id);
1489 * @brief Gets the icon path of an account provider.
1492 * @remarks You must release @a icon_path using free().
1494 * @param[in] account_type The account provider handle \n
1495 * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1496 * @param[out] icon_path The icon path of the account provider item
1498 * @return @c 0 on success,
1499 * otherwise a negative error value
1500 * @retval #ACCOUNT_ERROR_NONE Successful
1501 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1502 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
1504 * @see account_type_foreach_account_type_from_db()
1505 * @see account_type_query_by_app_id()
1507 int account_type_get_icon_path(account_type_h account_type, char **icon_path);
1510 * @brief Gets the small icon path of an account provider.
1513 * @remarks You must release @a small_icon_path using free().
1515 * @param[in] account_type The account provider handle\n
1516 * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1517 * @param[out] small_icon_path The small icon path of the account provider item
1519 * @return @c 0 on success,
1520 * otherwise a negative error value
1521 * @retval #ACCOUNT_ERROR_NONE Successful
1522 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1523 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
1525 * @see account_type_foreach_account_type_from_db()
1526 * @see account_type_query_by_app_id()
1528 int account_type_get_small_icon_path(account_type_h account_type, char **small_icon_path);
1531 * @brief Checks whether the given account provider supports multiple accounts.
1534 * @param[in] account_type The account provider handle \n
1535 * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db.
1536 * @param[out] multiple_account_support The flag indicating support for multiple accounts accounts\n
1539 * @return @c 0 on success,
1540 * otherwise a negative error value
1541 * @retval #ACCOUNT_ERROR_NONE Successful
1542 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1543 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
1545 * @see account_type_foreach_account_type_from_db()
1546 * @see account_type_query_by_app_id()
1548 int account_type_get_multiple_account_support(account_type_h account_type, int *multiple_account_support);
1551 * @brief Gets capability information with the given account provider handle.
1554 * @param[in] account_type The account provider handle\n
1555 * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1556 * @param[in] callback The callback function that carries the capability name of the app ID
1557 * @param[in] user_data The user data \n
1558 * If you have your private data to carry into callback function, then you can use it.
1560 * @return @c 0 on success,
1561 * otherwise a negative error value
1562 * @retval #ACCOUNT_ERROR_NONE Successful
1563 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1564 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1566 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1567 * But the account_connect() is not required to use this function since tizen 2.4.
1569 int account_type_get_provider_feature_all(account_type_h account_type, provider_feature_cb callback, void *user_data);
1572 * @brief Gets the specific label information detail of an account provider.
1575 * @param[in] account_type The account provider handle\n
1576 * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1577 * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
1578 * For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
1579 * @param[out] label The label text given for the locale
1581 * @return @c 0 on success,
1582 * otherwise a negative error value
1583 * @retval #ACCOUNT_ERROR_NONE Successful
1584 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND No label for the given locale
1585 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1587 * @see account_type_foreach_account_type_from_db()
1588 * @see account_type_query_by_app_id()
1591 int account_type_get_label_by_locale(account_type_h account_type, const char *locale, char **label);
1594 * @brief Gets the label information detail of an account provider.
1597 * @param[in] account_type The account provider handle\n
1598 * It should be given by account_type_query_* functions or account_type_foreach_account_type_from_db().
1599 * @param[in] callback The callback function carrying the label information
1600 * @param[in] user_data The user data to be passed to the callback function
1602 * @return @c 0 on success,
1603 * otherwise a negative error value
1604 * @retval #ACCOUNT_ERROR_NONE Successful
1605 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1607 * @see account_type_foreach_account_type_from_db()
1608 * @see account_type_query_by_app_id()
1610 int account_type_get_label(account_type_h account_type, account_label_cb callback, void *user_data);
1613 * @brief Retrieves the label information with your application ID.
1617 * @privilege %http://tizen.org/privilege/account.read
1618 * @param[in] callback The callback function that carries label_h for label information \n
1619 * label_h contains label info as parameter.
1620 * @param[in] app_id The application ID to search
1621 * @param[in] user_data The user data \n
1622 * If you have your private data to carry into callback function, then you can use it.
1624 * @return @c 0 on success,
1625 * otherwise a negative error value
1626 * @retval #ACCOUNT_ERROR_NONE Successful
1627 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1628 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1629 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1630 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1631 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1633 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1634 * But the account_connect() is not required to use this function since tizen 2.4.
1636 * @see account_type_query_by_app_id()
1637 * @see account_type_foreach_account_type_from_db()
1639 int account_type_query_label_by_app_id(account_label_cb callback, const char *app_id, void *user_data);
1642 * @brief Retrieves the account provider information with your application ID.
1646 * @privilege %http://tizen.org/privilege/account.read
1647 * @param[in] app_id The application ID to search
1648 * @param[inout] account_type The account handle which has to be created by account_type_create() before calling this function and released by account_type_destroy() after calling this function.
1650 * @return @c 0 on success,
1651 * otherwise a negative error value
1652 * @retval #ACCOUNT_ERROR_NONE Successful
1653 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1654 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1655 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Queried data does not exist
1656 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1657 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1658 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1660 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1661 * But the account_connect() is not required to use this function since tizen 2.4.
1663 * @see account_type_create()
1664 * @see account_type_get_app_id()
1665 * @see account_type_get_service_provider_id()
1666 * @see account_type_get_icon_path()
1667 * @see account_type_get_small_icon_path()
1668 * @see account_type_get_multiple_account_support()
1669 * @see account_type_get_label()
1670 * @see account_type_destroy()
1672 int account_type_query_by_app_id(const char *app_id, account_type_h *account_type);
1675 * @brief Retrieves all account priovider information.
1679 * @privilege %http://tizen.org/privilege/account.read
1680 * @param[in] callback The account provider information \n
1681 * You can get the account information through account_type_get_* with the carried account_type_handle.
1682 * @param[in] user_data The user data \n
1683 * It will be carried through your callback function.
1685 * @return @c 0 on success,
1686 * otherwise a negative error value
1687 * @retval #ACCOUNT_ERROR_NONE Successful
1688 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1689 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1690 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1691 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1692 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1694 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1695 * But the account_connect() is not required to use this function since tizen 2.4.
1697 * @see account_type_create()
1698 * @see account_type_get_app_id()
1699 * @see account_type_get_service_provider_id()
1700 * @see account_type_get_icon_path()
1701 * @see account_type_get_small_icon_path()
1702 * @see account_type_get_multiple_account_support()
1703 * @see account_type_get_label()
1704 * @see account_type_destroy()
1706 int account_type_foreach_account_type_from_db(account_type_cb callback, void *user_data);
1709 * @brief Retrieves the label information with the given application ID and locale.
1713 * @privilege %http://tizen.org/privilege/account.read
1714 * @param[in] app_id The application ID
1715 * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
1716 * For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English.
1717 * @param[out] label The label text corresponding app_id and locale \n
1718 * It must be free text.
1720 * @return @c 0 on success,
1721 * otherwise a negative error value
1722 * @retval #ACCOUNT_ERROR_NONE Successful
1723 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1724 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1725 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1726 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1727 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1729 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1730 * But the account_connect() is not required to use this function since tizen 2.4.
1732 int account_type_query_label_by_locale(const char *app_id, const char *locale, char **label);
1735 * @brief Retrieves account provider information with the capability name.
1739 * @privilege %http://tizen.org/privilege/account.read
1740 * @param[in] callback The callback function to retrieve account provider information
1741 * @param[in] key The capability value to search account provider \n
1742 * For example, ACCOUNT_SUPPORTS_CAPABILITY_CONTACT or "http://tizen.org/account/capability/contact"
1743 * @param[in] user_data If you have your private data to carry into callback function, then you can use it
1745 * @return @c 0 on success,
1746 * otherwise a negative error value
1747 * @retval #ACCOUNT_ERROR_NONE Successful
1748 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found
1749 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1750 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1751 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1752 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1753 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1755 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1756 * But the account_connect() is not required to use this function since tizen 2.4.
1758 int account_type_query_by_provider_feature(account_type_cb callback, const char *key, void *user_data);
1761 * @brief Checks whether the given app_id exists in the account provider DB.
1765 * @privilege %http://tizen.org/privilege/account.read
1766 * @param[in] app_id The application ID to check
1768 * @return @c 0 on success,
1769 * otherwise a negative error value
1770 * @retval #ACCOUNT_ERROR_NONE Successful
1771 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND Record not found
1772 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid app ID
1773 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
1774 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
1775 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
1776 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
1778 * @pre This function requires an open connection to an account service by account_connect() on tizen 2.3.\n
1779 * But the account_connect() is not required to use this function since tizen 2.4.
1781 * @see account_type_query_by_app_id()
1783 int account_type_query_app_id_exist(const char *app_id);
1787 /* End of account provider API */
1790 * @brief Creates a handle for the account event subscription.
1793 * @remarks You must release @a account_subscribe handle using account_unsubscribe_notification().
1795 * @param[in] account_subscribe The account subscription handle
1797 * @return @c 0 on success,
1798 * otherwise a negative error value
1799 * @retval #ACCOUNT_ERROR_NONE Successful
1800 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
1801 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1803 * @see account_unsubscribe_notification()
1804 * @see account_subscribe_notification()
1806 int account_subscribe_create(account_subscribe_h *account_subscribe);
1809 * @brief Starts to subscribe account event through the given callback function.
1813 * @privilege %http://tizen.org/privilege/account.read \n
1814 * @param[in] account_subscribe The account subscription handle
1815 * @param[in] callback The callback function that is called when an account is removed and a data of account is updated from the account database \n
1816 * It will be called with event message and account ID.
1817 * @param[in] user_data The user_data that is delivered to callback
1819 * @return @c 0 on success,
1820 * otherwise a negative error value
1821 * @retval #ACCOUNT_ERROR_NONE Successful
1822 * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Subscription fail
1823 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1825 * @pre account_subscribe_create()
1827 * @see account_unsubscribe_notification()
1828 * @see account_subscribe_notification()
1830 int account_subscribe_notification(account_subscribe_h account_subscribe, account_event_cb callback, void *user_data);
1833 * @brief Destroys the account subscribe handle and releases all its resources.
1837 * @privilege %http://tizen.org/privilege/account.read \n
1838 * @remarks You must call @a account_unsubscribe_notification when you do not need to subscribe account event.
1840 * @param[in] account_subscribe The account subscription handle
1842 * @return @c 0 on success,
1843 * otherwise a negative error value
1844 * @retval #ACCOUNT_ERROR_NONE Successful
1845 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
1846 * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Unsubscription failed
1848 * @see account_create()
1850 int account_unsubscribe_notification(account_subscribe_h account_subscribe);
1853 /* End of Account APIs */
1864 #endif /* __ACCOUNT_H__ */