Add 3.0 APIs and sync APIs same as 2.4
[platform/core/convergence/service-adaptor.git] / adaptor / auth-adaptor / oauth1_service.h
1 /*
2  * oAuth 1.0 Service
3  *
4  * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __OAUTH1_SERVICE_H__
21 #define __OAUTH1_SERVICE_H__
22
23 #ifndef API
24 #define API __attribute__ ((visibility("default")))
25 #endif
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 #include <stdio.h>
33 #include <glib.h>
34
35 /**
36  * @brief Describes infromation about oAuth1 Service
37  * @key name, ...
38  */
39 typedef struct _oauth1_s
40 {
41         char *access_token;
42         char *operation;
43 } oauth1_s;
44 typedef struct _oauth1_s *oauth1_h;
45
46 /**
47 * @brief Callback for oauth1 API
48 *
49 * @param[in]    access_token
50 * @param[in]    user_data       Passed data from #oauth1_get_access_token()
51 * @remarks
52 * @pre  oauth1() will invoke this callback.
53 */
54 typedef void (*oauth1_cb)(int result, oauth1_h oauth1, void *user_data);
55
56 /**
57  * @brief Describes infromation about oAuth 1.0 Service
58  * @key access token, ...
59  */
60 typedef struct _oauth1_service_s
61 {
62         int (*oauth1_get_access_token)(void *plugin, oauth1_cb callback, void *user_data);
63         int (*oauth1_get_extra_data)(void *plugin, const char *key, oauth1_cb callback, void *user_data);
64 } oauth1_service_s;
65 typedef struct _oauth1_service_s *oauth1_service_h;
66
67 /*==================================================================================================
68                                          FUNCTION PROTOTYPES
69 ==================================================================================================*/
70
71 /**
72 * @brief Register oAuth 1.0 Service
73 * @since_tizen 3.0
74 *
75 * @param[in]    oauth1  The oAuth 1.0 service handle
76 * @param[in]    service
77 * @remarks
78 * @see          oauth1_unregister_service()
79 * @return 0 on success, otherwise a negative error value
80 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
81 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
82 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
83 */
84 int oauth1_register_service(oauth1_service_h oauth1, GHashTable *service);
85
86 /**
87 * @brief Unregister oAuth 1.0 Service
88 * @since_tizen 3.0
89 *
90 * @param[in]    oauth1  The oAuth 1.0 service handle
91 * @remarks
92 * @see          oauth1_register_service()
93 * @return 0 on success, otherwise a negative error value
94 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
95 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
96 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
97 */
98 int oauth1_unregister_service(oauth1_service_h oauth1);
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif /* __OAUTH1_SERVICE_H__ */