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_QUERY_H__
21 #define __TIZEN_SOCIAL_CALENDAR_QUERY_H__
23 #include <calendar_types.h>
30 * @file calendar_query.h
34 * @addtogroup CAPI_SOCIAL_CALENDAR_SVC_QUERY_MODULE
39 * @brief Creates a query handle.
40 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
41 * @remarks You must release @a query using calendar_query_destroy().
42 * @param[in] view_uri The view URI of a query
43 * @param[out] query The filter handle
44 * @return @c 0 on success,
45 * otherwise a negative error value
46 * @retval #CALENDAR_ERROR_NONE Successful
47 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
48 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
49 * @pre calendar_connect() should be called to initialize.
50 * @see calendar_query_destroy()
52 int calendar_query_create(const char* view_uri, calendar_query_h* query);
56 * @brief Destroys a query handle.
57 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
58 * @param[in] query The query handle
59 * @return @c 0 on success,
60 * otherwise a negative error value
61 * @retval #CALENDAR_ERROR_NONE Successful
62 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
63 * @see calendar_query_create()
65 int calendar_query_destroy(calendar_query_h query);
69 * @brief Adds property IDs for projection.
70 * @details Property IDs can be of one of the properties of view_uri which is used in calendar_query_create().
71 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
72 * @param[in] query The query handle
73 * @param[in] property_id_array The property ID array
74 * @param[in] count The number of property IDs
75 * @return @c 0 on success,
76 * otherwise a negative error value
77 * @retval #CALENDAR_ERROR_NONE Successful
78 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
80 int calendar_query_set_projection(calendar_query_h query, unsigned int property_id_array[], int count);
84 * @brief Sets the "distinct" option for projection.
85 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
86 * @param[in] query The query handle
87 * @param[in] set If @c true it is set,
88 * otherwise if @c false it is unset
89 * @return @c 0 on success,
90 * otherwise a negative error value
91 * @retval #CALENDAR_ERROR_NONE Successful
92 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
94 int calendar_query_set_distinct(calendar_query_h query, bool set);
98 * @brief Sets the filter for a query.
99 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
100 * @param[in] query The query handle
101 * @param[in] filter The filter handle
102 * @return @c 0 on success,
103 * otherwise a negative error value
104 * @retval #CALENDAR_ERROR_NONE Successful
105 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
106 * @retval #CALENDAR_ERROR_NO_DATA Requested data does not exist
107 * @see calendar_query_add_operator()
109 int calendar_query_set_filter(calendar_query_h query, calendar_filter_h filter);
113 * @brief Sets the sort mode for a query.
114 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
115 * @param[in] query The query handle
116 * @param[in] property_id The property ID to sort
117 * @param[in] is_ascending If @c true it sorts in the ascending order,
118 * otherwise if @c false it sorts in the descending order
119 * @return @c 0 on success,
120 * otherwise a negative error value
121 * @retval #CALENDAR_ERROR_NONE Successful
122 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
124 int calendar_query_set_sort(calendar_query_h query, unsigned int property_id, bool is_ascending);
135 #endif /* __TIZEN_SOCIAL_CALENDAR_QUERY_H__ */