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_NO_DATA No data available
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 * @see sticker_data_get_uri()
144 int sticker_data_set_uri(sticker_data_h data_handle, sticker_data_uri_type_e type, const char *uri);
147 * @brief Gets the URI and URI type from sticker data handle.
149 * @remarks @a uri must be released using free().
150 * @param[in] data_handle The sticker data handle
151 * @param[out] type The URI type
152 * @param[out] uri The URI
153 * @return 0 on success, otherwise a negative error value
154 * @retval #STICKER_ERROR_NONE Successful
155 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
156 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
157 * @retval #STICKER_ERROR_NO_DATA No data available
158 * @see sticker_data_set_uri()
160 int sticker_data_get_uri(sticker_data_h data_handle, sticker_data_uri_type_e *type, char **uri);
163 * @brief Retrieves all keywords of the sticker using callback function.
165 * @param[in] data_handle The sticker data handle
166 * @param[in] callback The callback function to invoke
167 * @param[in] user_data The user data to be passed to the callback function
168 * @return 0 on success, otherwise a negative error value
169 * @retval #STICKER_ERROR_NONE Successful
170 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
171 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
172 * @retval #STICKER_ERROR_NO_DATA No data available
173 * @post This function invokes sticker_data_keyword_foreach_cb() repeatedly for getting keywords.
174 * @see sticker_data_keyword_foreach_cb()
175 * @see sticker_data_add_keyword()
176 * @see sticker_data_remove_keyword()
178 int sticker_data_foreach_keyword(sticker_data_h data_handle, sticker_data_keyword_foreach_cb callback, void *user_data);
181 * @brief Adds a keyword of the sticker to the list.
183 * @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.
184 * @param[in] data_handle The sticker data handle
185 * @param[in] keyword The keyword to be saved
186 * @return 0 on success, otherwise a negative error value
187 * @retval #STICKER_ERROR_NONE Successful
188 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
189 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
190 * @see sticker_data_keyword_foreach_cb()
191 * @see sticker_data_foreach_keyword()
192 * @see sticker_data_remove_keyword()
194 int sticker_data_add_keyword(sticker_data_h data_handle, const char *keyword);
197 * @brief Removes a keyword of the sticker from the list.
199 * @remarks @a keyword must exist value in the list. If not, the error as invalid parameter will be returned.
200 * @param[in] data_handle The sticker data handle
201 * @param[in] keyword The keyword to be removed
202 * @return 0 on success, otherwise a negative error value
203 * @retval #STICKER_ERROR_NONE Successful
204 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
205 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
206 * @see sticker_data_keyword_foreach_cb()
207 * @see sticker_data_foreach_keyword()
208 * @see sticker_data_add_keyword()
210 int sticker_data_remove_keyword(sticker_data_h data_handle, const char *keyword);
213 * @brief Sets the group name of the sticker.
215 * @remarks @a group must have a non-null value. If not, the error as invalid parameter will be returned.
216 * @param[in] data_handle The sticker data handle
217 * @param[in] group The group name to be saved
218 * @return 0 on success, otherwise a negative error value
219 * @retval #STICKER_ERROR_NONE Successful
220 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
221 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
222 * @see sticker_data_get_group()
224 int sticker_data_set_group_name(sticker_data_h data_handle, const char *group);
227 * @brief Gets the group name from sticker data handle.
229 * @remarks @a group must be released using free().
230 * @param[in] data_handle The sticker data handle
231 * @param[out] group The group name
232 * @return 0 on success, otherwise a negative error value
233 * @retval #STICKER_ERROR_NONE Successful
234 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
235 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
236 * @retval #STICKER_ERROR_NO_DATA No data available
237 * @see sticker_data_set_group()
239 int sticker_data_get_group_name(sticker_data_h data_handle, char **group);
242 * @brief Sets the thumbnail local path of the sticker.
243 * @details @a thumbnail must be a relative path like '/res/smile_thumbnail.png'.
245 * @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.
246 * @param[in] data_handle The sticker data handle
247 * @param[in] thumbnail The thumbnail path to be saved
248 * @return 0 on success, otherwise a negative error value
249 * @retval #STICKER_ERROR_NONE Successful
250 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
251 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
252 * @see sticker_data_get_thumbnail()
254 int sticker_data_set_thumbnail(sticker_data_h data_handle, const char *thumbnail);
257 * @brief Gets the thumbnail local path from sticker data handle.
258 * @details If the thumbnail is empty, the result will be an empty string.
260 * @remarks @a thumbnail must be released using free().
261 * @param[in] data_handle The sticker data handle
262 * @param[out] thumbnail The thumbnail path
263 * @return 0 on success, otherwise a negative error value
264 * @retval #STICKER_ERROR_NONE Successful
265 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
266 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
267 * @see sticker_data_set_thumbnail()
269 int sticker_data_get_thumbnail(sticker_data_h data_handle, char **thumbnail);
272 * @brief Sets the description of the sticker.
274 * @remarks @a description must have a non-null value. If not, the error as invalid parameter will be returned.
275 * @param[in] data_handle The sticker data handle
276 * @param[in] description The description to be saved
277 * @return 0 on success, otherwise a negative error value
278 * @retval #STICKER_ERROR_NONE Successful
279 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
280 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
281 * @see sticker_data_get_description()
283 int sticker_data_set_description(sticker_data_h data_handle, const char *description);
286 * @brief Gets the description from sticker data handle.
287 * @details If the description is empty, the result will be an empty string.
289 * @remarks @a description must be released using free().
290 * @param[in] data_handle The sticker data handle
291 * @param[out] description The description of the sticker
292 * @return 0 on success, otherwise a negative error value
293 * @retval #STICKER_ERROR_NONE Successful
294 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
295 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
296 * @see sticker_data_set_description()
298 int sticker_data_get_description(sticker_data_h data_handle, char **description);
301 * @brief Gets the last updated date from sticker data handle.
302 * @details The format of @a date is YYYY-MM-DD HH:MM:SS.
304 * @remarks @a date must be released using free().
305 * @param[in] data_handle The sticker data handle
306 * @param[out] date The last updated date
307 * @return 0 on success, otherwise a negative error value
308 * @retval #STICKER_ERROR_NONE Successful
309 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
310 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
311 * @retval #STICKER_ERROR_NO_DATA No data available
313 int sticker_data_get_date(sticker_data_h data_handle, char **date);
316 * @brief Sets the display type of the sticker.
318 * @param[in] data_handle The sticker data handle
319 * @param[in] type The display type to be saved
320 * @return 0 on success, otherwise a negative error value
321 * @retval #STICKER_ERROR_NONE Successful
322 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
323 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
324 * @see sticker_data_get_display_type()
326 int sticker_data_set_display_type(sticker_data_h data_handle, sticker_data_display_type_e type);
329 * @brief Gets the display type from sticker data handle.
330 * @details If the display type is empty, the result will be a zero.
332 * @param[in] data_handle The sticker data handle
333 * @param[out] type The display type of the sticker
334 * @return 0 on success, otherwise a negative error value
335 * @retval #STICKER_ERROR_NONE Successful
336 * @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
337 * @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
338 * @see sticker_data_set_display_type()
340 int sticker_data_get_display_type(sticker_data_h data_handle, sticker_data_display_type_e *type);
350 #endif /* __TIZEN_UIX_STICKER_DATA_H__ */