4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Wonyoung Lee <wy1115.lee@samsung.com>, Sungchan Kim <sungchan81.kim@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.
22 #ifndef __ACCOUNT_INTERNAL_H__
23 #define __ACCOUNT_INTERNAL_H__
25 #include "account-types.h"
33 #ifndef ACCOUNT_INTERNAL_API
34 #define ACCOUNT_INTERNAL_API __attribute__ ((visibility("default")))
38 * @file account_internal.h
39 * @brief This file contains the Account API for account management.
44 * @brief Deletes an account from the account database by package name.
48 * @privilege %http://tizen.org/privilege/account.read \n
49 * %http://tizen.org/privilege/account.write
50 * @remarks This API need both privileges
51 * @param[in] package_name The package name of account(s) to delete
53 * @return @c 0 on success,
54 * otherwise a negative error value
55 * @retval #ACCOUNT_ERROR_NONE Successful
56 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
57 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
58 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
59 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
60 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
62 * @see account_connect()
63 * @see account_insert_to_db()
64 * @see account_delete_from_db_by_id()
65 * @see account_delete_from_db_by_user_name()
66 * @see account_update_to_db_by_id()
67 * @see account_update_to_db_by_user_name()
69 int account_delete_from_db_by_package_name_offline(const char *package_name);
73 * @brief Updates the account details to the account database without checking provider's permission.
77 * @privilege %http://tizen.org/privilege/account.read \n
78 * %http://tizen.org/privilege/account.write
79 * @remarks This API need both privileges
80 * @param[in] account The account handle
81 * @param[in] account_id The account ID to update
83 * @return @c 0 on success,
84 * otherwise a negative error value
85 * @retval #ACCOUNT_ERROR_NONE Successful
86 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of Memory
87 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
88 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
89 * @retval #ACCOUNT_ERROR_RECORD_NOT_FOUND The account to update does not exist
90 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
91 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
92 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
94 * @pre This function requires an open connection to an account service by account_connect().
96 * @see account_connect()
97 * @see account_insert_to_db()
98 * @see account_delete_from_db_by_id()
99 * @see account_delete_from_db_by_user_name()
100 * @see account_delete_from_db_by_package_name()
101 * @see account_update_to_db_by_user_name()
103 int account_update_to_db_by_id_without_permission(account_h account, int account_id);
107 * @brief Sets the app ID.
108 * It should be filled with your application ID. For example, com.tizen.testapp.
111 * @remarks @a app_id is a mandatory field and does not allow duplicate app ID in the account provider database.
113 * @param[in] account_type The account provider handle \n
114 * It should be assigned by account_type_create().
115 * @param[in] app_id The application ID
117 * @return @c 0 on success,
118 * otherwise a negative error value
119 * @retval #ACCOUNT_ERROR_NONE Successful
120 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
121 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
123 * @see account_type_get_app_id()
125 int account_type_set_app_id(account_type_h account_type, const char *app_id);
129 * @brief Sets the service provider ID.
130 * It should be filled with your service provider ID.
133 * @remarks @a service_provider_id is a mandatory field.
135 * @param[in] account_type The account provider handle \n
136 * It should be assigned by account_type_create().
137 * @param[in] service_provider_id The service provider ID
139 * @return @c 0 on success,
140 * otherwise a negative error value
141 * @retval #ACCOUNT_ERROR_NONE Successful
142 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
143 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
145 * @see account_type_get_service_provider_id()
147 int account_type_set_service_provider_id(account_type_h account_type, const char *service_provider_id);
151 * @brief Sets icon path.
152 * It represents your service provider or an application.
155 * @remarks @a icon_path is not a mandatory field. But when it is set, you can display this icon in the Add Account screen.
157 * @param[in] account_type The account provider handle\n
158 * It should be assigned by account_type_create().
159 * @param[in] icon_path The icon path of the application
161 * @return @c 0 on success,
162 * otherwise a negative error value
163 * @retval #ACCOUNT_ERROR_NONE Successful
164 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
165 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
167 * @see account_type_get_icon_path()
169 int account_type_set_icon_path(account_type_h account_type, const char *icon_path);
173 * @brief Sets small icon path.
174 * It also represents your service provider or an application.
177 * @remarks @a small_icon_path is not a mandatory field.
179 * @param[in] account_type The account provider handle \n
180 * It should be assigned by account_type_create().
181 * @param[in] small_icon_path The scaled icon of your application
183 * @return @c 0 on success,
184 * otherwise a negative error value
185 * @retval #ACCOUNT_ERROR_NONE Successful
186 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
187 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
189 * @see account_type_get_small_icon_path()
191 int account_type_set_small_icon_path(account_type_h account_type, const char *small_icon_path);
195 * @brief Sets support for multiple accounts.
196 * It represents whether your application supports multiple accounts.
199 * @remarks The default value of multiple account support is @c FALSE.
201 * @param[in] account_type The account provider handle \n
202 * It should be assigned by account_type_create().
203 * @param[in] multiple_account_support Set @c TRUE if your application can support two or more accounts, \n
204 * otherwise @c FALSE if your application can support only one account
206 * @return @c 0 on success,
207 * otherwise a negative error value
208 * @retval #ACCOUNT_ERROR_NONE Successful
209 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
210 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
212 * @see account_type_get_multiple_account_support()
214 int account_type_set_multiple_account_support(account_type_h account_type, const bool multiple_account_support);
218 * @brief Sets label and locale.
219 * Label represents the name of an account provider.
222 * @param[in] account_type The account provider handle \n
223 * It should be assigned by account_type_create().
224 * @param[in] label The name of account depends on the specified locale
225 * @param[in] locale The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.\n
226 * For example, "ko_KR" for Korean, "en_US" for American English.
228 * @return @c 0 on success,
229 * otherwise a negative error value
230 * @retval #ACCOUNT_ERROR_NONE Successful
231 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
232 * @retval #ACCOUNT_ERROR_OUT_OF_MEMORY Out of memory
234 * @see account_type_get_label()
236 int account_type_set_label(account_type_h account_type, const char* label, const char* locale);
240 * @brief Sets the capability.
243 * @param[in] account_type The account provider handle
244 * @param[in] provider_feature Th capability key of the account
246 * @return @c 0 on success,
247 * otherwise a negative error value
248 * @retval #ACCOUNT_ERROR_NONE Successful
249 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
251 * @see account_set_capability()
253 int account_type_set_provider_feature(account_type_h account_type, const char* provider_feature);
257 * @brief Inserts the account provider details to the database.
261 * @privilege %http://tizen.org/privilege/account.read \n
262 * %http://tizen.org/privilege/account.write
263 * @remarks this API need both privileges
264 * @param[in] account_type The account handle which is created by account_type_create() \n
265 * @param[out] account_type_id The account provider ID to be assigned after inserting the account provider handle
267 * @return @c 0 on success,
268 * otherwise a negative error value
269 * @retval #ACCOUNT_ERROR_NONE Successful
270 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
271 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
272 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
273 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
274 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
276 * @pre This function requires an open connection to an account service by account_connect().
277 * @post account_disconnect() is recommended after insertion.
279 * @see account_connect()
280 * @see account_disconnect()
282 int account_type_insert_to_db(account_type_h account_type, int* account_type_id);
286 * @brief Updates the account details to the account database.
290 * @privilege %http://tizen.org/privilege/account.read \n
291 * %http://tizen.org/privilege/account.write
292 * @remarks this API need both privileges
293 * @param[in] account_type The account handle which is created by account_type_create() \n
294 * @param[in] app_id The application ID of the account provider
296 * @return @c 0 on success,
297 * otherwise a negative error value
298 * @retval #ACCOUNT_ERROR_NONE Successful
299 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
300 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
301 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
302 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
304 * @pre This function requires an open connection to an account service by account_connect().
305 * @post account_disconnect() is recommended after update.
307 * @see account_connect()
308 * @see account_disconnect()
310 int account_type_update_to_db_by_app_id(const account_type_h account_type, const char* app_id);
314 * @brief Deletes the account provider from the account database by application ID.
318 * @privilege %http://tizen.org/privilege/account.read \n
319 * %http://tizen.org/privilege/account.write
320 * @remarks this API need both privileges
321 * @param[in] app_id The application ID of account provider to be deleted
323 * @return @c 0 on success,
324 * otherwise a negative error value
325 * @retval #ACCOUNT_ERROR_NONE Successful
326 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
327 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
328 * @retval #ACCOUNT_ERROR_PERMISSION_DENIED DB Access fail by permission
329 * @retval #ACCOUNT_ERROR_DATABASE_BUSY SQLite handler is busy
330 * @retval #ACCOUNT_ERROR_DB_NOT_OPENED Account database did not opened
332 * @pre This function requires an open connection to an account service by account_connect().
334 * @see account_connect()
335 * @see account_disconnect()
337 int account_type_delete_by_app_id(const char* app_id);
341 * @brief Start to subscribe account event through the given callback function
343 * @param[in] account_subscribe The account subscription handle
344 * @param[in] cb_func When an account is removed from account database. It will be called with event message and account id.
345 * @param[in] user_data user_data will be delivered to cb_func
347 * @return 0 on success, otherwise a negative error value.
348 * @retval #ACCOUNT_ERROR_NONE Successful
349 * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Subscription fail
350 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
352 * @see account_unsubscribe_notification()
353 * @see account_subscribe_notification()
355 int account_subscribe_notification_ex(account_subscribe_h account_subscribe, account_event_cb cb_func, void* user_data);
359 * @brief Start to subscribe account event through the given callback function
361 * @param[in] account_subscribe The account subscription handle
362 * @param[in] cb_func When an account is removed from account database. It will be called with event message and account id.
363 * @param[in] user_data user_data will be delivered to cb_func
365 * @return 0 on success, otherwise a negative error value.
366 * @retval #ACCOUNT_ERROR_NONE Successful
367 * @retval #ACCOUNT_ERROR_EVENT_SUBSCRIPTION_FAIL Subscription fail
368 * @retval #ACCOUNT_ERROR_INVALID_PARAMETER Invalid parameter
370 * @see account_unsubscribe_notification()
371 * @see account_subscribe_notification()
373 int account_unsubscribe_notification_ex(account_subscribe_h account_subscribe);
377 * @brief Gets the count of accounts whose secrect state is visible in the account database.
381 * @privilege %http://tizen.org/privilege/account.read
382 * @param[out] count The out parameter for count of all accounts
384 * @return @c 0 on success,
385 * otherwise a negative error value
386 * @retval #ACCOUNT_ERROR_NONE Successful
387 * @retval #ACCOUNT_ERROR_DB_FAILED Database operation failed
388 * @retval #ACCOUNT_ERROR_ACCESS_DENIED DB Access fail by permission
390 * @pre This function requires an open connection to an account service by account_connect().
393 int account_get_total_count_from_db_ex(int *count);
396 int account_type_insert_to_db_offline(account_type_h account_type, int* account_type_id);
398 int account_type_delete_by_app_id_offline(const char* app_id);
408 #endif /* __ACCOUNT_INTERNAL_H__ */