Changed the API description by API review
[platform/core/uifw/capi-ui-sticker.git] / include / sticker_data.h
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TIZEN_UIX_STICKER_DATA_H__
18 #define __TIZEN_UIX_STICKER_DATA_H__
19
20 #include <sticker_error.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27  * @file sticker_data.h
28  * @brief This file contains sticker data APIs and related enumeration.
29  */
30
31 /**
32  * @addtogroup CAPI_UIX_STICKER_DATA_MODULE
33  * @{
34  */
35
36 /**
37  * @brief Enumeration for sticker URI type.
38  *
39  * @since_tizen 5.5
40  */
41 typedef enum {
42     STICKER_DATA_URI_LOCAL_PATH = 1, /**< Local path URI */
43     STICKER_DATA_URI_WEB_RESOURCE, /**< Web resource URI */
44 } sticker_data_uri_type_e;
45
46 /**
47  * @brief The sticker data handle.
48  * @since_tizen 5.5
49  */
50 typedef struct sticker_data_s *sticker_data_h;
51
52 /**
53  * @brief Called to retrieve the keyword of the sticker.
54  * @details The sticker_data_foreach_keyword() must be called to invoke this callback function, synchronously.
55  * @since_tizen 5.5
56  * @remarks @a keyword should not be freed and can be used only in the callback.
57  * @param[in] keyword The sticker keyword
58  * @param[in] user_data The user data passed from the foreach function
59  * @pre sticker_data_foreach_keyword() will invoke this callback.
60  * @see sticker_data_foreach_keyword()
61  */
62 typedef void (*sticker_data_keyword_foreach_cb)(const char *keyword, void *user_data);
63
64 /**
65  * @brief Creates a sticker data handle.
66  * @since_tizen 5.5
67  * @remarks If the function succeeds, @a data_handle must be released with sticker_data_destroy().
68  * @param[out] data_handle The sticker data handle
69  * @return 0 on success, otherwise a negative error value
70  * @retval #STICKER_ERROR_NONE Successful
71  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
72  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
73  * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory
74  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
75  * @see sticker_data_destroy()
76  */
77 int sticker_data_create(sticker_data_h *data_handle);
78
79 /**
80  * @brief Destroys a sticker data handle.
81  * @since_tizen 5.5
82  * @param[in] data_handle The sticker data handle
83  * @return 0 on success, otherwise a negative error value
84  * @retval #STICKER_ERROR_NONE Successful
85  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
86  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
87  * @see sticker_data_create()
88  */
89 int sticker_data_destroy(sticker_data_h data_handle);
90
91 /**
92  * @brief Clones a sticker data handle.
93  * @since_tizen 5.5
94  * @remarks If the function succeeds, @a target_handle must be released with sticker_data_destroy().
95  * @param[in] origin_handle The sticker data handle
96  * @param[out] target_handle The sticker data handle to be cloned
97  * @return 0 on success, otherwise a negative error value
98  * @retval #STICKER_ERROR_NONE Successful
99  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
100  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
101  * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory
102  * @see sticker_data_destroy()
103  */
104 int sticker_data_clone(sticker_data_h origin_handle, sticker_data_h *target_handle);
105
106 /**
107  * @brief Gets the name of the sticker provider application from sticker data handle.
108  * @since_tizen 5.5
109  * @remarks @a app_id must be released using free().
110  * @param[in] data_handle The sticker data handle
111  * @param[out] app_id The name of the application that provides sticker information
112  * @return 0 on success, otherwise a negative error value
113  * @retval #STICKER_ERROR_NONE Successful
114  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
115  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
116  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
117  */
118 int sticker_data_get_app_id(sticker_data_h data_handle, char **app_id);
119
120 /**
121  * @brief Sets the URI and URI type of the sticker.
122  * @details @a uri must be a relative path like '/res/smile.png' when the type of URI is local path.
123  * @since_tizen 5.5
124  * @remarks @a uri must have a non-null value and must be an existing file. If not, the error as invalid parameter will be returned.
125  * @param[in] data_handle The sticker data handle
126  * @param[in] type The URI type to be saved
127  * @param[in] uri The URI to be saved
128  * @return 0 on success, otherwise a negative error value
129  * @retval #STICKER_ERROR_NONE Successful
130  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
131  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
132  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
133  * @see sticker_data_get_uri()
134  */
135 int sticker_data_set_uri(sticker_data_h data_handle, sticker_data_uri_type_e type, const char *uri);
136
137 /**
138  * @brief Gets the URI and URI type from sticker data handle.
139  * @since_tizen 5.5
140  * @remarks @a uri must be released using free().
141  * @param[in] data_handle The sticker data handle
142  * @param[out] type The URI type
143  * @param[out] uri The URI
144  * @return 0 on success, otherwise a negative error value
145  * @retval #STICKER_ERROR_NONE Successful
146  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
147  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
148  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
149  * @see sticker_data_set_uri()
150  */
151 int sticker_data_get_uri(sticker_data_h data_handle, sticker_data_uri_type_e *type, char **uri);
152
153 /**
154  * @brief Retrieves all keywords of the sticker using callback function.
155  * @since_tizen 5.5
156  * @param[in] data_handle The sticker data handle
157  * @param[in] callback The callback function to invoke
158  * @param[in] user_data The user data to be passed to the callback function
159  * @return 0 on success, otherwise a negative error value
160  * @retval #STICKER_ERROR_NONE Successful
161  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
162  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
163  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
164  * @post This function invokes sticker_data_keyword_foreach_cb() repeatedly for getting keywords.
165  * @see sticker_data_keyword_foreach_cb()
166  * @see sticker_data_add_keyword()
167  * @see sticker_data_remove_keyword()
168  */
169 int sticker_data_foreach_keyword(sticker_data_h data_handle, sticker_data_keyword_foreach_cb callback, void *user_data);
170
171 /**
172  * @brief Adds a keyword of the sticker to the list.
173  * @since_tizen 5.5
174  * @remarks @a keyword must have a non-null value and can not have duplicate value. If not, the error as invalid parameter will be returned.
175  * @param[in] data_handle The sticker data handle
176  * @param[in] keyword The keyword to be saved
177  * @return 0 on success, otherwise a negative error value
178  * @retval #STICKER_ERROR_NONE Successful
179  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
180  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
181  * @see sticker_data_keyword_foreach_cb()
182  * @see sticker_data_foreach_keyword()
183  * @see sticker_data_remove_keyword()
184  */
185 int sticker_data_add_keyword(sticker_data_h data_handle, const char *keyword);
186
187 /**
188  * @brief Removes a keyword of the sticker from the list.
189  * @since_tizen 5.5
190  * @remarks @a keyword must exist value in the list. If not, the error as invalid parameter will be returned.
191  * @param[in] data_handle The sticker data handle
192  * @param[in] keyword The keyword to be removed
193  * @return 0 on success, otherwise a negative error value
194  * @retval #STICKER_ERROR_NONE Successful
195  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
196  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
197  * @see sticker_data_keyword_foreach_cb()
198  * @see sticker_data_foreach_keyword()
199  * @see sticker_data_add_keyword()
200  */
201 int sticker_data_remove_keyword(sticker_data_h data_handle, const char *keyword);
202
203 /**
204  * @brief Sets the group name of the sticker.
205  * @since_tizen 5.5
206  * @remarks @a group must have a non-null value. If not, the error as invalid parameter will be returned.
207  * @param[in] data_handle The sticker data handle
208  * @param[in] group The group name to be saved
209  * @return 0 on success, otherwise a negative error value
210  * @retval #STICKER_ERROR_NONE Successful
211  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
212  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
213  * @see sticker_data_get_group()
214  */
215 int sticker_data_set_group_name(sticker_data_h data_handle, const char *group);
216
217 /**
218  * @brief Gets the group name from sticker data handle.
219  * @since_tizen 5.5
220  * @remarks @a group must be released using free().
221  * @param[in] data_handle The sticker data handle
222  * @param[out] group The group name
223  * @return 0 on success, otherwise a negative error value
224  * @retval #STICKER_ERROR_NONE Successful
225  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
226  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
227  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
228  * @see sticker_data_set_group()
229  */
230 int sticker_data_get_group_name(sticker_data_h data_handle, char **group);
231
232 /**
233  * @brief Sets the thumbnail local path of the sticker.
234  * @details @a thumbnail must be a relative path like '/res/smile_thumbnail.png'.
235  * @since_tizen 5.5
236  * @remarks @a thumbnail must have a non-null value and must be an existing file. If not, the error as invalid parameter will be returned.
237  * @param[in] data_handle The sticker data handle
238  * @param[in] thumbnail The thumbnail path to be saved
239  * @return 0 on success, otherwise a negative error value
240  * @retval #STICKER_ERROR_NONE Successful
241  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
242  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
243  * @see sticker_data_get_thumbnail()
244  */
245 int sticker_data_set_thumbnail(sticker_data_h data_handle, const char *thumbnail);
246
247 /**
248  * @brief Gets the thumbnail local path from sticker data handle.
249  * @details If the thumbnail is empty, the result will be an empty string.
250  * @since_tizen 5.5
251  * @remarks @a thumbnail must be released using free().
252  * @param[in] data_handle The sticker data handle
253  * @param[out] thumbnail The thumbnail path
254  * @return 0 on success, otherwise a negative error value
255  * @retval #STICKER_ERROR_NONE Successful
256  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
257  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
258  * @see sticker_data_set_thumbnail()
259  */
260 int sticker_data_get_thumbnail(sticker_data_h data_handle, char **thumbnail);
261
262 /**
263  * @brief Sets the description of the sticker.
264  * @since_tizen 5.5
265  * @remarks @a description must have a non-null value. If not, the error as invalid parameter will be returned.
266  * @param[in] data_handle The sticker data handle
267  * @param[in] description The description to be saved
268  * @return 0 on success, otherwise a negative error value
269  * @retval #STICKER_ERROR_NONE Successful
270  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
271  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
272  * @see sticker_data_get_description()
273  */
274 int sticker_data_set_description(sticker_data_h data_handle, const char *description);
275
276 /**
277  * @brief Gets the description from sticker data handle.
278  * @details If the description is empty, the result will be an empty string.
279  * @since_tizen 5.5
280  * @remarks @a description must be released using free().
281  * @param[in] data_handle The sticker data handle
282  * @param[out] description The description of the sticker
283  * @return 0 on success, otherwise a negative error value
284  * @retval #STICKER_ERROR_NONE Successful
285  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
286  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
287  * @see sticker_data_set_description()
288  */
289 int sticker_data_get_description(sticker_data_h data_handle, char **description);
290
291 /**
292  * @brief Gets the last updated date from sticker data handle.
293  * @details The format of @a date is YYYY-MM-DD HH:MM:SS.
294  * @since_tizen 5.5
295  * @remarks @a date must be released using free().
296  * @param[in] data_handle The sticker data handle
297  * @param[out] date The last updated date
298  * @return 0 on success, otherwise a negative error value
299  * @retval #STICKER_ERROR_NONE Successful
300  * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
301  * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
302  * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
303  */
304 int sticker_data_get_date(sticker_data_h data_handle, char **date);
305
306 /**
307  * @}
308  */
309
310 #ifdef __cplusplus
311 }
312 #endif
313
314 #endif /* __TIZEN_UIX_STICKER_DATA_H__ */