[TCSACR-81][ADD] Added new property to get account handle
[platform/core/csapi/tizenfx.git] / src / Tizen.Account.AccountManager / Interop / Interop.Account.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 using System;
18 using System.Runtime.InteropServices;
19 using Tizen.Account.AccountManager;
20 /// <summary>
21 /// Interop for Account class APIs.
22 /// </summary>
23 /// <since_tizen> 3 </since_tizen>
24 internal static partial class Interop
25 {
26     /// <summary>
27     /// Interop for Account class APIs.
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     internal static partial class Account
31     {
32         [DllImport(Libraries.AccountSvc, EntryPoint = "account_create", CallingConvention = CallingConvention.Cdecl)]
33         internal static extern int Create(out SafeAccountHandle handle);
34
35
36         [DllImport(Libraries.AccountSvc, EntryPoint = "account_destroy", CallingConvention = CallingConvention.Cdecl)]
37         internal static extern int Destroy(IntPtr handle);
38
39         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_account_id", CallingConvention = CallingConvention.Cdecl)]
40         internal static extern int GetAccountId(SafeAccountHandle data, out int accountId);
41
42         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_name", CallingConvention = CallingConvention.Cdecl)]
43         internal static extern int GetAccountUserName(SafeAccountHandle data, out string userName);
44
45         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_name", CallingConvention = CallingConvention.Cdecl)]
46         internal static extern int SetAccountUserName(SafeAccountHandle handle, string userName);
47
48         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_display_name", CallingConvention = CallingConvention.Cdecl)]
49         internal static extern int GetAccountDisplayName(SafeAccountHandle handle, out string displayName);
50
51         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_display_name", CallingConvention = CallingConvention.Cdecl)]
52         internal static extern int SetAccountDisplayName(SafeAccountHandle handle, string displayName);
53
54         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability", CallingConvention = CallingConvention.Cdecl)]
55         internal static extern int GetAccountCapability(SafeAccountHandle handle, string capabilityType, out int capabilityValue);
56
57         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_capability", CallingConvention = CallingConvention.Cdecl)]
58         internal static extern int SetAccountCapability(SafeAccountHandle handle, string capabilityType, int capabilityValue);
59
60         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_icon_path", CallingConvention = CallingConvention.Cdecl)]
61         internal static extern int GetAccountIconPath(SafeAccountHandle handle, out string iconPath);
62
63         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_icon_path", CallingConvention = CallingConvention.Cdecl)]
64         internal static extern int SetAccountIconPath(SafeAccountHandle handle, string iconPath);
65
66         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_domain_name", CallingConvention = CallingConvention.Cdecl)]
67         internal static extern int GetAccountDomainName(SafeAccountHandle handle, out string domainName);
68
69         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_domain_name", CallingConvention = CallingConvention.Cdecl)]
70         internal static extern int SetAccountDomainName(SafeAccountHandle handle, string domainName);
71
72         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_email_address", CallingConvention = CallingConvention.Cdecl)]
73         internal static extern int GetAccountEmail(SafeAccountHandle handle, out string email);
74
75         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_email_address", CallingConvention = CallingConvention.Cdecl)]
76         internal static extern int SetAccountEmail(SafeAccountHandle handle, string email);
77
78         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_package_name", CallingConvention = CallingConvention.Cdecl)]
79         internal static extern int GetAccountPackageName(SafeAccountHandle handle, out string name);
80
81         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_package_name", CallingConvention = CallingConvention.Cdecl)]
82         internal static extern int SetAccountPackageName(SafeAccountHandle handle, string name);
83
84         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_access_token", CallingConvention = CallingConvention.Cdecl)]
85         internal static extern int GetAccountAccessToken(SafeAccountHandle handle, out string accessToken);
86
87         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_access_token", CallingConvention = CallingConvention.Cdecl)]
88         internal static extern int SetAccountAccessToken(SafeAccountHandle handle, string accessToken);
89
90         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_text", CallingConvention = CallingConvention.Cdecl)]
91         internal static extern int GetAccountUserText(SafeAccountHandle handle, int index, out string userText);
92
93         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_text", CallingConvention = CallingConvention.Cdecl)]
94         internal static extern int SetAccountUserText(SafeAccountHandle handle, int index, string userText);
95
96         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_int", CallingConvention = CallingConvention.Cdecl)]
97         internal static extern int GetAccountUserInt(SafeAccountHandle handle, int index, out int value);
98
99         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_int", CallingConvention = CallingConvention.Cdecl)]
100         internal static extern int SetAccountUserInt(SafeAccountHandle handle, int index, int value);
101
102         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_auth_type", CallingConvention = CallingConvention.Cdecl)]
103         internal static extern int GetAccountAuthType(SafeAccountHandle handle, out int authType);
104
105         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_auth_type", CallingConvention = CallingConvention.Cdecl)]
106         internal static extern int SetAccountAuthType(SafeAccountHandle handle, int authType);
107
108         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_secret", CallingConvention = CallingConvention.Cdecl)]
109         internal static extern int GetAccountSercet(SafeAccountHandle handle, out int secretType);
110
111         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_secret", CallingConvention = CallingConvention.Cdecl)]
112         internal static extern int SetAccountSecret(SafeAccountHandle handle, int secretType);
113
114         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_sync_support", CallingConvention = CallingConvention.Cdecl)]
115         internal static extern int GetAccountSyncSupport(SafeAccountHandle handle, out int syncType);
116
117         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_sync_support", CallingConvention = CallingConvention.Cdecl)]
118         internal static extern int SetAccountSyncSupport(SafeAccountHandle handle, int syncType);
119
120         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_source", CallingConvention = CallingConvention.Cdecl)]
121         internal static extern int GetAccountSource(SafeAccountHandle handle, out string source);
122
123         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_source", CallingConvention = CallingConvention.Cdecl)]
124         internal static extern int SetAccountSource(SafeAccountHandle handle, string source);
125
126         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom", CallingConvention = CallingConvention.Cdecl)]
127         internal static extern int GetAccountCustomValue(SafeAccountHandle handle, string key, out string value);
128
129         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_custom", CallingConvention = CallingConvention.Cdecl)]
130         internal static extern int SetAccountCustomValue(SafeAccountHandle handle, string key, string value);
131
132         [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)]
133         internal static extern int UpdateAccountSyncStatusById(int accountId, int status);
134
135         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability_all")]
136         internal static extern int GetAllAccountCapabilities(SafeAccountHandle handle, AccountCapabilityCallback callback, IntPtr userData);
137
138         [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id")]
139         internal static extern int QueryAccountCapabilityById(AccountCapabilityCallback callback, int accountId, IntPtr userData);
140
141         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom_all")]
142         internal static extern int GetAllAccountCustomValues(SafeAccountHandle handle, AccountCustomCallback callback, IntPtr userData);
143
144         //Callbacks
145         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
146         internal delegate bool AccountCapabilityCallback(string capabilityType, int capabilityState, IntPtr userData);
147
148         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
149         internal delegate bool AccountCustomCallback(string key, string value, IntPtr userData);
150
151         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
152         internal delegate bool AccountCallback(IntPtr data, IntPtr userData);
153     }
154 }