2 * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_UIX_STICKER_DATA_H__
18 #define __TIZEN_UIX_STICKER_DATA_H__
20 #include <sticker_error.h>
27 * @file sticker_data.h
28 * @brief This file contains sticker data APIs and related enumeration.
32 * @addtogroup CAPI_UIX_STICKER_DATA_MODULE
37 * @brief Enumeration for sticker URI type.
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;
47 * @brief Enumeration for sticker display type.
52 STICKER_DATA_DISP_EMOJI = 1, /**< Emoji type */
53 STICKER_DATA_DISP_WALLPAPER, /**< Wallpaper type */
54 } sticker_data_display_type_e;
57 * @brief The sticker data handle.
60 typedef struct sticker_data_s *sticker_data_h;
63 * @brief Called to retrieve the keyword of the sticker.
64 * @details The sticker_data_foreach_keyword() must be called to invoke this callback function, synchronously.
66 * @remarks @a keyword should not be freed and can be used only in the callback.
67 * @param[in] keyword The sticker keyword
68 * @param[in] user_data The user data passed from the foreach function
69 * @pre sticker_data_foreach_keyword() will invoke this callback.
70 * @see sticker_data_foreach_keyword()
72 typedef void (*sticker_data_keyword_foreach_cb)(const char *keyword, void *user_data);
75 * @brief Creates a sticker data handle.
77 * @remarks If the function succeeds, @a data_handle must be released with sticker_data_destroy().
78 * @param[out] data_handle The sticker data handle
79 * @return 0 on success, otherwise a negative error value
80 * @retval #STICKER_ERROR_NONE Successful
81 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
82 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
83 * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory
84 * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
85 * @see sticker_data_destroy()
87 int sticker_data_create(sticker_data_h *data_handle);
90 * @brief Destroys a sticker data handle.
92 * @param[in] data_handle The sticker data handle
93 * @return 0 on success, otherwise a negative error value
94 * @retval #STICKER_ERROR_NONE Successful
95 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
96 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
97 * @see sticker_data_create()
99 int sticker_data_destroy(sticker_data_h data_handle);
102 * @brief Clones a sticker data handle.
104 * @remarks If the function succeeds, @a target_handle must be released with sticker_data_destroy().
105 * @param[in] origin_handle The sticker data handle
106 * @param[out] target_handle The sticker data handle to be cloned
107 * @return 0 on success, otherwise a negative error value
108 * @retval #STICKER_ERROR_NONE Successful
109 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
110 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
111 * @retval #STICKER_ERROR_OUT_OF_MEMORY Out of memory
112 * @see sticker_data_destroy()
114 int sticker_data_clone(sticker_data_h origin_handle, sticker_data_h *target_handle);
117 * @brief Gets the name of the sticker provider application from sticker data handle.
119 * @remarks @a app_id must be released using free().
120 * @param[in] data_handle The sticker data handle
121 * @param[out] app_id The name of the application that provides sticker information
122 * @return 0 on success, otherwise a negative error value
123 * @retval #STICKER_ERROR_NONE Successful
124 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
125 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
126 * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
128 int sticker_data_get_app_id(sticker_data_h data_handle, char **app_id);
131 * @brief Sets the URI and URI type of the sticker.
132 * @details @a uri must be a relative path like '/res/smile.png' when the type of URI is local path.
134 * @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.
135 * @param[in] data_handle The sticker data handle
136 * @param[in] type The URI type to be saved
137 * @param[in] uri The URI to be saved
138 * @return 0 on success, otherwise a negative error value
139 * @retval #STICKER_ERROR_NONE Successful
140 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
141 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
142 * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
143 * @see sticker_data_get_uri()
145 int sticker_data_set_uri(sticker_data_h data_handle, sticker_data_uri_type_e type, const char *uri);
148 * @brief Gets the URI and URI type from sticker data handle.
150 * @remarks @a uri must be released using free().
151 * @param[in] data_handle The sticker data handle
152 * @param[out] type The URI type
153 * @param[out] uri The URI
154 * @return 0 on success, otherwise a negative error value
155 * @retval #STICKER_ERROR_NONE Successful
156 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
157 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
158 * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
159 * @see sticker_data_set_uri()
161 int sticker_data_get_uri(sticker_data_h data_handle, sticker_data_uri_type_e *type, char **uri);
164 * @brief Retrieves all keywords of the sticker using callback function.
166 * @param[in] data_handle The sticker data handle
167 * @param[in] callback The callback function to invoke
168 * @param[in] user_data The user data to be passed to the callback function
169 * @return 0 on success, otherwise a negative error value
170 * @retval #STICKER_ERROR_NONE Successful
171 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
172 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
173 * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
174 * @post This function invokes sticker_data_keyword_foreach_cb() repeatedly for getting keywords.
175 * @see sticker_data_keyword_foreach_cb()
176 * @see sticker_data_add_keyword()
177 * @see sticker_data_remove_keyword()
179 int sticker_data_foreach_keyword(sticker_data_h data_handle, sticker_data_keyword_foreach_cb callback, void *user_data);
182 * @brief Adds a keyword of the sticker to the list.
184 * @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.
185 * @param[in] data_handle The sticker data handle
186 * @param[in] keyword The keyword to be saved
187 * @return 0 on success, otherwise a negative error value
188 * @retval #STICKER_ERROR_NONE Successful
189 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
190 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
191 * @see sticker_data_keyword_foreach_cb()
192 * @see sticker_data_foreach_keyword()
193 * @see sticker_data_remove_keyword()
195 int sticker_data_add_keyword(sticker_data_h data_handle, const char *keyword);
198 * @brief Removes a keyword of the sticker from the list.
200 * @remarks @a keyword must exist value in the list. If not, the error as invalid parameter will be returned.
201 * @param[in] data_handle The sticker data handle
202 * @param[in] keyword The keyword to be removed
203 * @return 0 on success, otherwise a negative error value
204 * @retval #STICKER_ERROR_NONE Successful
205 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
206 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
207 * @see sticker_data_keyword_foreach_cb()
208 * @see sticker_data_foreach_keyword()
209 * @see sticker_data_add_keyword()
211 int sticker_data_remove_keyword(sticker_data_h data_handle, const char *keyword);
214 * @brief Sets the group name of the sticker.
216 * @remarks @a group must have a non-null value. If not, the error as invalid parameter will be returned.
217 * @param[in] data_handle The sticker data handle
218 * @param[in] group The group name to be saved
219 * @return 0 on success, otherwise a negative error value
220 * @retval #STICKER_ERROR_NONE Successful
221 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
222 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
223 * @see sticker_data_get_group()
225 int sticker_data_set_group_name(sticker_data_h data_handle, const char *group);
228 * @brief Gets the group name from sticker data handle.
230 * @remarks @a group must be released using free().
231 * @param[in] data_handle The sticker data handle
232 * @param[out] group The group name
233 * @return 0 on success, otherwise a negative error value
234 * @retval #STICKER_ERROR_NONE Successful
235 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
236 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
237 * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
238 * @see sticker_data_set_group()
240 int sticker_data_get_group_name(sticker_data_h data_handle, char **group);
243 * @brief Sets the thumbnail local path of the sticker.
244 * @details @a thumbnail must be a relative path like '/res/smile_thumbnail.png'.
246 * @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.
247 * @param[in] data_handle The sticker data handle
248 * @param[in] thumbnail The thumbnail path to be saved
249 * @return 0 on success, otherwise a negative error value
250 * @retval #STICKER_ERROR_NONE Successful
251 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
252 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
253 * @see sticker_data_get_thumbnail()
255 int sticker_data_set_thumbnail(sticker_data_h data_handle, const char *thumbnail);
258 * @brief Gets the thumbnail local path from sticker data handle.
259 * @details If the thumbnail is empty, the result will be an empty string.
261 * @remarks @a thumbnail must be released using free().
262 * @param[in] data_handle The sticker data handle
263 * @param[out] thumbnail The thumbnail path
264 * @return 0 on success, otherwise a negative error value
265 * @retval #STICKER_ERROR_NONE Successful
266 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
267 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
268 * @see sticker_data_set_thumbnail()
270 int sticker_data_get_thumbnail(sticker_data_h data_handle, char **thumbnail);
273 * @brief Sets the description of the sticker.
275 * @remarks @a description must have a non-null value. If not, the error as invalid parameter will be returned.
276 * @param[in] data_handle The sticker data handle
277 * @param[in] description The description to be saved
278 * @return 0 on success, otherwise a negative error value
279 * @retval #STICKER_ERROR_NONE Successful
280 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
281 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
282 * @see sticker_data_get_description()
284 int sticker_data_set_description(sticker_data_h data_handle, const char *description);
287 * @brief Gets the description from sticker data handle.
288 * @details If the description is empty, the result will be an empty string.
290 * @remarks @a description must be released using free().
291 * @param[in] data_handle The sticker data handle
292 * @param[out] description The description of the sticker
293 * @return 0 on success, otherwise a negative error value
294 * @retval #STICKER_ERROR_NONE Successful
295 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
296 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
297 * @see sticker_data_set_description()
299 int sticker_data_get_description(sticker_data_h data_handle, char **description);
302 * @brief Gets the last updated date from sticker data handle.
303 * @details The format of @a date is YYYY-MM-DD HH:MM:SS.
305 * @remarks @a date must be released using free().
306 * @param[in] data_handle The sticker data handle
307 * @param[out] date The last updated date
308 * @return 0 on success, otherwise a negative error value
309 * @retval #STICKER_ERROR_NONE Successful
310 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
311 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
312 * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
314 int sticker_data_get_date(sticker_data_h data_handle, char **date);
317 * @brief Sets the display type of the sticker.
319 * @param[in] data_handle The sticker data handle
320 * @param[in] type The display type to be saved
321 * @return 0 on success, otherwise a negative error value
322 * @retval #STICKER_ERROR_NONE Successful
323 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
324 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
325 * @see sticker_data_get_display_type()
327 int sticker_data_set_display_type(sticker_data_h data_handle, sticker_data_display_type_e type);
330 * @brief Gets the display type from sticker data handle.
331 * @details If the display type is empty, the result will be a zero.
333 * @param[in] data_handle The sticker data handle
334 * @param[out] type The display type of the sticker
335 * @return 0 on success, otherwise a negative error value
336 * @retval #STICKER_ERROR_NONE Successful
337 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
338 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
339 * @see sticker_data_set_display_type()
341 int sticker_data_get_display_type(sticker_data_h data_handle, sticker_data_display_type_e *type);
351 #endif /* __TIZEN_UIX_STICKER_DATA_H__ */