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 The sticker data handle.
50 typedef struct sticker_data_s *sticker_data_h;
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.
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()
62 typedef void (*sticker_data_keyword_foreach_cb)(const char *keyword, void *user_data);
65 * @brief Creates a sticker data handle.
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()
77 int sticker_data_create(sticker_data_h *data_handle);
80 * @brief Destroys a sticker data handle.
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()
89 int sticker_data_destroy(sticker_data_h data_handle);
92 * @brief Clones a sticker data handle.
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()
104 int sticker_data_clone(sticker_data_h origin_handle, sticker_data_h *target_handle);
107 * @brief Gets the name of the sticker provider application from sticker data handle.
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
118 int sticker_data_get_app_id(sticker_data_h data_handle, char **app_id);
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.
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()
135 int sticker_data_set_uri(sticker_data_h data_handle, sticker_data_uri_type_e type, const char *uri);
138 * @brief Gets the URI and URI type from sticker data handle.
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()
151 int sticker_data_get_uri(sticker_data_h data_handle, sticker_data_uri_type_e *type, char **uri);
154 * @brief Retrieves all keywords of the sticker using callback function.
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()
169 int sticker_data_foreach_keyword(sticker_data_h data_handle, sticker_data_keyword_foreach_cb callback, void *user_data);
172 * @brief Adds a keyword of the sticker to the list.
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()
185 int sticker_data_add_keyword(sticker_data_h data_handle, const char *keyword);
188 * @brief Removes a keyword of the sticker from the list.
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()
201 int sticker_data_remove_keyword(sticker_data_h data_handle, const char *keyword);
204 * @brief Sets the group name of the sticker.
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()
215 int sticker_data_set_group_name(sticker_data_h data_handle, const char *group);
218 * @brief Gets the group name from sticker data handle.
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()
230 int sticker_data_get_group_name(sticker_data_h data_handle, char **group);
233 * @brief Sets the thumbnail local path of the sticker.
234 * @details @a thumbnail must be a relative path like '/res/smile_thumbnail.png'.
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()
245 int sticker_data_set_thumbnail(sticker_data_h data_handle, const char *thumbnail);
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.
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()
260 int sticker_data_get_thumbnail(sticker_data_h data_handle, char **thumbnail);
263 * @brief Sets the description of the sticker.
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()
274 int sticker_data_set_description(sticker_data_h data_handle, const char *description);
277 * @brief Gets the description from sticker data handle.
278 * @details If the description is empty, the result will be an empty string.
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()
289 int sticker_data_get_description(sticker_data_h data_handle, char **description);
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.
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
304 int sticker_data_get_date(sticker_data_h data_handle, char **date);
314 #endif /* __TIZEN_UIX_STICKER_DATA_H__ */