blob: 454d2e74dc11379070f1dafa76c391106a28d7c7 (
plain) (
blame)
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
|
open Async
open Cohttp
module type Token = sig
val token : string
end
module type Http = sig
module Base : sig
exception Invalid_Method
val base_url : string
val process_url : string -> Uri.t
val process_request_body : Yojson.Basic.json -> Cohttp_async.Body.t
val process_request_headers : unit -> Headers.t
val process_response :
Cohttp_async.Response.t * Cohttp_async.Body.t ->
Yojson.Basic.json
val request :
?body:Yojson.Basic.json ->
[ `Delete | `Get | `Patch | `Post | `Put ] ->
string ->
Yojson.Basic.json Deferred.t
end
(* TODO add abstraction sigs *)
end
module type Sharder = sig
exception Invalid_Payload
exception Failure_to_Establish_Heartbeat
type t
val start :
?count:int ->
string ->
t Deferred.t
val set_status :
status:Yojson.Basic.json ->
t ->
(Shard.shard Shard.t) list Deferred.t
val set_status_with :
f:(Shard.shard -> Yojson.Basic.json) ->
t ->
(Shard.shard Shard.t) list Deferred.t
val request_guild_members :
?query:string ->
?count:string ->
guild:Snowflake.t ->
t ->
(Shard.shard Shard.t) list Deferred.t
module Shard : sig
type shard
type 'a t
val bind :
f:('a -> unit) ->
'a t ->
unit
val heartbeat :
shard ->
shard Deferred.t
val set_status :
status:Yojson.Basic.json ->
shard ->
shard Deferred.t
val request_guild_members :
?query:string ->
?limit:int ->
guild:Snowflake.t
val create :
url:string ->
shards:int * int ->
token:string ->
unit ->
t Deferred.t
end
end
|