2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Runtime.InteropServices;
19 using Tizen.Account.AccountManager;
21 /// Interop for Account class APIs.
23 /// <since_tizen> 3 </since_tizen>
24 internal static partial class Interop
27 /// Interop for Account class APIs.
29 /// <since_tizen> 3 </since_tizen>
30 internal static partial class Account
32 [DllImport(Libraries.AccountSvc, EntryPoint = "account_create", CallingConvention = CallingConvention.Cdecl)]
33 internal static extern int Create(out SafeAccountHandle handle);
36 [DllImport(Libraries.AccountSvc, EntryPoint = "account_destroy", CallingConvention = CallingConvention.Cdecl)]
37 internal static extern int Destroy(IntPtr handle);
39 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_account_id", CallingConvention = CallingConvention.Cdecl)]
40 internal static extern int GetAccountId(SafeAccountHandle data, out int accountId);
42 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_name", CallingConvention = CallingConvention.Cdecl)]
43 internal static extern int GetAccountUserName(SafeAccountHandle data, out string userName);
45 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_name", CallingConvention = CallingConvention.Cdecl)]
46 internal static extern int SetAccountUserName(SafeAccountHandle handle, string userName);
48 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_display_name", CallingConvention = CallingConvention.Cdecl)]
49 internal static extern int GetAccountDisplayName(SafeAccountHandle handle, out string displayName);
51 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_display_name", CallingConvention = CallingConvention.Cdecl)]
52 internal static extern int SetAccountDisplayName(SafeAccountHandle handle, string displayName);
54 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability", CallingConvention = CallingConvention.Cdecl)]
55 internal static extern int GetAccountCapability(SafeAccountHandle handle, string capabilityType, out int capabilityValue);
57 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_capability", CallingConvention = CallingConvention.Cdecl)]
58 internal static extern int SetAccountCapability(SafeAccountHandle handle, string capabilityType, int capabilityValue);
60 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_icon_path", CallingConvention = CallingConvention.Cdecl)]
61 internal static extern int GetAccountIconPath(SafeAccountHandle handle, out string iconPath);
63 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_icon_path", CallingConvention = CallingConvention.Cdecl)]
64 internal static extern int SetAccountIconPath(SafeAccountHandle handle, string iconPath);
66 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_domain_name", CallingConvention = CallingConvention.Cdecl)]
67 internal static extern int GetAccountDomainName(SafeAccountHandle handle, out string domainName);
69 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_domain_name", CallingConvention = CallingConvention.Cdecl)]
70 internal static extern int SetAccountDomainName(SafeAccountHandle handle, string domainName);
72 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_email_address", CallingConvention = CallingConvention.Cdecl)]
73 internal static extern int GetAccountEmail(SafeAccountHandle handle, out string email);
75 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_email_address", CallingConvention = CallingConvention.Cdecl)]
76 internal static extern int SetAccountEmail(SafeAccountHandle handle, string email);
78 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_package_name", CallingConvention = CallingConvention.Cdecl)]
79 internal static extern int GetAccountPackageName(SafeAccountHandle handle, out string name);
81 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_package_name", CallingConvention = CallingConvention.Cdecl)]
82 internal static extern int SetAccountPackageName(SafeAccountHandle handle, string name);
84 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_access_token", CallingConvention = CallingConvention.Cdecl)]
85 internal static extern int GetAccountAccessToken(SafeAccountHandle handle, out string accessToken);
87 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_access_token", CallingConvention = CallingConvention.Cdecl)]
88 internal static extern int SetAccountAccessToken(SafeAccountHandle handle, string accessToken);
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);
93 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_text", CallingConvention = CallingConvention.Cdecl)]
94 internal static extern int SetAccountUserText(SafeAccountHandle handle, int index, string userText);
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);
99 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_int", CallingConvention = CallingConvention.Cdecl)]
100 internal static extern int SetAccountUserInt(SafeAccountHandle handle, int index, int value);
102 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_auth_type", CallingConvention = CallingConvention.Cdecl)]
103 internal static extern int GetAccountAuthType(SafeAccountHandle handle, out int authType);
105 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_auth_type", CallingConvention = CallingConvention.Cdecl)]
106 internal static extern int SetAccountAuthType(SafeAccountHandle handle, int authType);
108 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_secret", CallingConvention = CallingConvention.Cdecl)]
109 internal static extern int GetAccountSercet(SafeAccountHandle handle, out int secretType);
111 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_secret", CallingConvention = CallingConvention.Cdecl)]
112 internal static extern int SetAccountSecret(SafeAccountHandle handle, int secretType);
114 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_sync_support", CallingConvention = CallingConvention.Cdecl)]
115 internal static extern int GetAccountSyncSupport(SafeAccountHandle handle, out int syncType);
117 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_sync_support", CallingConvention = CallingConvention.Cdecl)]
118 internal static extern int SetAccountSyncSupport(SafeAccountHandle handle, int syncType);
120 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_source", CallingConvention = CallingConvention.Cdecl)]
121 internal static extern int GetAccountSource(SafeAccountHandle handle, out string source);
123 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_source", CallingConvention = CallingConvention.Cdecl)]
124 internal static extern int SetAccountSource(SafeAccountHandle handle, string source);
126 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom", CallingConvention = CallingConvention.Cdecl)]
127 internal static extern int GetAccountCustomValue(SafeAccountHandle handle, string key, out string value);
129 [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_custom", CallingConvention = CallingConvention.Cdecl)]
130 internal static extern int SetAccountCustomValue(SafeAccountHandle handle, string key, string value);
132 [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)]
133 internal static extern int UpdateAccountSyncStatusById(int accountId, int status);
135 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability_all")]
136 internal static extern int GetAllAccountCapabilities(SafeAccountHandle handle, AccountCapabilityCallback callback, IntPtr userData);
138 [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id")]
139 internal static extern int QueryAccountCapabilityById(AccountCapabilityCallback callback, int accountId, IntPtr userData);
141 [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom_all")]
142 internal static extern int GetAllAccountCustomValues(SafeAccountHandle handle, AccountCustomCallback callback, IntPtr userData);
145 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
146 internal delegate bool AccountCapabilityCallback(string capabilityType, int capabilityState, IntPtr userData);
148 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
149 internal delegate bool AccountCustomCallback(string key, string value, IntPtr userData);
151 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
152 internal delegate bool AccountCallback(IntPtr data, IntPtr userData);