iFun Engine API  1.0.0-b6053
Great Technology for Great Games
facebook_authentication.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2020 iFunFactory Inc. All Rights Reserved.
2 //
3 // This work is confidential and proprietary to iFunFactory Inc. and
4 // must not be used, disclosed, copied, or distributed without the prior
5 // consent of iFunFactory Inc.
6 
9 #ifndef INCLUDE_FUNAPI_SERVICE_FACEBOOK_AUTHENTICATION_H_
10 #define INCLUDE_FUNAPI_SERVICE_FACEBOOK_AUTHENTICATION_H_
11 
12 #include <funapi/common/json.h>
13 #include <funapi/player_account.h>
14 #include <funapi/types.h>
15 
16 
17 namespace fun {
18 
19 struct FUNAPI_DLL_VISIBILITY FacebookError {
20  FacebookError();
21  FacebookError(int64_t code, const string &message);
22 
23  int64_t code;
24  string message;
25 };
26 
27 
28 struct FUNAPI_DLL_VISIBILITY FacebookAuthenticationRequest {
29  explicit FacebookAuthenticationRequest(const string &access_token);
30 
31  string access_token;
32 };
33 
34 
35 struct FUNAPI_DLL_VISIBILITY FacebookAuthenticationResponse {
37  explicit FacebookAuthenticationResponse(const FacebookError &error);
38 
39  bool success;
40  string client_id;
41  string name;
42  FacebookError error;
43 };
44 
45 
46 struct FUNAPI_DLL_VISIBILITY FacebookPersonalInfoRequest {
47  explicit FacebookPersonalInfoRequest(const string &access_token);
48 
49  string access_token;
50 };
51 
52 
53 struct FUNAPI_DLL_VISIBILITY FacebookPersonalInfoResponse {
55 
56  bool success;
57  PlayerAccountVector friends;
58  FacebookError error;
59 };
60 
61 
62 typedef function<void(const FacebookAuthenticationRequest &request,
63  const FacebookAuthenticationResponse &response,
64  bool error)> FacebookAuthenticationResponseHandler;
65 
66 
67 typedef function<void(const FacebookPersonalInfoRequest &request,
68  const FacebookPersonalInfoResponse &response,
69  bool error)> FacebookPersonalInfoResponseHandler;
70 
71 FUNAPI_DLL_VISIBILITY
72 void Authenticate(const FacebookAuthenticationRequest &request,
73  const FacebookAuthenticationResponseHandler &handler,
74  size_t timeout_in_ms = 0);
75 
76 FUNAPI_DLL_VISIBILITY
77 bool AuthenticateSync(const FacebookAuthenticationRequest &request,
79 
80 FUNAPI_DLL_VISIBILITY
81 void GetPersonalInfo(const FacebookPersonalInfoRequest &request,
82  const FacebookPersonalInfoResponseHandler &handler,
83  size_t timeout_in_ms = 0);
84 
85 FUNAPI_DLL_VISIBILITY
86 bool GetPersonalInfoSync(const FacebookPersonalInfoRequest &request,
88 
89 } // namespace fun
90 
91 #endif // INCLUDE_FUNAPI_SERVICE_FACEBOOK_AUTHENTICATION_H_
Definition: facebook_authentication.h:35
Definition: facebook_authentication.h:28
Definition: json.h:18
Definition: facebook_authentication.h:46
Definition: facebook_authentication.h:53
Definition: facebook_authentication.h:19