4 * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Tarun Kumar <tarun.kr@samsung.com>, Sukumar Moharana <msukumar@samsung.com>, Wonyoung Lee <wy1115.lee@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);
679 * @brief Gets the source.
681 * @remarks @a user_text must be released with free() by you.
683 * @param[in] account The account handle
684 * @param[out] source The source
686 * @return 0 on success, otherwise a negative error value.
687 * @retval #ACCOUNT_ERROR_NONE Successful
688 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
689 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
691 * @see account_set_source()
693 int account_get_source(account_h account, char **source);
697 * @brief Sets the source.
699 * @param[in] account The account handle
700 * @param[in] source The text string to set as a source
702 * @return 0 on success, otherwise a negative error value.
703 * @retval #ACCOUNT_ERROR_NONE Successful
704 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
706 * @see account_get_source()
708 int account_set_source(account_h account, const char *source);
712 * @brief Retrieves all accounts details by invoking the given callback function iteratively.
714 * @param[in] callback The callback function to invoke
715 * @param[in] user_data The user data to be passed to the callback function
717 * @return 0 on success, otherwise a negative error value.
718 * @retval #ACCOUNT_ERROR_NONE Successful
719 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
720 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
722 * @pre This function requires an open connection to account service by account_connect().
723 * @post This function invokes account_cb().
725 * @see account_connect()
726 * @see account_query_account_by_account_id()
727 * @see account_query_account_by_user_name()
728 * @see account_query_account_by_package_name()
729 * @see account_query_account_by_capability()
731 int account_foreach_account_from_db(account_cb callback, void *user_data);
735 * @brief Retrieves all accounts with the account database ID.
737 * @param[in] account_db_id The account database ID to search
738 * @param[out] account account handle
740 * @return 0 on success, otherwise a negative error value.
741 * @retval #ACCOUNT_ERROR_NONE Successful
742 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
743 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
745 * @pre This function requires an open connection to account service by account_connect().
746 * @post This function invokes account_cb().
748 * @see account_connect()
749 * @see account_query_account_by_account_id()
750 * @see account_query_account_by_user_name()
751 * @see account_query_account_by_package_name()
752 * @see account_query_account_by_capability()
754 int account_query_account_by_account_id(int account_db_id, account_h *account);
757 * @brief Retrieves all accounts with the user name.
759 * @param[in] callback The callback function to invoke
760 * @param[in] user_name The user name to search
761 * @param[in] user_data The user data to be passed to the callback function
763 * @return 0 on success, otherwise a negative error value.
764 * @retval #ACCOUNT_ERROR_NONE Successful
765 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
766 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
768 * @pre This function requires an open connection to account service by account_connect().
769 * @post This function invokes account_cb().
771 * @see account_connect()
772 * @see account_foreach_account_from_db()
773 * @see account_query_account_by_account_id()
774 * @see account_query_account_by_package_name()
775 * @see account_query_account_by_capability()
778 int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data);
781 * @brief Retrieves all accounts with the package name.
783 * @param[in] callback The callback function to invoke
784 * @param[in] package_name The package name to search
785 * @param[in] user_data The user data to be passed to the callback function
787 * @return 0 on success, otherwise a negative error value.
788 * @retval #ACCOUNT_ERROR_NONE Successful
789 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
790 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
792 * @pre This function requires an open connection to account service by account_connect().
793 * @post This function invokes account_cb().
795 * @see account_connect()
796 * @see account_foreach_account_from_db()
797 * @see account_query_account_by_account_id()
798 * @see account_query_account_by_user_name()
799 * @see account_query_account_by_capability()
801 int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
804 * @brief Retrieves all accounts with the capability.
806 * @param[in] callback The callback function to invoke
807 * @param[in] capability_type The capablity type to search
808 * @param[in] capability_value The capablity value to search
809 * @param[in] user_data The user data to be passed to the callback function
811 * @return 0 on success, otherwise a negative error value.
812 * @retval #ACCOUNT_ERROR_NONE Successful
813 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
814 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
816 * @pre This function requires an open connection to account service by account_connect().
817 * @post This function invokes account_cb().
819 * @see account_connect()
820 * @see account_foreach_account_from_db()
821 * @see account_query_account_by_account_id()
822 * @see account_query_account_by_user_name()
823 * @see account_query_account_by_package_name()
825 int account_query_account_by_capability(account_cb callback, account_capability_type_e capability_type, account_capability_state_e capability_value, void *user_data);
828 * @brief Retrieves all capabilities with the account database ID.
830 * @param[in] callback The callback function to invoke
831 * @param[in] account_db_id The account database ID to search
832 * @param[in] user_data The user data to be passed to the callback function
834 * @return 0 on success, otherwise a negative error value.
835 * @retval #ACCOUNT_ERROR_NONE Successful
836 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
837 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
839 * @pre This function requires an open connection to account service by account_connect().
840 * @post This function invokes capability_cb().
842 * @see account_connect()
843 * @see account_get_capability()
844 * @see account_set_capability()
846 int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
850 * @brief Retrieves number of account in the account database.
852 * @param[out] out parameter for number of all accounts
854 * @return 0 on success, otherwise a negative error value.
855 * @retval #ACCOUNT_ERROR_NONE Successful
856 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
858 * @pre This function requires an open connection to account service by account_connect().
860 * @see account_connect()
862 int account_get_total_count_from_db(int *count);
874 #endif /* __ACCOUNT_H__ */