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.
41 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
43 * @remarks You must release @a query using calendar_query_destroy().
45 * @param[in] view_uri The view URI of a query
46 * @param[out] query The filter handle
48 * @return @c 0 on success,
49 * otherwise a negative error value
50 * @retval #CALENDAR_ERROR_NONE Successful
51 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
52 * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
54 * @pre calendar_connect() should be called to initialize.
56 * @see calendar_query_destroy()
58 int calendar_query_create(const char* view_uri, calendar_query_h* query);
61 * @brief Destroys a query handle.
63 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
65 * @param[in] query The query handle
67 * @return @c 0 on success,
68 * otherwise a negative error value
69 * @retval #CALENDAR_ERROR_NONE Successful
70 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
72 * @see calendar_query_create()
74 int calendar_query_destroy(calendar_query_h query);
77 * @brief Adds property IDs for projection.
79 * @details Property IDs can be of one of the properties of view_uri which is used in calendar_query_create().
81 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
83 * @param[in] query The query handle
84 * @param[in] property_id_array The property ID array
85 * @param[in] count The number of property IDs
87 * @return @c 0 on success,
88 * otherwise a negative error value
89 * @retval #CALENDAR_ERROR_NONE Successful
90 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
92 int calendar_query_set_projection(calendar_query_h query, unsigned int property_id_array[], int count);
95 * @brief Sets the "distinct" option for projection.
97 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
99 * @param[in] query The query handle
100 * @param[in] set If @c true it is set,
101 * otherwise if @c false it is unset
103 * @return @c 0 on success,
104 * otherwise a negative error value
105 * @retval #CALENDAR_ERROR_NONE Successful
106 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
108 int calendar_query_set_distinct(calendar_query_h query, bool set);
111 * @brief Sets the filter for a query.
113 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
115 * @param[in] query The query handle
116 * @param[in] filter The filter handle
118 * @return @c 0 on success,
119 * otherwise a negative error value
120 * @retval #CALENDAR_ERROR_NONE Successful
121 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
122 * @retval #CALENDAR_ERROR_NO_DATA Requested data does not exist
124 * @see calendar_query_add_operator()
126 int calendar_query_set_filter(calendar_query_h query, calendar_filter_h filter);
129 * @brief Sets the sort mode for a query.
131 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
133 * @param[in] query The query handle
134 * @param[in] property_id The property ID to sort
135 * @param[in] is_ascending If @c true it sorts in the ascending order,
136 * otherwise if @c false it sorts in the descending order
138 * @return @c 0 on success,
139 * otherwise a negative error value
140 * @retval #CALENDAR_ERROR_NONE Successful
141 * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
143 int calendar_query_set_sort(calendar_query_h query, unsigned int property_id, bool is_ascending);
154 #endif /* __TIZEN_SOCIAL_CALENDAR_QUERY_H__ */