4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Tarun Kumar <tarun.kr@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
28 #include <account-types.h>
29 #include <account-error.h>
38 * @brief This file contains the Account API for account management
42 * @addtogroup CAPI_SOCIAL_ACCOUNT_MODULE
47 * @brief Called once for each account from database
49 * @param[in] account The account handle
50 * @param[in] user_data The user data passed from the foreach function
52 * @return @c true to continue with the next iteration of the loop or @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() invoke this callback.
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);
65 * @brief Called once for each capability of account from 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 or @c false to break out of the loop.
73 * @pre account_query_capability_by_account_id() invokes this callback.
75 * @see account_query_capability_by_account_id()
77 typedef bool (*capability_cb)(account_capability_type_e capability_type, account_capability_state_e capability_state, void *user_data);
81 * @brief Connects to the account database.
83 * @return 0 on success, otherwise a negative error value.
84 * @retval #ACCOUNT_ERROR_NONE Successful
85 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
87 * @see account_disconnect()
89 int account_connect(void);
93 * @brief Disconnects from account database.
95 * @return 0 on success, otherwise a negative error value.
96 * @retval #ACCOUNT_ERROR_NONE Successful
97 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
99 * @see account_connect()
101 int account_disconnect(void);
105 * @brief Creates a handle to the account.
107 * @remarks @a account must be released with account_destroy() by you. \n
108 * The created handle is not added to the account database until account_insert_to_db() is called.
110 * @param[in] account The account handle
112 * @return 0 on success, otherwise a negative error value.
113 * @retval #ACCOUNT_ERROR_NONE Successful
114 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
115 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
117 * @see account_destroy()
119 int account_create(account_h *account);
123 * @brief Destroys the account handle and releases all its resources.
125 * @param[in] account The account handle
127 * @return 0 on success, otherwise a negative error value.
128 * @retval #ACCOUNT_ERROR_NONE Successful
129 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
131 * @see account_create()
133 int account_destroy(account_h account);
137 * @brief Inserts the account details to the account database.
139 * @param[in] account The account handle
140 * @param[out] account_db_id The account ID to be assigned to a account
142 * @return 0 on success, otherwise a negative error value.
143 * @retval #ACCOUNT_ERROR_NONE Successful
144 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
145 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
147 * @pre This function requires an open connection to account service by account_connect().
149 * @see account_connect()
150 * @see account_delete_from_db_by_id()
151 * @see account_delete_from_db_by_user_name()
152 * @see account_delete_from_db_by_package_name()
153 * @see account_update_to_db_by_id()
154 * @see account_update_to_db_by_user_name()
156 int account_insert_to_db(account_h account, int *account_db_id);
160 * @brief Deletes the account from the account database by accound DB ID.
162 * @param[in] account_db_id The account ID to delete
164 * @return 0 on success, otherwise a negative error value.
165 * @retval #ACCOUNT_ERROR_NONE Successful
166 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
167 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
169 * @pre This function requires an open connection to account service by account_connect()
171 * @see account_connect()
172 * @see account_insert_to_db()
173 * @see account_delete_from_db_by_user_name()
174 * @see account_delete_from_db_by_package_name()
175 * @see account_update_to_db_by_id()
176 * @see account_update_to_db_by_user_name()
178 int account_delete_from_db_by_id(int account_db_id);
182 * @brief Deletes the account from the account database by user name.
184 * @param[in] user_name The user name of account to delete
185 * @param[in] package_name The package name of account to delete
187 * @return 0 on success, otherwise a negative error value.
188 * @retval #ACCOUNT_ERROR_NONE Successful
189 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
190 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
192 * @pre This function requires an open connection to account service by account_connect()
194 * @see account_connect()
195 * @see account_insert_to_db()
196 * @see account_delete_from_db_by_id()
197 * @see account_delete_from_db_by_package_name()
198 * @see account_update_to_db_by_id()
199 * @see account_update_to_db_by_user_name()
201 int account_delete_from_db_by_user_name(char *user_name, char *package_name);
205 * @brief Deletes the account from the account database by package name.
207 * @param[in] package_name The package name of account(s) to delete
209 * @return 0 on success, otherwise a negative error value.
210 * @retval #ACCOUNT_ERROR_NONE Successful
211 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
212 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
214 * @pre This function requires an open connection to account service by account_connect()
216 * @see account_connect()
217 * @see account_insert_to_db()
218 * @see account_delete_from_db_by_id()
219 * @see account_delete_from_db_by_user_name()
220 * @see account_update_to_db_by_id()
221 * @see account_update_to_db_by_user_name()
223 int account_delete_from_db_by_package_name(char *package_name);
227 * @brief Updates the account details to the account database.
229 * @param[in] account The account handle
230 * @param[in] account_id The account ID to update
232 * @return 0 on success, otherwise a negative error value.
233 * @retval #ACCOUNT_ERROR_NONE Successful
234 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
235 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
237 * @pre This function requires an open connection to account service by account_connect()
239 * @see account_connect()
240 * @see account_insert_to_db()
241 * @see account_delete_from_db_by_id()
242 * @see account_delete_from_db_by_user_name()
243 * @see account_delete_from_db_by_package_name()
244 * @see account_update_to_db_by_user_name()
246 int account_update_to_db_by_id(account_h account, int account_id);
250 * @brief Updates the account details to the account database.
252 * @param[in] account The account handle
253 * @param[in] user_name The user name of account to update
254 * @param[in] package_name The package name for the user name
256 * @return 0 on success, otherwise a negative error value.
257 * @retval #ACCOUNT_ERROR_NONE Successful
258 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
259 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
261 * @pre This function requires an open connection to account service by account_connect()
263 * @see account_connect()
264 * @see account_insert_to_db()
265 * @see account_delete_from_db_by_id()
266 * @see account_delete_from_db_by_user_name()
267 * @see account_delete_from_db_by_package_name()
268 * @see account_update_to_db_by_id()
271 int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
274 * @brief Gets the account id of account.
277 * @param[in] account The account handle
278 * @param[out] account_id The account id of account
280 * @return 0 on success, otherwise a negative error value.
281 * @retval #ACCOUNT_ERROR_NONE Successful
282 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
285 int account_get_account_id(account_h account, int *account_id);
289 * @brief Gets the user name of account.
291 * @remarks @a user_name must be released with free() by you.
293 * @param[in] account The account handle
294 * @param[out] user_name The user name of account
296 * @return 0 on success, otherwise a negative error value.
297 * @retval #ACCOUNT_ERROR_NONE Successful
298 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
299 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
301 * @see account_set_user_name()
303 int account_get_user_name(account_h account, char **user_name);
307 * @brief Sets the user name of account.
309 * @param[in] account The account handle
310 * @param[in] user_name The string to set as user name
312 * @return 0 on success, otherwise a negative error value.
313 * @retval #ACCOUNT_ERROR_NONE Successful
314 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
316 * @see account_get_user_name()
318 int account_set_user_name(account_h account, const char *user_name);
322 * @brief Gets the display name of account.
324 * @remarks @a display_name must be released with free() by you.
326 * @param[in] account The account handle
327 * @param[out] display_name The display name of account
329 * @return 0 on success, otherwise a negative error value.
330 * @retval #ACCOUNT_ERROR_NONE Successful
331 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
332 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
334 * @see account_get_display_name()
336 int account_get_display_name(account_h account, char **display_name);
340 * @brief Sets the display name of account.
342 * @param[in] account The account handle
343 * @param[in] display_name The text string to set as the display name
345 * @return 0 on success, otherwise a negative error value.
346 * @retval #ACCOUNT_ERROR_NONE Successful
347 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
349 * @see account_get_display_name()
351 int account_set_display_name(account_h account, const char *display_name);
355 * @brief Gets the capability detail of account.
357 * @param[in] account The account handle
358 * @param[in] callback The callback function
359 * @param[in] user_data The user data to be passed to the callback function
361 * @return 0 on success, otherwise a negative error value.
362 * @retval #ACCOUNT_ERROR_NONE Successful
363 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
365 * @see account_set_capability()
367 int account_get_capability(account_h account, capability_cb cb_func, void *user_data);
371 * @brief Sets the capability.
373 * @param[in] account The account handle
374 * @param[in] capability_type The capability type
375 * @param[in] capability_state The capability state
377 * @return 0 on success, otherwise a negative error value.
378 * @retval #ACCOUNT_ERROR_NONE Successful
379 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
381 * @see account_get_capability()
383 int account_set_capability(account_h account, account_capability_type_e capability_type, account_capability_state_e capability_state);
387 * @brief Gets the icon path.
389 * @remarks @a icon_path must be released with free() by you.
391 * @param[in] account The account handle
392 * @param[out] icon_path The icon path
394 * @return 0 on success, otherwise a negative error value.
395 * @retval #ACCOUNT_ERROR_NONE Successful
396 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
397 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
399 * @see account_set_icon_path()
401 int account_get_icon_path(account_h account, char **icon_path);
405 * @brief Sets the icon path.
407 * @param[in] account The account handle
408 * @param[in] icon_path The text string to set as a icon path
410 * @return 0 on success, otherwise a negative error value.
411 * @retval #ACCOUNT_ERROR_NONE Successful
412 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
414 * @see account_get_icon_path()
416 int account_set_icon_path(account_h account, const char *icon_path);
420 * @brief Gets the domain name.
422 * @remarks @a domain_name must be released with free() by you.
424 * @param[in] account The account handle
425 * @param[out] domain_name The domain name
427 * @return 0 on success, otherwise a negative error value.
428 * @retval #ACCOUNT_ERROR_NONE Successful
429 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
430 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
432 * @see account_set_domain_name()
434 int account_get_domain_name(account_h account, char **domain_name);
438 * @brief Sets the domain name.
440 * @param[in] account The account handle
441 * @param[in] domain_name The text string to set as a domain name
443 * @return 0 on success, otherwise a negative error value.
444 * @retval #ACCOUNT_ERROR_NONE Successful
445 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
447 * @see account_get_domain_name()
449 int account_set_domain_name(account_h account, const char *domain_name);
453 * @brief Gets the email address.
455 * @remarks @a email_address must be released with free() by you.
457 * @param[in] account The account handle
458 * @param[out] email_address The email address
460 * @return 0 on success, otherwise a negative error value.
461 * @retval #ACCOUNT_ERROR_NONE Successful
462 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
463 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
465 * @see account_set_email_address()
467 int account_get_email_address(account_h account, char **email_address);
471 * @brief Sets the email address.
473 * @param[in] account The account handle
474 * @param[in] email_address The text string to set as a email address
476 * @return 0 on success, otherwise a negative error value.
477 * @retval #ACCOUNT_ERROR_NONE Successful
478 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
480 * @see account_get_email_addres()
482 int account_set_email_address(account_h account, const char *email_address);
486 * @brief Gets the package name.
488 * @remarks @a package_name must be released with free() by you.
490 * @param[in] account The account handle
491 * @param[out] package_name The package name
493 * @return 0 on success, otherwise a negative error value.
494 * @retval #ACCOUNT_ERROR_NONE Successful
495 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
496 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
498 * @see account_set_package_name()
500 int account_get_package_name(account_h account, char **package_name);
504 * @brief Sets the package name.
506 * @param[in] account The account handle
507 * @param[in] package_name The text string to set as a package name
509 * @return 0 on success, otherwise a negative error value.
510 * @retval #ACCOUNT_ERROR_NONE Successful
511 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
513 * @see account_get_email_addres()
515 int account_set_package_name(account_h account, const char *package_name);
519 * @brief Gets the access token.
521 * @remarks @a access_token must be released with free() by you.
523 * @param[in] account The account handle
524 * @param[out] access_token The access token
526 * @return 0 on success, otherwise a negative error value.
527 * @retval #ACCOUNT_ERROR_NONE Successful
528 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
529 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
531 * @see account_set_access_token()
533 int account_get_access_token(account_h account, char **access_token);
537 * @brief Set the access token.
539 * @param[in] account The account handle
540 * @param[in] access_token The text string to set as a access token
542 * @return 0 on success, otherwise a negative error value.
543 * @retval #ACCOUNT_ERROR_NONE Successful
544 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
546 * @see account_get_access_token()
548 int account_set_access_token(account_h account, const char *access_token);
552 * @brief Gets the user text.
554 * @remarks @a user_text must be released with free() by you.
556 * @param[in] account The account handle
557 * @param[in] user_text_index The index of the user text (range: 0 ~ 4)
558 * @param[out] user_text The user text
560 * @return 0 on success, otherwise a negative error value.
561 * @retval #ACCOUNT_ERROR_NONE Successful
562 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
563 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
565 * @see account_set_user_text()
567 int account_get_user_text(account_h account, int user_text_index, char **user_text);
571 * @brief Sets the user text.
573 * @param[in] account The account handle
574 * @param[in] user_text_index The index of the user text (must be in range from 0 to 4)
575 * @param[in] user_text The text string to set as a user txt
577 * @return 0 on success, otherwise a negative error value.
578 * @retval #ACCOUNT_ERROR_NONE Successful
579 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
581 * @see account_get_user_text()
583 int account_set_user_text(account_h account, int user_text_index, const char *user_text);
587 * @brief Gets the user integer.
589 * @param[in] account The account handle
590 * @param[in] user_int_index The index of the user integer (must be in range from 0 to 4)
591 * @param[out] user_integer The user interger
593 * @return 0 on success, otherwise a negative error value.
594 * @retval #ACCOUNT_ERROR_NONE Successful
595 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
597 * @see account_set_user_int()
599 int account_get_user_int(account_h account, int user_int_index, int *user_integer);
603 * @brief Set the user integer.
605 * @param[in] account The account handle
606 * @param[in] user_int_index The index of the user integer (must be in range from 0 to 4)
607 * @param[in] user_integer The integer to set as user integer
609 * @return 0 on success, otherwise a negative error value.
610 * @retval #ACCOUNT_ERROR_NONE Successful
611 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
613 * @see account_get_user_int()
615 int account_set_user_int(account_h account, int user_int_index, int user_integer);
619 * @brief Gets the auth type.
621 * @param[in] account The account handle
622 * @param[out] auth_type The auth type
624 * @return 0 on success, otherwise a negative error value.
625 * @retval #ACCOUNT_ERROR_NONE Successful
626 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
628 * @see account_set_auth_type()
630 int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
634 * @brief Sets the auth type.
636 * @param[in] account The account handle
637 * @param[in] auth_type Integer to be set as auth type
639 * @return 0 on success, otherwise a negative error value.
640 * @retval #ACCOUNT_ERROR_NONE Successful
641 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
643 * @see account_get_auth_type()
645 int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
649 * @brief Gets the secret.
651 * @param[in] account The account handle
652 * @param[out] secret The secret
654 * @return 0 on success, otherwise a negative error value.
655 * @retval #ACCOUNT_ERROR_NONE Successful
656 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
658 * @see account_set_secret()
660 int account_get_secret(account_h account, account_secrecy_state_e *secret);
664 * @brief Sets the secret.
666 * @param[in] account The account handle
667 * @param[in] secret Secrecy to be set
669 * @return 0 on success, otherwise a negative error value.
670 * @retval #ACCOUNT_ERROR_NONE Successful
671 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
673 * @see account_get_secret()
675 int account_set_secret(account_h account, const account_secrecy_state_e secret);
678 * @brief Gets the sync support.
680 * @param[in] account The account handle
681 * @param[out] sync_support The sync support
683 * @return 0 on success, otherwise a negative error value.
684 * @retval #ACCOUNT_ERROR_NONE Successful
685 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
687 * @see account_set_sync_support()
689 int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
693 * @brief Sets the sync support.
695 * @param[in] account The account handle
696 * @param[in] sync_support sync state to be set
698 * @return 0 on success, otherwise a negative error value.
699 * @retval #ACCOUNT_ERROR_NONE Successful
700 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
702 * @see account_get_sync_support()
704 int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
708 * @brief Gets the source.
710 * @remarks @a user_text must be released with free() by you.
712 * @param[in] account The account handle
713 * @param[out] source The source
715 * @return 0 on success, otherwise a negative error value.
716 * @retval #ACCOUNT_ERROR_NONE Successful
717 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
718 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
720 * @see account_set_source()
722 int account_get_source(account_h account, char **source);
726 * @brief Sets the source.
728 * @param[in] account The account handle
729 * @param[in] source The text string to set as a source
731 * @return 0 on success, otherwise a negative error value.
732 * @retval #ACCOUNT_ERROR_NONE Successful
733 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
735 * @see account_get_source()
737 int account_set_source(account_h account, const char *source);
741 * @brief Retrieves all accounts details by invoking the given callback function iteratively.
743 * @param[in] callback The callback function to invoke
744 * @param[in] user_data The user data to be passed to the callback function
746 * @return 0 on success, otherwise a negative error value.
747 * @retval #ACCOUNT_ERROR_NONE Successful
748 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
749 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
751 * @pre This function requires an open connection to account service by account_connect().
752 * @post This function invokes account_cb().
754 * @see account_connect()
755 * @see account_query_account_by_account_id()
756 * @see account_query_account_by_user_name()
757 * @see account_query_account_by_package_name()
758 * @see account_query_account_by_capability()
760 int account_foreach_account_from_db(account_cb callback, void *user_data);
764 * @brief Retrieves all accounts with the account database ID.
766 * @param[in] account_db_id The account database ID to search
767 * @param[out] account account handle
769 * @return 0 on success, otherwise a negative error value.
770 * @retval #ACCOUNT_ERROR_NONE Successful
771 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
772 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
774 * @pre This function requires an open connection to account service by account_connect().
775 * @post This function invokes account_cb().
777 * @see account_connect()
778 * @see account_query_account_by_account_id()
779 * @see account_query_account_by_user_name()
780 * @see account_query_account_by_package_name()
781 * @see account_query_account_by_capability()
783 int account_query_account_by_account_id(int account_db_id, account_h *account);
786 * @brief Retrieves all accounts with the user name.
788 * @param[in] callback The callback function to invoke
789 * @param[in] user_name The user name to search
790 * @param[in] user_data The user data to be passed to the callback function
792 * @return 0 on success, otherwise a negative error value.
793 * @retval #ACCOUNT_ERROR_NONE Successful
794 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
795 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
797 * @pre This function requires an open connection to account service by account_connect().
798 * @post This function invokes account_cb().
800 * @see account_connect()
801 * @see account_foreach_account_from_db()
802 * @see account_query_account_by_account_id()
803 * @see account_query_account_by_package_name()
804 * @see account_query_account_by_capability()
807 int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data);
810 * @brief Retrieves all accounts with the package name.
812 * @param[in] callback The callback function to invoke
813 * @param[in] package_name The package name to search
814 * @param[in] user_data The user data to be passed to the callback function
816 * @return 0 on success, otherwise a negative error value.
817 * @retval #ACCOUNT_ERROR_NONE Successful
818 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
819 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
821 * @pre This function requires an open connection to account service by account_connect().
822 * @post This function invokes account_cb().
824 * @see account_connect()
825 * @see account_foreach_account_from_db()
826 * @see account_query_account_by_account_id()
827 * @see account_query_account_by_user_name()
828 * @see account_query_account_by_capability()
830 int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
833 * @brief Retrieves all accounts with the capability.
835 * @param[in] callback The callback function to invoke
836 * @param[in] capability_type The capablity type to search
837 * @param[in] capability_value The capablity value to search
838 * @param[in] user_data The user data to be passed to the callback function
840 * @return 0 on success, otherwise a negative error value.
841 * @retval #ACCOUNT_ERROR_NONE Successful
842 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
843 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
845 * @pre This function requires an open connection to account service by account_connect().
846 * @post This function invokes account_cb().
848 * @see account_connect()
849 * @see account_foreach_account_from_db()
850 * @see account_query_account_by_account_id()
851 * @see account_query_account_by_user_name()
852 * @see account_query_account_by_package_name()
854 int account_query_account_by_capability(account_cb callback, account_capability_type_e capability_type, account_capability_state_e capability_value, void *user_data);
857 * @brief Retrieves all capabilities with the account database ID.
859 * @param[in] callback The callback function to invoke
860 * @param[in] account_db_id The account database ID to search
861 * @param[in] user_data The user data to be passed to the callback function
863 * @return 0 on success, otherwise a negative error value.
864 * @retval #ACCOUNT_ERROR_NONE Successful
865 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
866 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
868 * @pre This function requires an open connection to account service by account_connect().
869 * @post This function invokes capability_cb().
871 * @see account_connect()
872 * @see account_get_capability()
873 * @see account_set_capability()
875 int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
879 * @brief Retrieves number of account in the account database.
881 * @param[out] out parameter for number of all accounts
883 * @return 0 on success, otherwise a negative error value.
884 * @retval #ACCOUNT_ERROR_NONE Successful
885 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
887 * @pre This function requires an open connection to account service by account_connect().
889 * @see account_connect()
891 int account_get_total_count_from_db(int *count);
903 #endif /* __ACCOUNT_H__ */