Library
Module
Module type
Parameter
Class
Class type
Services.
type (+'meth, 'prefix, 'params, 'query, 'input, 'output, 'error) t =
('meth, 'prefix, 'params, 'query, 'input, 'output, 'error)
Resto.MakeService(Encoding).t constraint 'meth = [< Resto.meth ]
type (+'meth, 'prefix, 'params, 'query, 'input, 'output, 'error) service =
('meth, 'prefix, 'params, 'query, 'input, 'output, 'error) t
val meth :
('meth, 'prefix, 'params, 'query, 'input, 'output, 'error) service ->
'meth
val query :
('meth, 'prefix, 'params, 'query, 'input, 'output, 'error) service ->
'query Resto.Query.t
type _ input = _ Resto.MakeService(Encoding).input =
| No_input : unit input
| Input : 'input Encoding.t -> 'input input
val output_encoding :
('meth, 'prefix, 'params, 'query, 'input, 'output, 'error) service ->
'output Encoding.t
val error_encoding :
('meth, 'prefix, 'params, 'query, 'input, 'output, 'error) service ->
'error Encoding.t
val get_service :
?description:string ->
query:'query Resto.Query.t ->
output:'output Encoding.t ->
error:'error Encoding.t ->
('prefix, 'params) Resto.Path.t ->
([ `GET ], 'prefix, 'params, 'query, unit, 'output, 'error) service
get_service ?description ~query ~output ~error path
is a GET
service that is intended to seat at the URI described by path
and receive the additional parameters described by query
. The value output
(resp. error
) describe the representation of the successful (resp. failed) returned value for the service.
Note that, whilst get_service
declares a service, the resulting service is not registered yet. This is handled in Resto_directory
.
post_service
, delete_service
, put_service
, and patch_service
are similar to get_service
but for the other HTTP methods.
Note that some of these functions take an additional input
argument. This is only for the services with methods that expect additional parameters. It is used internally to encode/decode additional parameters passed in a dedicated payload rather than in the path/query parameters.
val post_service :
?description:string ->
query:'query Resto.Query.t ->
input:'input Encoding.t ->
output:'output Encoding.t ->
error:'error Encoding.t ->
('prefix, 'params) Resto.Path.t ->
([ `POST ], 'prefix, 'params, 'query, 'input, 'output, 'error) service
val delete_service :
?description:string ->
query:'query Resto.Query.t ->
output:'output Encoding.t ->
error:'error Encoding.t ->
('prefix, 'params) Resto.Path.t ->
([ `DELETE ], 'prefix, 'params, 'query, unit, 'output, 'error) service
val patch_service :
?description:string ->
query:'query Resto.Query.t ->
input:'input Encoding.t ->
output:'output Encoding.t ->
error:'error Encoding.t ->
('prefix, 'params) Resto.Path.t ->
([ `PATCH ], 'prefix, 'params, 'query, 'input, 'output, 'error) service
val put_service :
?description:string ->
query:'query Resto.Query.t ->
input:'input Encoding.t ->
output:'output Encoding.t ->
error:'error Encoding.t ->
('prefix, 'params) Resto.Path.t ->
([ `PUT ], 'prefix, 'params, 'query, 'input, 'output, 'error) service
val prefix :
('prefix, 'inner_prefix) Resto.Path.t ->
('meth, 'inner_prefix, 'params, 'query, 'input, 'output, 'error) service ->
('meth, 'prefix, 'params, 'query, 'input, 'output, 'error) service
val subst0 :
([< Resto.meth ] as 'm, 'p, 'p, 'q, 'i, 'o, 'e) service ->
('m, 'p2, 'p2, 'q, 'i, 'o, 'e) service
val subst1 :
([< Resto.meth ] as 'm, 'p, 'p * 'a, 'q, 'i, 'o, 'e) service ->
('m, 'p2, 'p2 * 'a, 'q, 'i, 'o, 'e) service
val subst2 :
([< Resto.meth ] as 'm, 'p, ('p * 'a) * 'b, 'q, 'i, 'o, 'e) service ->
('m, 'p2, ('p2 * 'a) * 'b, 'q, 'i, 'o, 'e) service
val subst3 :
([< Resto.meth ] as 'm, 'p, (('p * 'a) * 'b) * 'c, 'q, 'i, 'o, 'e) service ->
('m, 'p2, (('p2 * 'a) * 'b) * 'c, 'q, 'i, 'o, 'e) service
type ('prefix, 'params, 'error) description_service =
([ `GET ],
'prefix,
'params * string list,
Resto.Description.request,
unit,
Encoding.schema Resto.Description.directory,
'error)
service
val description_service :
?description:string ->
'error Encoding.t ->
('prefix, 'params) Resto.Path.t ->
('prefix, 'params, 'error) description_service
type 'input request = 'input Resto.MakeService(Encoding).request = {
meth : Resto.meth;
uri : Uri.t;
input : 'input input;
}
module Internal = Resto.MakeService(Encoding).Internal