4 * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __TIZEN_SOCIAL_CALENDAR_RECORD_H__
21 #define __TIZEN_SOCIAL_CALENDAR_RECORD_H__
23 #include <calendar_types.h>
30 * @file calendar_record.h
34 * @addtogroup CAPI_SOCIAL_CALENDAR_SVC_RECORD_MODULE
39 * @brief Creates a record handle.
41 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
43 * @remarks You must release @a record using calendar_record_destroy().
45 * @param[in] view_uri The view URI
46 * @param[out] out_record The record handle
48 * @return @c 0 on success,
49 * otherwise a negative error value
50 * @retval #CALENDAR_ERROR_NONE Successful
51 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
52 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
53 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
55 * @pre calendar_connect() should be called to initialize.
57 * @see calendar_record_destroy()
59 int calendar_record_create(const char* view_uri, calendar_record_h* out_record);
62 * @brief Destroys a record handle and releases all its resources.
64 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
66 * @param[in] record The record handle
67 * @param[in] delete_child If @c true, child records are destroyed automatically,
70 * @return @c 0 on success,
71 * otherwise a negative error value
72 * @retval #CALENDAR_ERROR_NONE Successful
73 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
74 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
76 * @see calendar_record_create()
78 int calendar_record_destroy(calendar_record_h record, bool delete_child);
81 * @brief Makes a clone of a record handle.
83 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
85 * @remarks You must release @a cloned_record using calendar_record_destroy().
87 * @param[in] record The record handle
88 * @param[out] out_record The cloned record handle
90 * @return @c 0 on success,
91 * otherwise a negative error value
92 * @retval #CALENDAR_ERROR_NONE Successful
93 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
94 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
96 * @see calendar_record_destroy()
98 int calendar_record_clone(calendar_record_h record, calendar_record_h* out_record);
101 * @brief Gets a URI string from a record.
103 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
105 * @param[in] record The record handle
106 * @param[out] uri The URI of the record
108 * @return @c 0 on success,
109 * otherwise a negative error value
110 * @retval #CALENDAR_ERROR_NONE Successful
111 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
113 int calendar_record_get_uri_p(calendar_record_h record, char** uri);
116 * @brief Gets a string from a record.
118 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
120 * @remarks You must release @a value using free().
122 * @param[in] record The record handle
123 * @param[in] property_id The property ID
124 * @param[out] out_str The result value
126 * @return @c 0 on success,
127 * otherwise a negative error value
128 * @retval #CALENDAR_ERROR_NONE Successful
129 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
130 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
132 * @see calendar_record_get_str_p()
133 * @see calendar_record_set_str()
135 int calendar_record_get_str(calendar_record_h record, unsigned int property_id, char** out_str);
138 * @brief Gets a string pointer from a record.
140 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
142 * @remarks You MUST NOT release @a value.
144 * @param[in] record The record handle
145 * @param[in] property_id The property ID
146 * @param[out] out_str The result value
148 * @return @c 0 on success,
149 * otherwise a negative error value
150 * @retval #CALENDAR_ERROR_NONE Successful
151 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
152 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
154 * @see calendar_record_get_str()
155 * @see calendar_record_set_str()
157 int calendar_record_get_str_p(calendar_record_h record, unsigned int property_id, char** out_str);
160 * @brief Gets an integer value from a record.
162 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
164 * @param[in] record The record handle
165 * @param[in] property_id The property ID
166 * @param[out] out_value The result value
168 * @return @c 0 on success,
169 * otherwise a negative error value
170 * @retval #CALENDAR_ERROR_NONE Successful
171 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
172 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
174 * @see calendar_record_set_int()
176 int calendar_record_get_int(calendar_record_h record, unsigned int property_id, int* out_value);
179 * @brief Gets a double value from a record.
181 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
183 * @param[in] record The record handle
184 * @param[in] property_id The property ID
185 * @param[out] out_value The result value
187 * @return @c 0 on success,
188 * otherwise a negative error value
189 * @retval #CALENDAR_ERROR_NONE Successful
190 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
191 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
193 * @see calendar_record_set_double()
195 int calendar_record_get_double(calendar_record_h record, unsigned int property_id, double* out_value);
198 * @brief Gets a long long integer value from a record.
200 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
202 * @param[in] record The record handle
203 * @param[in] property_id The property ID
204 * @param[out] out_value The result value
206 * @return @c 0 on success,
207 * otherwise a negative error value
208 * @retval #CALENDAR_ERROR_NONE Successful
209 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
210 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
212 * @see calendar_record_set_lli()
214 int calendar_record_get_lli(calendar_record_h record, unsigned int property_id, long long int* out_value);
217 * @brief Gets a calendar_caltime_s value from a record.
219 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
221 * @param[in] record The record handle
222 * @param[in] property_id The property ID
223 * @param[out] out_value The result value
225 * @return @c 0 on success,
226 * otherwise a negative error value
227 * @retval #CALENDAR_ERROR_NONE Successful
228 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
229 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
231 * @see calendar_record_set_caltime()
233 int calendar_record_get_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s* out_value);
236 * @brief Sets a string to a record.
238 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
240 * @param[in] record The record handle
241 * @param[in] property_id The property ID
242 * @param[in] value The value to be set
244 * @return @c 0 on success,
245 * otherwise a negative error value
246 * @retval #CALENDAR_ERROR_NONE Successful
247 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
248 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
250 * @see calendar_record_get_str()
251 * @see calendar_record_get_str_p()
253 int calendar_record_set_str(calendar_record_h record, unsigned int property_id, const char* value);
256 * @brief Sets an integer value to a record.
258 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
260 * @param[in] record The record handle
261 * @param[in] property_id The property ID
262 * @param[in] value The value to be set
264 * @return @c 0 on success,
265 * otherwise a negative error value
266 * @retval #CALENDAR_ERROR_NONE Successful
267 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
268 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
270 * @see calendar_record_get_int()
272 int calendar_record_set_int(calendar_record_h record, unsigned int property_id, int value);
275 * @brief Sets a double value to a record.
277 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
279 * @param[in] record The record handle
280 * @param[in] property_id The property ID
281 * @param[in] value The value to be set
283 * @return @c 0 on success,
284 * otherwise a negative error value
285 * @retval #CALENDAR_ERROR_NONE Successful
286 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
287 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
289 * @see calendar_record_get_double()
291 int calendar_record_set_double(calendar_record_h record, unsigned int property_id, double value);
294 * @brief Sets a long long integer value to a record.
296 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
298 * @param[in] record The record handle
299 * @param[in] property_id The property ID
300 * @param[in] value The value to be set
302 * @return @c 0 on success,
303 * otherwise a negative error value
304 * @retval #CALENDAR_ERROR_NONE Successful
305 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
306 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
308 * @see calendar_record_get_lli()
310 int calendar_record_set_lli(calendar_record_h record, unsigned int property_id, long long int value);
313 * @brief Sets a calendar_time_s value to a record.
315 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
317 * @param[in] record The record handle
318 * @param[in] property_id The property ID
319 * @param[in] value The value to be set
321 * @return @c 0 on success,
322 * otherwise a negative error value
323 * @retval #CALENDAR_ERROR_NONE Successful
324 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
325 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
327 * @see calendar_record_get_caltime()
329 int calendar_record_set_caltime(calendar_record_h record, unsigned int property_id, calendar_time_s value);
332 * @brief Adds a child record to the parent record.
334 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
336 * @param[in] record The parent record handle
337 * @param[in] property_id The property ID
338 * @param[in] child_record The handle of the child record to be added to the parent record
340 * @return @c 0 on success,
341 * otherwise a negative error value
342 * @retval #CALENDAR_ERROR_NONE Successful
343 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
344 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
346 * @see calendar_record_remove_child_record()
348 int calendar_record_add_child_record(calendar_record_h record, unsigned int property_id, calendar_record_h child_record);
351 * @brief Removes a child record from the parent record.
353 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
355 * @param[in] record The parent record handle
356 * @param[in] property_id The property ID
357 * @param[in] child_record The handle of the child record to be removed from the parent record
359 * @return @c 0 on success,
360 * otherwise a negative error value
361 * @retval #CALENDAR_ERROR_NONE Successful
362 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
363 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
365 * @see calendar_record_add_child_record()
367 int calendar_record_remove_child_record(calendar_record_h record, unsigned int property_id, calendar_record_h child_record);
370 * @brief Gets the number of child records in a record.
372 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
374 * @param[in] record The parent record handle
375 * @param[in] property_id The property ID
376 * @param[out] count The child record count
378 * @return @c 0 on success,
379 * otherwise a negative error value
380 * @retval #CALENDAR_ERROR_NONE Successful
381 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
382 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
384 * @see calendar_record_add_child_record()
385 * @see calendar_record_remove_child_record()
387 int calendar_record_get_child_record_count(calendar_record_h record, unsigned int property_id, unsigned int* count);
390 * @brief Gets a child record handle pointer from the parent record.
392 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
394 * @remarks You MUST NOT release @a child_record. \n It is released when the parent record handle is destroyed.
396 * @param[in] record The record handle
397 * @param[in] property_id The property ID
398 * @param[in] index The index of the child record
399 * @param[out] child_record The child record handle pointer
401 * @return @c 0 on success,
402 * otherwise a negative error value
403 * @retval #CALENDAR_ERROR_NONE Successful
404 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
405 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
407 * @see calendar_record_add_child_record()
408 * @see calendar_record_remove_child_record()
409 * @see calendar_record_get_child_record_count()
411 int calendar_record_get_child_record_at_p(calendar_record_h record, unsigned int property_id, int index, calendar_record_h* child_record);
414 * @brief Makes a clone of a given record's child record list.
416 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
418 * @remarks You must release @a cloned_list using calendar_list_destroy().
420 * @param[in] record The record handle
421 * @param[in] property_id The property ID
422 * @param[out] out_list The cloned list handle
424 * @return @c 0 on success,
425 * otherwise a negative error value
426 * @retval #CALENDAR_ERROR_NONE Successful
427 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
428 * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
430 * @see calendar_list_destroy()
432 int calendar_record_clone_child_record_list(calendar_record_h record, unsigned int property_id, calendar_list_h* out_list);
442 #endif /* __TIZEN_SOCIAL_CALENDAR_RECORD_H__ */