-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiUser.mli
92 lines (81 loc) · 3.22 KB
/
apiUser.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
(* ************************************************************************** *)
(* 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 *)
(* ************************************************************************** *)
(** Users API methods *)
open ApiTypes
(* ************************************************************************** *)
(** {3 Type} *)
(* ************************************************************************** *)
type t =
{
info : Info.t;
login : login;
firstname : string option;
lastname : string option;
name : string option;
avatar : ApiMedia.Picture.t option;
gender : Gender.t;
birthday : Date.t option;
(* lang : Lang.t; *)
(* PRIVATE *)
email : email option;
(* /PRIVATE *)
score : int;
level : int;
in_game_network : bool option;
game_network_total : int;
other_game_network_total : int;
url : url;
}
(* ************************************************************************** *)
(** {3 API Methods} *)
(* ************************************************************************** *)
(** Get users *)
val get :
auth:auth
-> ?term:string list
-> ?page:Page.parameters
-> ?with_avatar: bool option
-> ?genders: Gender.t list
-> ?lang: Lang.t list
-> ?min_score: int option
-> ?max_score: int option
-> ?min_level: int option
-> ?max_level: int option
-> ?is_in_network: bool option
-> unit -> t Page.t Api.t
(** Get a user *)
val get_one : ?auth:auth option -> id -> t Api.t
type either =
| Password of password
| OAuth of (string (* site_name *) * string (* site_token *))
(** Create a user *)
val create :
login:login
-> email:email
-> lang:Lang.t
-> ?firstname:string
-> ?lastname:string
-> ?gender:Gender.t
-> ?birthday:Date.t option
-> ?avatar:either_file
-> either -> t Api.t
(** Edit a user *)
val edit :
auth:auth
-> ?email:email
-> ?old_password:string
-> ?password:string
-> ?firstname:string
-> ?lastname:string
-> ?gender:Gender.t
-> ?birthday:Date.t option
-> ?avatar:either_file
-> id -> t Api.t
(* ************************************************************************** *)
(** {3 Tools} *)
(* ************************************************************************** *)
val from_json : Yojson.Basic.json -> t
val equal : t -> t -> bool