Adding packaging changes file
[profile/ivi/libaccounts-svc.git] / include / account.h
1 /*
2  *  account
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Tarun Kumar <tarun.kr@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21
22 #ifndef __ACCOUNT_H__
23 #define __ACCOUNT_H__
24
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <glib.h>
28 #include <account-types.h>
29 #include <account-error.h>
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35
36 /**
37  * @file        account.h
38  * @brief       This file contains the Account API for account management
39  */
40
41 /**
42  * @addtogroup CAPI_SOCIAL_ACCOUNT_MODULE
43  * @{
44  */
45
46 /**
47  * @brief       Called once for each account from database
48  *
49  * @param[in]   account The account handle
50  * @param[in]   user_data The user data passed from the foreach function
51  *
52  * @return @c true to continue with the next iteration of the loop or @c false to break out of the loop.
53  *
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.
55  *
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()
60  */
61 typedef bool (*account_cb)(account_h account, void *user_data);
62
63
64 /**
65  * @brief       Called once for each capability of account from database
66  *
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
70  *
71  * @return @c true to continue with the next iteration of the loop or @c false to break out of the loop.
72  *
73  * @pre account_query_capability_by_account_id() invokes this callback.
74  *
75  * @see account_query_capability_by_account_id()
76  */
77 typedef bool (*capability_cb)(account_capability_type_e capability_type, account_capability_state_e capability_state, void *user_data);
78
79
80 /**
81  * @brief       Connects to the account database.
82  *
83  * @return      0 on success, otherwise a negative error value.
84  * @retval      #ACCOUNT_ERROR_NONE Successful
85  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
86  *
87  * @see account_disconnect()
88  */
89 int account_connect(void);
90
91
92 /**
93  * @brief       Disconnects from account database.
94  *
95  * @return      0 on success, otherwise a negative error value.
96  * @retval      #ACCOUNT_ERROR_NONE Successful
97  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
98  *
99  * @see account_connect()
100  */
101 int account_disconnect(void);
102
103
104 /**
105  * @brief       Creates a handle to the account.
106  *
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.
109  *
110  * @param[in]   account The account handle
111  *
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
116  *
117  * @see account_destroy()
118  */
119 int account_create(account_h *account);
120
121
122 /**
123  * @brief       Destroys the account handle and releases all its resources.
124  *
125  * @param[in]   account The account handle
126  *
127  * @return      0 on success, otherwise a negative error value.
128  * @retval      #ACCOUNT_ERROR_NONE     Successful
129  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
130  *
131  * @see account_create()
132  */
133 int account_destroy(account_h account);
134
135
136 /**
137  * @brief       Inserts the account details to the account database.
138  *
139  * @param[in]   account The account handle
140  * @param[out]  account_db_id The account ID to be assigned to a account
141  *
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
146  *
147  * @pre This function requires an open connection to account service by account_connect().
148  *
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()
155  */
156 int account_insert_to_db(account_h account, int *account_db_id);
157
158
159 /**
160  * @brief       Deletes the account from the account database by accound DB ID.
161  *
162  * @param[in]   account_db_id The account ID to delete
163  *
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
168  *
169  * @pre This function requires an open connection to account service by account_connect()
170  *
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()
177  */
178 int account_delete_from_db_by_id(int account_db_id);
179
180
181 /**
182  * @brief       Deletes the account from the account database by user name.
183  *
184  * @param[in]   user_name The user name of account to delete
185  * @param[in]   package_name The package name of account to delete
186  *
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
191  *
192  * @pre This function requires an open connection to account service by account_connect()
193  *
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()
200  */
201 int account_delete_from_db_by_user_name(char *user_name, char *package_name);
202
203
204 /**
205  * @brief       Deletes the account from the account database by package name.
206  *
207  * @param[in]   package_name The package name of account(s) to delete
208  *
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
213  *
214  * @pre This function requires an open connection to account service by account_connect()
215  *
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()
222  */
223 int account_delete_from_db_by_package_name(char *package_name);
224
225
226 /**
227  * @brief       Updates the account details to the account database.
228  *
229  * @param[in]   account The account handle
230  * @param[in]   account_id The account ID to update
231  *
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
236  *
237  * @pre This function requires an open connection to account service by account_connect()
238  *
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()
245  */
246 int account_update_to_db_by_id(account_h account, int account_id);
247
248
249 /**
250  * @brief       Updates the account details to the account database.
251  *
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
255  *
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
260  *
261  * @pre This function requires an open connection to account service by account_connect()
262  *
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()
269  *
270  */
271 int account_update_to_db_by_user_name(account_h account, const char *user_name, const char *package_name);
272
273 /**
274  * @brief       Gets the account id of account.
275  *
276  *
277  * @param[in]   account The account handle
278  * @param[out]  account_id The account id of account
279  *
280  * @return      0 on success, otherwise a negative error value.
281  * @retval      #ACCOUNT_ERROR_NONE Successful
282  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
283  *
284  */
285 int account_get_account_id(account_h account, int *account_id);
286
287
288 /**
289  * @brief       Gets the user name of account.
290  *
291  * @remarks     @a user_name must be released with free() by you.
292  *
293  * @param[in]   account The account handle
294  * @param[out]  user_name The user name of account
295  *
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
300  *
301  * @see account_set_user_name()
302  */
303 int account_get_user_name(account_h account, char **user_name);
304
305
306 /**
307  * @brief       Sets the user name of account.
308  *
309  * @param[in]   account The account handle
310  * @param[in]   user_name The string to set as user name
311  *
312  * @return      0 on success, otherwise a negative error value.
313  * @retval      #ACCOUNT_ERROR_NONE Successful
314  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
315  *
316  * @see account_get_user_name()
317  */
318 int account_set_user_name(account_h account, const char *user_name);
319
320
321 /**
322  * @brief       Gets the display name of account.
323  *
324  * @remarks     @a display_name must be released with free() by you.
325  *
326  * @param[in]   account The account handle
327  * @param[out]  display_name The display name of account
328  *
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
333  *
334  * @see account_get_display_name()
335  */
336 int account_get_display_name(account_h account, char **display_name);
337
338
339 /**
340  * @brief       Sets the display name of account.
341  *
342  * @param[in]   account The account handle
343  * @param[in]   display_name The text string to set as the display name
344  *
345  * @return      0 on success, otherwise a negative error value.
346  * @retval      #ACCOUNT_ERROR_NONE Successful
347  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
348  *
349  * @see account_get_display_name()
350  */
351 int account_set_display_name(account_h account, const char *display_name);
352
353
354 /**
355  * @brief       Gets the capability detail of account.
356  *
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
360  *
361  * @return      0 on success, otherwise a negative error value.
362  * @retval      #ACCOUNT_ERROR_NONE Successful
363  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
364  *
365  * @see account_set_capability()
366  */
367 int account_get_capability(account_h account, capability_cb cb_func, void *user_data);
368
369
370 /**
371  * @brief       Sets the capability.
372  *
373  * @param[in]   account The account handle
374  * @param[in]   capability_type The capability type
375  * @param[in]   capability_state The capability state
376  *
377  * @return      0 on success, otherwise a negative error value.
378  * @retval      #ACCOUNT_ERROR_NONE Successful
379  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
380  *
381  * @see account_get_capability()
382  */
383 int account_set_capability(account_h account, account_capability_type_e capability_type, account_capability_state_e capability_state);
384
385
386 /**
387  * @brief       Gets the icon path.
388  *
389  * @remarks     @a icon_path must be released with free() by you.
390  *
391  * @param[in]   account The account handle
392  * @param[out]  icon_path The icon path
393  *
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
398  *
399  * @see account_set_icon_path()
400  */
401 int account_get_icon_path(account_h account, char **icon_path);
402
403
404 /**
405  * @brief       Sets the icon path.
406  *
407  * @param[in]   account The account handle
408  * @param[in]   icon_path The text string to set as a icon path
409  *
410  * @return      0 on success, otherwise a negative error value.
411  * @retval      #ACCOUNT_ERROR_NONE Successful
412  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
413  *
414  * @see account_get_icon_path()
415  */
416 int account_set_icon_path(account_h account, const char *icon_path);
417
418
419 /**
420  * @brief       Gets the domain name.
421  *
422  * @remarks     @a domain_name must be released with free() by you.
423  *
424  * @param[in]   account The account handle
425  * @param[out]  domain_name The domain name
426  *
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
431  *
432  * @see account_set_domain_name()
433  */
434 int account_get_domain_name(account_h account, char **domain_name);
435
436
437 /**
438  * @brief       Sets the domain name.
439  *
440  * @param[in]   account The account handle
441  * @param[in]   domain_name The text string to set as a domain name
442  *
443  * @return      0 on success, otherwise a negative error value.
444  * @retval      #ACCOUNT_ERROR_NONE Successful
445  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
446  *
447  * @see account_get_domain_name()
448  */
449 int account_set_domain_name(account_h account, const char *domain_name);
450
451
452 /**
453  * @brief       Gets the email address.
454  *
455  * @remarks     @a email_address must be released with free() by you.
456  *
457  * @param[in]   account The account handle
458  * @param[out]  email_address The email address
459  *
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
464  *
465  * @see account_set_email_address()
466  */
467 int account_get_email_address(account_h account, char **email_address);
468
469
470 /**
471  * @brief       Sets the email address.
472  *
473  * @param[in]   account The account handle
474  * @param[in]   email_address The text string to set as a email address
475  *
476  * @return      0 on success, otherwise a negative error value.
477  * @retval      #ACCOUNT_ERROR_NONE Successful
478  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
479  *
480  * @see account_get_email_addres()
481  */
482 int account_set_email_address(account_h account, const char *email_address);
483
484
485 /**
486  * @brief       Gets the package name.
487  *
488  * @remarks     @a package_name must be released with free() by you.
489  *
490  * @param[in]   account The account handle
491  * @param[out]  package_name The package name
492  *
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
497  *
498  * @see account_set_package_name()
499  */
500 int account_get_package_name(account_h account, char **package_name);
501
502
503 /**
504  * @brief       Sets the package name.
505  *
506  * @param[in]   account The account handle
507  * @param[in]   package_name The text string to set as a package name
508  *
509  * @return      0 on success, otherwise a negative error value.
510  * @retval      #ACCOUNT_ERROR_NONE Successful
511  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
512  *
513  * @see account_get_email_addres()
514  */
515 int account_set_package_name(account_h account, const char *package_name);
516
517
518 /**
519  * @brief       Gets the access token.
520  *
521  * @remarks     @a access_token must be released with free() by you.
522  *
523  * @param[in]   account The account handle
524  * @param[out]  access_token The access token
525  *
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
530  *
531  * @see account_set_access_token()
532  */
533 int account_get_access_token(account_h account, char **access_token);
534
535
536 /**
537  * @brief       Set the access token.
538  *
539  * @param[in]   account The account handle
540  * @param[in]   access_token The text string to set as a access token
541  *
542  * @return      0 on success, otherwise a negative error value.
543  * @retval      #ACCOUNT_ERROR_NONE Successful
544  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
545  *
546  * @see account_get_access_token()
547  */
548 int account_set_access_token(account_h account, const char *access_token);
549
550
551 /**
552  * @brief       Gets the user text.
553  *
554  * @remarks     @a user_text must be released with free() by you.
555  *
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
559  *
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
564  *
565  * @see account_set_user_text()
566  */
567 int account_get_user_text(account_h account, int user_text_index, char **user_text);
568
569
570 /**
571  * @brief       Sets the user text.
572  *
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
576  *
577  * @return      0 on success, otherwise a negative error value.
578  * @retval      #ACCOUNT_ERROR_NONE Successful
579  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
580  *
581  * @see account_get_user_text()
582  */
583 int account_set_user_text(account_h account, int user_text_index, const char *user_text);
584
585
586 /**
587  * @brief       Gets the user integer.
588  *
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
592  *
593  * @return      0 on success, otherwise a negative error value.
594  * @retval      #ACCOUNT_ERROR_NONE Successful
595  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
596  *
597  * @see account_set_user_int()
598  */
599 int account_get_user_int(account_h account, int user_int_index, int *user_integer);
600
601
602 /**
603  * @brief       Set the user integer.
604  *
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
608  *
609  * @return      0 on success, otherwise a negative error value.
610  * @retval      #ACCOUNT_ERROR_NONE Successful
611  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
612  *
613  * @see account_get_user_int()
614  */
615 int account_set_user_int(account_h account, int user_int_index, int user_integer);
616
617
618 /**
619  * @brief       Gets the auth type.
620  *
621  * @param[in]   account The account handle
622  * @param[out]  auth_type The auth type
623  *
624  * @return      0 on success, otherwise a negative error value.
625  * @retval      #ACCOUNT_ERROR_NONE Successful
626  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
627  *
628  * @see account_set_auth_type()
629  */
630 int account_get_auth_type(account_h account, account_auth_type_e *auth_type);
631
632
633 /**
634  * @brief       Sets the auth type.
635  *
636  * @param[in]   account The account handle
637  * @param[in]   auth_type Integer to be set as auth type
638  *
639  * @return      0 on success, otherwise a negative error value.
640  * @retval      #ACCOUNT_ERROR_NONE Successful
641  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
642  *
643  * @see account_get_auth_type()
644  */
645 int account_set_auth_type(account_h account, const account_auth_type_e auth_type);
646
647
648 /**
649  * @brief       Gets the secret.
650  *
651  * @param[in]   account The account handle
652  * @param[out]  secret The secret
653  *
654  * @return      0 on success, otherwise a negative error value.
655  * @retval      #ACCOUNT_ERROR_NONE Successful
656  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
657  *
658  * @see account_set_secret()
659  */
660 int account_get_secret(account_h account, account_secrecy_state_e *secret);
661
662
663 /**
664  * @brief       Sets the secret.
665  *
666  * @param[in]   account The account handle
667  * @param[in]   secret Secrecy to be set
668  *
669  * @return      0 on success, otherwise a negative error value.
670  * @retval      #ACCOUNT_ERROR_NONE Successful
671  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
672  *
673  * @see account_get_secret()
674  */
675 int account_set_secret(account_h account, const account_secrecy_state_e secret);
676
677 /**
678  * @brief       Gets the sync support.
679  *
680  * @param[in]   account The account handle
681  * @param[out]  sync_support The sync support
682  *
683  * @return      0 on success, otherwise a negative error value.
684  * @retval      #ACCOUNT_ERROR_NONE Successful
685  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
686  *
687  * @see account_set_sync_support()
688  */
689 int account_get_sync_support(account_h account, account_sync_state_e *sync_support);
690
691
692 /**
693  * @brief       Sets the sync support.
694  *
695  * @param[in]   account The account handle
696  * @param[in]   sync_support sync state to be set
697  *
698  * @return      0 on success, otherwise a negative error value.
699  * @retval      #ACCOUNT_ERROR_NONE Successful
700  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
701  *
702  * @see account_get_sync_support()
703  */
704 int account_set_sync_support(account_h account, const account_sync_state_e sync_support);
705
706
707 /**
708  * @brief       Gets the source.
709  *
710  * @remarks     @a user_text must be released with free() by you.
711  *
712  * @param[in]   account The account handle
713  * @param[out]  source The source
714  *
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
719  *
720  * @see account_set_source()
721  */
722 int account_get_source(account_h account, char **source);
723
724
725 /**
726  * @brief       Sets the source.
727  *
728  * @param[in]   account The account handle
729  * @param[in]   source The text string to set as a source
730  *
731  * @return      0 on success, otherwise a negative error value.
732  * @retval      #ACCOUNT_ERROR_NONE Successful
733  * @retval      #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
734  *
735  * @see account_get_source()
736  */
737 int account_set_source(account_h account, const char *source);
738
739
740 /**
741  * @brief       Retrieves all accounts details by invoking the given callback function iteratively.
742  *
743  * @param[in]   callback The callback function to invoke
744  * @param[in]   user_data The user data to be passed to the callback function
745  *
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
750  *
751  * @pre This function requires an open connection to account service by account_connect().
752  * @post        This function invokes account_cb().
753  *
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()
759  */
760 int account_foreach_account_from_db(account_cb callback, void *user_data);
761
762
763 /**
764  * @brief       Retrieves all accounts with the account database ID.
765  *
766  * @param[in]   account_db_id The account database ID to search
767  * @param[out] account account handle
768  *
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
773  *
774  * @pre This function requires an open connection to account service by account_connect().
775  * @post        This function invokes account_cb().
776  *
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()
782  */
783 int account_query_account_by_account_id(int account_db_id, account_h *account);
784
785 /**
786  * @brief       Retrieves all accounts with the user name.
787  *
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
791  *
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
796  *
797  * @pre This function requires an open connection to account service by account_connect().
798  * @post        This function invokes account_cb().
799  *
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()
805  *
806  */
807 int account_query_account_by_user_name(account_cb callback, const char* user_name, void* user_data);
808
809 /**
810  * @brief       Retrieves all accounts with the package name.
811  *
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
815  *
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
820  *
821  * @pre This function requires an open connection to account service by account_connect().
822  * @post        This function invokes account_cb().
823  *
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()
829  */
830 int account_query_account_by_package_name(account_cb callback, const char *package_name, void *user_data);
831
832 /**
833  * @brief       Retrieves all accounts with the capability.
834  *
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
839  *
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
844  *
845  * @pre This function requires an open connection to account service by account_connect().
846  * @post        This function invokes account_cb().
847  *
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()
853  */
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);
855
856 /**
857  * @brief       Retrieves all capabilities with the account database ID.
858  *
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
862  *
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
867  *
868  * @pre This function requires an open connection to account service by account_connect().
869  * @post        This function invokes capability_cb().
870  *
871  * @see account_connect()
872  * @see account_get_capability()
873  * @see account_set_capability()
874  */
875 int account_query_capability_by_account_id(capability_cb callback, int account_db_id, void *user_data);
876
877
878 /**
879  * @brief       Retrieves number of account in the account database.
880  *
881  * @param[out] out parameter for number of all accounts
882  *
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
886  *
887  * @pre This function requires an open connection to account service by account_connect().
888  *
889  * @see account_connect()
890  */
891 int account_get_total_count_from_db(int *count);
892
893
894 /**
895 * @}
896 */
897
898
899 #ifdef __cplusplus
900 }
901 #endif
902
903 #endif /* __ACCOUNT_H__ */