summaryrefslogtreecommitdiff
path: root/include/contacts_email.h
blob: 3522c90ec5228d5fb507a8a822e15fc6109a9eef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */


#ifndef __TIZEN_SOCIAL_CONTACTS_EMAIL_H__
#define __TIZEN_SOCIAL_CONTACTS_EMAIL_H__

#include <contacts_types.h>

#ifdef __cplusplus
extern "C"
{
#endif

/**
 * @addtogroup CAPI_SOCIAL_CONTACTS_EMAIL_MODULE
 * @{
 */

/**
 * @brief   Creates a handle to the contacts email.
 *
 * @remarks		@a email must be released with contact_email_destroy() by you. \n
 * @a email is not added to contacts database until contact_insert_to_db() is called.
 *
 * @param[out]  email       A new contacts email handle
 *
 * @return  0 on success, otherwise a negative error value.
 * @retval  #CONTACTS_ERROR_NONE                Successful
 * @retval  #CONTACTS_ERROR_INVALID_PARAMETER   Invalid parameter
 * @retval  #CONTACTS_ERROR_OUT_OF_MEMORY       Out of memory
 *
 * @see contact_email_destroy()
 *
 */
int contact_email_create(contact_email_h *email);

/**
 * @brief   Destroys the handle to contacts email.
 *
 * @param[in]   email       The contacts email handle
 *
 * @return  0 on success, otherwise a negative error value.
 * @retval  #CONTACTS_ERROR_NONE                Successful
 * @retval  #CONTACTS_ERROR_INVALID_PARAMETER   Invalid parameter
 *
 * @see contact_email_create()
 *
 */
int contact_email_destroy(contact_email_h email);


/**
 * @brief       Gets the email type from the contacts email handle.
 *
 * @param[in]   email       The contacts email handle
 * @param[out]  type       The email type to be returned 
 *
 * @return  0 on success, otherwise a negative error value.
 * @retval  #CONTACTS_ERROR_NONE        Successful
 * @retval  #CONTACTS_ERROR_INVALID_PARAMETER    Invalid parameter
 * @see contact_email_set_type()
 */
int contact_email_get_type(contact_email_h email, contact_email_type_e *type);
/**
 * @brief       Sets an email type to the contacts email handle.
 *
 * @param[in]   email       The contacts email handle
 * @param[in]   type        The email type to set
 *
 * @return 0 on success, otherwise a negative error value.
 * @retval  #CONTACTS_ERROR_NONE        Successful
 * @retval  #CONTACTS_ERROR_INVALID_PARAMETER    Invalid parameter
 * @see contact_email_get_type()
 *
 */
int contact_email_set_type(contact_email_h email, contact_email_type_e type);

/**
 * @brief       Gets the email address from the contacts email handle.
 *	
 *
 * @remarks  @a address must be released with free() by you. 
 * @param[in]   email       The contacts email handle
 * @param[out]  address    The email address to be returned \n
 * 					If address does not exist, @a address is NULL
 *
 * @return  0 on success, otherwise a negative error value.
 * @retval  #CONTACTS_ERROR_NONE        Successful
 * @retval  #CONTACTS_ERROR_INVALID_PARAMETER    Invalid parameter
 *
 * @see contact_email_set_address()
 *
 */
int contact_email_get_address(contact_email_h email, char **address);

/**
 * @brief 		Sets an email address to the contacts email handle.
 *
 * @param[in]	email 		The contacts email handle
 * @param[in]	address		The email address to set
 *
 * @return 0 on success, otherwise a negative error value.
 * @retval	#CONTACTS_ERROR_NONE        Successful
 * @retval	#CONTACTS_ERROR_INVALID_PARAMETER    Invalid parameter
 *
 * @see  contact_email_get_address()
 *
 */
int contact_email_set_address(contact_email_h email, const char *address);

/**
 * @brief       Moves email list iterator to the next position and gets the contacts email handle.
 *
 * @details    If the next element for the current email address list exists, then the iterator is moved to 
 * the next position on the list and the contacts email handle for this position is returned. When the iterator reaches 
 * the last element of the list, all further calls will return #CONTACTS_ERROR_ITERATOR_END and @a email 
 * will remain unchanged.
 * 
 * @param[in]   email_iterator     The handle to the contacts email list 
 * @param[out]  email               The handle to contacts email, fetched from new iterator position 
 *
 * @return  0 on success, otherwise a negative error value.
 * @retval  #CONTACTS_ERROR_NONE                Successful
 * @retval  #CONTACTS_ERROR_INVALID_PARAMETER   Invalid parameter
 * @retval  #CONTACTS_ERROR_ITERATOR_END            List reached end
 *
 * @see contact_email_iterator_has_next()
 *
 */
int contact_email_iterator_next(contact_email_iterator_h *email_iterator, contact_email_h *email);

/**
 * @brief   Checks whether the next element of email iterator exists or not.
 *
 *
 * @param[in]   email_iterator    The handle to the email list
 *
 * @return  Return @c true If next element exists or @c false If next element doesn't exist  
 *
 * @see contact_email_iterator_next()
 */
bool contact_email_iterator_has_next(contact_email_iterator_h email_iterator);

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif /* __TIZEN_SOCIAL_CONTACTS_EMAIL_H__ */