-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiAuth.mli
54 lines (44 loc) · 2.22 KB
/
apiAuth.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(* ************************************************************************** *)
(* Project: Life - the game, Official OCaml SDK *)
(* Author: db0 ([email protected], http://db0.fr/) *)
(* Latest Version is on GitHub: https://github.com/Life-the-game/SDK-OCaml *)
(* ************************************************************************** *)
(** Authentication API methods *)
open ApiTypes
(* ************************************************************************** *)
(** {3 Type} *)
(* ************************************************************************** *)
type t =
{
info : ApiTypes.Info.t;
mutable user : ApiUser.t;
(* PRIVATE *)
(* ip : ip; *)
(* user_agent : string; *)
(* /PRIVATE *)
token : token;
expiration : ApiTypes.DateTime.t;
(* facebook_token : string option; *)
}
(* ************************************************************************** *)
(** {3 API Methods} *)
(* ************************************************************************** *)
(** Login (create token) *)
val login :
(* PRIVATE *)
?ip: ip ->
(* /PRIVATE *)
login -> password -> t Api.t
(** OAuth *)
val oauth : string -> token -> t Api.t
val facebook : token -> t Api.t
(** Logout (delete token) *)
val logout : t -> unit Api.t
(* ************************************************************************** *)
(** {3 Tools} *)
(* ************************************************************************** *)
val from_json : Yojson.Basic.json -> t
(** Transform an API object returned by the login function into an api type
required by most of the API methods *)
val auth_to_api : t -> ApiTypes.auth
val opt_auth_to_api : t option -> ApiTypes.auth option