Tizen 2.1 base
[platform/core/system/sync-agent.git] / include / plugin / account_interface.h
1 /*
2  * sync-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
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
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #ifndef ACCOUNT_INTERFACE_H_
19 #define ACCOUNT_INTERFACE_H_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif                          /* __cplusplus */
24
25 /**
26  * @file account_interface.h
27  * @brief       Interface list in this header will be implemented plugIn developer
28  * @remarks Implementation will operate sync-agent-framework account module
29  */
30
31 /** @addtogroup plugin_account Account Domain
32  * @ingroup plugin
33  *      @{
34  */
35
36 /**
37  * API to set account repository name
38  * @remarks Repository means mapping storage, between service account id and sync-agent-framework account id
39  *
40  * @param[in] agent_name repository name - described in fw config xml file <Agent-Key>
41  *
42  * @par Since:
43  *
44  *
45  * @see sync_agent_init(const char *)
46  *
47  */
48         void sync_agent_plugin_set_account_repository_name(const char *agent_name);
49
50 /**
51  * API to add account to platform
52  * @remarks     Mapping platform account id with sync-agent-framework account id
53  *
54  * @param[in] fw_account_id     sync-agent-framework account id
55  *
56  * @par Since:
57  *
58  *
59  * @see acc_add_platform_account(int)
60  *
61  */
62         void sync_agent_plugin_add_platform_account(int fw_account_id);
63
64 /**
65  * API to set mapping relationship between sync-agent-framework account id and service account id
66  * @remarks You must register non-volatile storage not memory ex) File, DataBase..
67  *
68  * @param[in] fw_account_id sync-agent-framework account id
69  * @param[in]   service_type service type - service data connector plugin's id described in sync-agent-framework config xml file
70  * @param[in]   service_account_id service account id
71  *
72  * @par Since:
73  *
74  *
75  * @see sync_agent_construct_account_tbl_from_service()
76  */
77         void sync_agent_plugin_set_platform_account_service(int fw_account_id, int service_type, int service_account_id);
78
79 /**
80  * API to remove mapping relationship between sync-agent-framework account id and platform account id
81  * @remarks You must remove from storage
82  *
83  * @param[in] fw_account_id sync-agent-framework account id
84  *
85  * @par Since:
86  *
87  *
88  * @see acc_delete_platform_account(int)
89  *
90  */
91         void sync_agent_plugin_delete_platform_account(int fw_account_id);
92
93 /**
94  * API to remove mapping relationship between sync-agent-framework account id and service account id
95  * @remarks You must remove from storage
96  *
97  * @param[in] fw_account_id sync-agent-framework account id
98  * @param[in] service_type service type - service data connector plugin's id described in sync-agent-framework config xml file
99  *
100  * @par Since:
101  *
102  *
103  * @see sync_agent_construct_account_tbl_from_service()
104  *
105  */
106         void sync_agent_plugin_delete_platform_account_service(int fw_account_id, int service_type);
107
108 /**
109  * API to confirm whether sync-agent-framework account id has the service account id
110  *
111  * @param[in] fw_account_id sync-agent-framework account id
112  * @param[in]   service_type service type - service data connector plugin's id described in sync-agent-framework config xml file
113  *
114  * @return 1 if has, otherwise 0
115  *
116  * @par Since:
117  *
118  *
119  * @see sync_agent_construct_account_tbl_from_service()
120  *
121  */
122         int sync_agent_plugin_has_platform_account_service(int fw_account_id, int service_type);
123
124 /**
125  * API to get service account id mapped with sync-agent-framework account id
126  *
127  * @param[in] service_type service type - service data connector plugin's id described in sync-agent-framework config xml file
128  * @param[in]   fw_account_id   sync-agent-framework account id
129  *
130  * @return service account id if it exist mapping relationship, otherwise -100
131  *
132  * @par Since:
133  *
134  *
135  * @see acc_get_service_account_id(int, int)
136  *
137  */
138         int sync_agent_plugin_get_service_account_id(int service_type, int fw_account_id);
139
140 /**
141  * API to get sync-agent-framework account id mapped with service account id
142  *
143  * @param[in] service_type service type - service data connector plugin's id described in sync-agent-framework config xml file
144  * @param[in] service_account_id service account id
145  * @param[in]   index possible mapping one service account with multiple sync-agent-framework account, so need index of sync-agent-framework account
146  *
147  * @return sync-agent-framework account id if it exist mapping relationship, otherwise -1
148  *
149  * @par Since:
150  *
151  *
152  * @see acc_get_fw_account_id(int, int, int)
153  *
154  */
155         int sync_agent_plugin_get_fw_account_id(int service_type, int service_account_id, int index);
156
157 /**
158  * API to get service account information
159  * @remarks     Account information type must be defined in account plugin.
160  *
161  * @param[in] fw_account_id sync-agent-framework account id
162  * @param[in] service_type service type - service data connector plugin's id described in sync-agent-framework config xml file
163  * @param[in] account_info as returned by sync_agent_plugin_get_service_account_info()
164  *
165  * @return 1 on success, 0 on error
166  *
167  * @par Since:
168  *
169  *
170  * @see acc_get_fw_account_id(int, int, int)
171  *
172  */
173         int sync_agent_plugin_get_service_account_info(int fw_account_id, int service_type, sync_agent_service_account_info_s ** account_info);
174
175 /**
176  *      @}
177  */
178
179 #ifdef __cplusplus
180 }
181 #endif                          /* __cplusplus */
182 #endif                          /* ACCOUNT_INTERFACE_H_ */