Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Account.AccountManager / Interop / Interop.AccountProvider.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
21 /// <summary>
22 /// Interop for AccountProvider class APIs
23 /// </summary>
24 /// <since_tizen> 3 </since_tizen>
25 internal static partial class Interop
26 {
27     /// <summary>
28     /// Interop for AccountProvider class APIs
29     /// </summary>
30     /// <since_tizen> 3 </since_tizen>
31     internal static partial class AccountProvider
32     {
33
34         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_create", CallingConvention = CallingConvention.Cdecl)]
35         internal static extern int Create(out IntPtr handle);
36
37         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_destroy", CallingConvention = CallingConvention.Cdecl)]
38         internal static extern int Destroy(IntPtr handle);
39
40         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_app_id", CallingConvention = CallingConvention.Cdecl)]
41         internal static extern int GetAppId(IntPtr handle, out string appId);
42
43         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_supported_feature", CallingConvention = CallingConvention.Cdecl)]
44         [return: MarshalAs(UnmanagedType.I1)]
45         internal static extern bool IsFeatureSupported(string appId, string capability);
46
47         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_service_provider_id", CallingConvention = CallingConvention.Cdecl)]
48         internal static extern int GetServiceProviderId(IntPtr handle, out string providerId);
49
50         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_icon_path", CallingConvention = CallingConvention.Cdecl)]
51         internal static extern int GetAccountProviderIconPath(IntPtr handle, out string iconPath);
52
53         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_small_icon_path", CallingConvention = CallingConvention.Cdecl)]
54         internal static extern int GetAccountProviderSmallIconPath(IntPtr handle, out string iconPath);
55
56         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_multiple_account_support", CallingConvention = CallingConvention.Cdecl)]
57         internal static extern int GetMultipleAccountSupport(IntPtr handle, out int suppport);
58
59         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label_by_locale", CallingConvention = CallingConvention.Cdecl)]
60         internal static extern int GetlabelbyLocale(IntPtr handle, string locale, out string label);
61
62         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_app_id_exist", CallingConvention = CallingConvention.Cdecl)]
63         internal static extern int GetAppIdExists(string appId);
64
65         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_foreach_account_type_from_db", CallingConvention = CallingConvention.Cdecl)]
66         internal static extern int GetAllAccountProviders(AccountProviderCallback callback, IntPtr data);
67
68         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_provider_feature_by_app_id")]
69         internal static extern int GetAccountProviderFeaturesByAppId(AccountProviderFeatureCallback callback, string appId, IntPtr userData);
70
71         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_provider_feature_all")]
72         internal static extern int GetAccountProviderFeatures(IntPtr handle, AccountProviderFeatureCallback callback, IntPtr userData);
73
74         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label")]
75         internal static extern int GetAccountProviderLabels(IntPtr handle, LabelCallback callback, IntPtr userData);
76
77         [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_label_by_app_id")]
78         internal static extern int GetLablesByAppId(LabelCallback callback, string appId, IntPtr userData);
79
80
81         //Callbacks
82         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
83         internal delegate bool AccountProviderFeatureCallback(string appId, string key, IntPtr userData);
84
85         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
86         internal delegate bool AccountProviderCallback(IntPtr handle, IntPtr userData);
87
88         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
89         internal delegate bool LabelCallback(string appId, string label, string locale, IntPtr user_data);
90
91     }
92 }