4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 #ifndef __EMAIL_API_RULE_H__
24 #define __EMAIL_API_RULE_H__
26 #include "email-types.h"
29 * @defgroup EMAIL_SERVICE Email Service
34 * @ingroup EMAIL_SERVICE
35 * @defgroup EMAIL_API_RULE Email Rule API
41 * This file contains the data structures and interfaces needed for application,
42 * to interact with email-service.
43 * @file email-api-rule.h
44 * @author Kyuho Jo <kyuho.jo@samsung.com>
45 * @author Sunghyun Kwon <sh0701.kwon@samsung.com>
47 * @brief This file contains the data structures and interfaces of Rule related Functionality provided by
52 * #include "email-api-rule.h"
54 * other_app_invoke_uniform_api_sample(int* error_code)
56 * int err = EMAIL_ERROR_NONE;
57 * email_rule_t* rule = NULL;
61 * // Get a information of filtering
62 * printf("Enter filter Id:\n");
63 * scanf("%d",&filter_id);
65 * if(EMAIL_ERROR_NONE == email_get_rule (filter_id,&rule))
70 * // Get all filterings
71 * if(EMAIL_ERROR_NONE == email_get_rule_list(&rule,&count))
77 * // Add a filter information
78 * if(EMAIL_ERROR_NONE == email_add_rule (rule))
82 * err = email_free_rule (&rule,1);
84 * // Change a filter information
85 * if(EMAIL_ERROR_NONE == email_update_rule (filter_id,rule))
89 * err = email_free_rule (&rule,1);
91 * // Delete a filter information
92 * printf("Enter filter Id:\n");
93 * scanf("%d",&filter_id);
95 * if(EMAIL_ERROR_NONE == email_delete_rule (filter_id))
100 * // Free allocated memory
101 * if(EMAIL_ERROR_NONE == email_free_rule (&rule,1))
116 #endif /* __cplusplus */
121 * @fn email_get_rule(int filter_id, email_rule_t** filtering_set)
122 * @brief Get a information of filtering.
124 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure
125 * @param[in] filter_id Specifies the filter ID.
126 * @param[out] filtering_set The returned information of filter are saved here.
127 * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument
131 EXPORT_API int email_get_rule(int filter_id, email_rule_t** filtering_set);
136 * @fn email_get_rule_list(email_rule_t** filtering_set, int* count)
137 * @brief Get all filterings.This function gives all the filter rules already set before by user.
138 * This will provide total number of filter rules available and information of all rules.
140 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure
141 * @param[out] filtering_set The returned filterings are saved here.(possibly NULL)
142 * @param[out] count The count of returned filters is saved here.(possibly 0)
143 * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument
147 EXPORT_API int email_get_rule_list(email_rule_t** filtering_set, int* count);
152 * @fn email_add_rule(email_rule_t* filtering_set)
153 * @brief Add a filter information.This function is invoked if user wants to add a new filter rule.
155 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
156 * @param[in] filtering_set Specifies the pointer of adding filter structure.
157 * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument
161 EXPORT_API int email_add_rule(email_rule_t* filtering_set);
166 * @fn email_update_rule(int filter_id, email_rule_t* new_set)
167 * @brief Change a filter information.This function will update the existing filter rule with new information.
169 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
170 * @param[in] filter_id Specifies the original filter ID.
171 * @param[in] new_set Specifies the information of new filter.
172 * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument
176 EXPORT_API int email_update_rule(int filter_id, email_rule_t* new_set);
180 * @fn email_delete_rule(int filter_id)
181 * @brief Delete a filter information.This function will delete the exsting filter information by specified filter Id.
183 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure
184 * @param[in] filter_id Specifies the filter ID.
185 * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument
189 EXPORT_API int email_delete_rule(int filter_id);
195 * @fn email_free_rule (email_rule_t** filtering_set, int count)
196 * @brief Free allocated memory.
198 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure
199 * @param[in] filtering_set Specifies the pointer of pointer of filter structure for memory free.
200 * @param[in] count Specifies the count of filter.
201 * @exception EMAIL_ERROR_INVALID_PARAM -Invalid argument
205 EXPORT_API int email_free_rule (email_rule_t** filtering_set, int count);
209 #endif /* __cplusplus */
216 #endif /* __EMAIL_API_RULE_H__ */