Release 4.0.0-preview1-00051
[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 IntPtr handle);
34
35         [DllImport(Libraries.AccountSvc, EntryPoint = "account_destroy", CallingConvention = CallingConvention.Cdecl)]
36         internal static extern int Destroy(IntPtr handle);
37
38         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_account_id", CallingConvention = CallingConvention.Cdecl)]
39         internal static extern int GetAccountId(IntPtr data, out int accountId);
40
41         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_name", CallingConvention = CallingConvention.Cdecl)]
42         internal static extern int GetAccountUserName(IntPtr data, out string userName);
43
44         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_name", CallingConvention = CallingConvention.Cdecl)]
45         internal static extern int SetAccountUserName(IntPtr handle, string userName);
46
47         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_display_name", CallingConvention = CallingConvention.Cdecl)]
48         internal static extern int GetAccountDisplayName(IntPtr handle, out string displayName);
49
50         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_display_name", CallingConvention = CallingConvention.Cdecl)]
51         internal static extern int SetAccountDisplayName(IntPtr handle, string displayName);
52
53         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability", CallingConvention = CallingConvention.Cdecl)]
54         internal static extern int GetAccountCapability(IntPtr handle, string capabilityType, out int capabilityValue);
55
56         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_capability", CallingConvention = CallingConvention.Cdecl)]
57         internal static extern int SetAccountCapability(IntPtr handle, string capabilityType, int capabilityValue);
58
59         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_icon_path", CallingConvention = CallingConvention.Cdecl)]
60         internal static extern int GetAccountIconPath(IntPtr handle, out string iconPath);
61
62         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_icon_path", CallingConvention = CallingConvention.Cdecl)]
63         internal static extern int SetAccountIconPath(IntPtr handle, string iconPath);
64
65         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_domain_name", CallingConvention = CallingConvention.Cdecl)]
66         internal static extern int GetAccountDomainName(IntPtr handle, out string domainName);
67
68         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_domain_name", CallingConvention = CallingConvention.Cdecl)]
69         internal static extern int SetAccountDomainName(IntPtr handle, string domainName);
70
71         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_email_address", CallingConvention = CallingConvention.Cdecl)]
72         internal static extern int GetAccountEmail(IntPtr handle, out string email);
73
74         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_email_address", CallingConvention = CallingConvention.Cdecl)]
75         internal static extern int SetAccountEmail(IntPtr handle, string email);
76
77         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_package_name", CallingConvention = CallingConvention.Cdecl)]
78         internal static extern int GetAccountPackageName(IntPtr handle, out string name);
79
80         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_package_name", CallingConvention = CallingConvention.Cdecl)]
81         internal static extern int SetAccountPackageName(IntPtr handle, string name);
82
83         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_access_token", CallingConvention = CallingConvention.Cdecl)]
84         internal static extern int GetAccountAccessToken(IntPtr handle, out string accessToken);
85
86         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_access_token", CallingConvention = CallingConvention.Cdecl)]
87         internal static extern int SetAccountAccessToken(IntPtr handle, string accessToken);
88
89         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_text", CallingConvention = CallingConvention.Cdecl)]
90         internal static extern int GetAccountUserText(IntPtr handle, int index, out string userText);
91
92         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_text", CallingConvention = CallingConvention.Cdecl)]
93         internal static extern int SetAccountUserText(IntPtr handle, int index, string userText);
94
95         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_int", CallingConvention = CallingConvention.Cdecl)]
96         internal static extern int GetAccountUserInt(IntPtr handle, int index, out int value);
97
98         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_int", CallingConvention = CallingConvention.Cdecl)]
99         internal static extern int SetAccountUserInt(IntPtr handle, int index, int value);
100
101         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_auth_type", CallingConvention = CallingConvention.Cdecl)]
102         internal static extern int GetAccountAuthType(IntPtr handle, out int authType);
103
104         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_auth_type", CallingConvention = CallingConvention.Cdecl)]
105         internal static extern int SetAccountAuthType(IntPtr handle, int authType);
106
107         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_secret", CallingConvention = CallingConvention.Cdecl)]
108         internal static extern int GetAccountSercet(IntPtr handle, out int secretType);
109
110         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_secret", CallingConvention = CallingConvention.Cdecl)]
111         internal static extern int SetAccountSecret(IntPtr handle, int secretType);
112
113         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_sync_support", CallingConvention = CallingConvention.Cdecl)]
114         internal static extern int GetAccountSyncSupport(IntPtr handle, out int syncType);
115
116         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_sync_support", CallingConvention = CallingConvention.Cdecl)]
117         internal static extern int SetAccountSyncSupport(IntPtr handle, int syncType);
118
119         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_source", CallingConvention = CallingConvention.Cdecl)]
120         internal static extern int GetAccountSource(IntPtr handle, out string source);
121
122         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_source", CallingConvention = CallingConvention.Cdecl)]
123         internal static extern int SetAccountSource(IntPtr handle, string source);
124
125         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom", CallingConvention = CallingConvention.Cdecl)]
126         internal static extern int GetAccountCustomValue(IntPtr handle, string key, out string value);
127
128         [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_custom", CallingConvention = CallingConvention.Cdecl)]
129         internal static extern int SetAccountCustomValue(IntPtr handle, string key, string value);
130
131         [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)]
132         internal static extern int UpdateAccountSyncStatusById(int accountId, int status);
133
134         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability_all")]
135         internal static extern int GetAllAccountCapabilities(IntPtr handle, AccountCapabilityCallback callback, IntPtr userData);
136
137         [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id")]
138         internal static extern int QueryAccountCapabilityById(AccountCapabilityCallback callback, int accountId, IntPtr userData);
139
140         [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom_all")]
141         internal static extern int GetAllAccountCustomValues(IntPtr handle, AccountCustomCallback callback, IntPtr userData);
142
143         //Callbacks
144         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
145         internal delegate bool AccountCapabilityCallback(string capabilityType, int capabilityState, IntPtr userData);
146
147         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
148         internal delegate bool AccountCustomCallback(string key, string value, IntPtr userData);
149
150         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
151         internal delegate bool AccountCallback(IntPtr data, IntPtr userData);
152     }
153 }