Update the doxygen about removing and updating an account
[platform/framework/native/social.git] / inc / FSclAccountManager.h
1 //
2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17 * @file         FSclAccountManager.h
18 * @brief        This is the header file for the %AccountManager class.
19 *
20 * This header file contains the declarations of the %AccountManager class.
21 */
22 #ifndef _FSCL_ACCOUNT_MANAGER_H_
23 #define _FSCL_ACCOUNT_MANAGER_H_
24
25 #include <unique_ptr.h>
26 #include <FBaseObject.h>
27 #include <FBaseTypes.h>
28 #include <FSclTypes.h>
29
30 namespace Tizen { namespace Base
31 {
32 class String;
33 namespace Collection
34 {
35 class IList;
36 }
37 }}
38
39 namespace Tizen { namespace Social
40 {
41 class Account;
42 class AccountProvider;
43
44 /**
45  * @class       AccountManager
46  * @brief       This class provides methods for managing accounts.
47  * @since       2.1
48  *
49  * @final       This class is not intended for extension.
50  *
51  * The %AccountManager class provides methods for managing accounts.
52  *
53  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/social/acc_manage.htm">Account Management</a>.
54  */
55 class _OSP_EXPORT_ AccountManager
56         : public Tizen::Base::Object
57 {
58 public:
59         /**
60          * Adds an account. @n
61          * The user name must be set in the account.
62          * If the account is added successfully, an account ID is newly assigned to it. @n
63          * The %AddAccount() method can be used only by an application belonging to a package of an application that registers its own account provider.
64          *
65          * @since               2.1
66          * @privlevel   public
67          * @privilege   %http://tizen.org/privilege/account.write
68          *
69          * @return                      An error code
70          * @param[in,out]       account                                 The account to add @n
71          *                                                                                      If this method is successful, the account ID for the added account is assigned.
72          * @exception           E_SUCCESS                               The method is successful.
73          * @exception           E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
74          * @exception           E_INVALID_ARG                   Either of the following conditions has occurred:
75          *                                                                                      - The user name is an empty string in the specified @c account.
76          *                                                                                      - The account ID is not #INVALID_ACCOUNT_ID.
77          * @exception           E_INVALID_OPERATION             Either of the following conditions has occurred:
78          *                                                                                      - The caller application does not belong to a package of an application that registers its own account provider.
79          *                                                                                      - The account has already been added with the multiple accounts support set to @c false.
80          * @exception           E_USER_NOT_CONSENTED    The user has blocked the application from calling this method.
81          * @exception           E_SYSTEM                                The method cannot proceed due to a severe system error.
82          */
83         result AddAccount(Account& account);
84
85         /**
86          * Removes an account. @n
87          * The %RemoveAccount() method can be used only by the applications belonging to the package of the application that has registered the account provider of the specified account.
88          *
89          * @since               2.1
90          * @privlevel   public
91          * @privilege   %http://tizen.org/privilege/account.write
92          *
93          * @return              An error code
94          * @param[in]   accountId                               The account ID
95          * @exception   E_SUCCESS                               The method is successful.
96          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
97          * @exception   E_INVALID_ARG                   The specified @c accountId is invalid.
98          * @exception   E_OBJ_NOT_FOUND                 The specified @c accountId does not exist.
99          * @exception   E_INVALID_OPERATION             The caller application does not belong to the package of the application that has registered the account provider of the specified account.
100          * @exception   E_USER_NOT_CONSENTED    The user has blocked the application from calling this method.
101          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
102          */
103         result RemoveAccount(AccountId accountId);
104
105         /**
106          * Updates an account. @n
107          * The user name must be set in the account.
108          * The %UpdateAccount() method can be used only by the applications belonging to the package of the application that has registered the account provider of the specified account.
109          *
110          * @since               2.1
111          * @privlevel   public
112          * @privilege   %http://tizen.org/privilege/account.write
113          *
114          * @return              An error code
115          * @param[in]   account                                 The account to update
116          * @exception   E_SUCCESS                               The method is successful.
117          * @exception   E_PRIVILEGE_DENIED              The application does not have the privilege to call this method.
118          * @exception   E_INVALID_ARG                   Either of the following conditions has occurred:
119          *                                                                              - The user name is an empty string in the specified @c account.
120          *                                                                              - The account ID is invalid.
121          * @exception   E_OBJ_NOT_FOUND                 The specified @c account does not exist.
122          * @exception   E_INVALID_OPERATION             The caller application does not belong to the package of the application that has registered the account provider of the specified account.
123          * @exception   E_USER_NOT_CONSENTED    The user has blocked the application from calling this method.
124          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
125          */
126         result UpdateAccount(const Account& account);
127
128         /**
129          * Gets an %AccountManager instance.
130          *
131          * @since               2.1
132          *
133          * @return              A pointer to the %AccountManager instance, @n
134          *                              else @c null if it fails
135          * @remarks             The specific error code can be accessed using the GetLastResult() method.
136          */
137         static AccountManager* GetInstance(void);
138
139 private:
140         //
141         // This default constructor is intentionally declared as private to implement the Singleton semantic.
142         //
143         // @since               2.1
144         //
145         AccountManager(void);
146
147         //
148         // This destructor is intentionally declared as private to implement the Singleton semantic.
149         //
150         // @since               2.1
151         //
152         virtual ~AccountManager(void);
153
154         //
155         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
156         //
157         // @since               2.1
158         //
159         AccountManager(const AccountManager& rhs);
160
161         //
162         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
163         //
164         // @since               2.1
165         //
166         AccountManager& operator =(const AccountManager& rhs);
167
168         //
169         // Constructs an instance of this class.
170         //
171         // @since               2.1
172         //
173         // @return              An error code
174         // @exception   E_SUCCESS                       The method is successful.
175         // @exception   E_SYSTEM                        The method cannot proceed due to a severe system error.
176         //
177         result Construct(void);
178
179         //
180         // Initializes an instance of this class.
181         //
182         // @since               2.1
183         //
184         static void InitAccountManager(void);
185
186         //
187         // Destroys an instance of this class.
188         //
189         // @since               2.1
190         //
191         static void DestroyAccountManager(void);
192
193 private:
194         static AccountManager* __pInstance;
195         friend struct std::default_delete<AccountManager>;
196
197         friend class _AccountManagerImpl;
198         class _AccountManagerImpl* __pAccountManagerImpl;
199
200 };      // AccountManager
201
202 }}      // Tizen::Social
203
204 #endif //_FSCL_ACCOUNT_MANAGER_H_