-
Notifications
You must be signed in to change notification settings - Fork 174
/
client.mli
123 lines (109 loc) · 3.72 KB
/
client.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
val request :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
?uri:Uri.t ->
?body:Body.t ->
Http.Request.t ->
(Http.Response.t * Body.t) Async_kernel.Deferred.t
(** Send an HTTP request with an arbitrary body The request is sent as-is. *)
val call :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
?headers:Http.Header.t ->
?chunked:bool ->
?body:Body.t ->
Http.Method.t ->
Uri.t ->
(Http.Response.t * Body.t) Async_kernel.Deferred.t
(** Send an HTTP request with arbitrary method and a body Infers the transfer
encoding. Depending on the given [uri], we choose a way to start a
communication such as:
- If the scheme is [https], we try to initiate an SSL connection with the
given [ssl_ctx] or a default one on the default port ([*:443]) or the
specified one.
- If the scheme is [httpunix], we use a UNIX domain socket.
- If the scheme ie [http], we try an usual TCP/IP connection on the default
port ([*:80]) or the specified one. *)
module Connection : sig
type t
val connect :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
Uri.t ->
t Async_kernel.Deferred.t
val close : t -> unit Async_kernel.Deferred.t
val close_finished : t -> unit Async_kernel.Deferred.t
val is_closed : t -> bool
val request :
?body:Body.t ->
t ->
Http.Request.t ->
(Http.Response.t * Body.t) Async_kernel.Deferred.t
end
val callv :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
Uri.t ->
(Http.Request.t * Body.t) Async_kernel.Pipe.Reader.t ->
(Http.Response.t * Body.t) Async_kernel.Pipe.Reader.t Async_kernel.Deferred.t
val get :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
?headers:Http.Header.t ->
Uri.t ->
(Http.Response.t * Body.t) Async_kernel.Deferred.t
(** Send an HTTP GET request *)
val head :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
?headers:Http.Header.t ->
Uri.t ->
Http.Response.t Async_kernel.Deferred.t
(** Send an HTTP HEAD request *)
val delete :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
?headers:Http.Header.t ->
?chunked:bool ->
?body:Body.t ->
Uri.t ->
(Http.Response.t * Body.t) Async_kernel.Deferred.t
(** Send an HTTP DELETE request *)
val post :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
?headers:Http.Header.t ->
?chunked:bool ->
?body:Body.t ->
Uri.t ->
(Http.Response.t * Body.t) Async_kernel.Deferred.t
(** Send an HTTP POST request. [chunked] encoding is off by default as not many
servers support it *)
val put :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
?headers:Http.Header.t ->
?chunked:bool ->
?body:Body.t ->
Uri.t ->
(Http.Response.t * Body.t) Async_kernel.Deferred.t
(** Send an HTTP PUT request. [chunked] encoding is off by default as not many
servers support it *)
val patch :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
?headers:Http.Header.t ->
?chunked:bool ->
?body:Body.t ->
Uri.t ->
(Http.Response.t * Body.t) Async_kernel.Deferred.t
(** Send an HTTP PATCH request. [chunked] encoding is off by default as not many
servers support it *)
val post_form :
?interrupt:unit Async_kernel.Deferred.t ->
?ssl_config:Conduit_async.V2.Ssl.Config.t ->
?headers:Http.Header.t ->
params:(string * string list) list ->
Uri.t ->
(Http.Response.t * Body.t) Async_kernel.Deferred.t
(** Send an HTTP POST request in form format *)