Madge_clientinclude module type of Madgemodule Request = Madge.Requestmodule Response = Madge.Responsemodule Route = Madge.Routetype ('a, 'w, 'r) route = ('a, 'w, 'r) Route.tThe heart of Madge, where we link routes and requests.
val uri : ('a, Uri.t, 'r) Madge.Route.t -> 'aEasiest way to use a route: transform it into a URI. The 'a parameter corresponds to the function of that route, with Uri.t as return type. For instance, if r has type (int -> float -> 'w, 'w, 'r) route, then uri r will have type int -> float -> Uri.t.
val with_request :
('a, 'w, 'r) Madge.Route.t ->
((module Madge__.Serialisation.JSONABLE with type t = 'r) ->
Madge.Request.t ->
'w) ->
'aGeneric way to use a route. Given a route and a continuation, create a request from the route, pass that request to the continuation, and return the resulting value. For instance, uri is simply process route (fun (module _) {uri; _} -> uri).
val apply' :
('a, 'w, 'r) Madge.Route.t ->
(unit -> 'a) ->
Madge.Request.t ->
(unit -> 'w) optionGiven a route, a controller, and a request, check whether the route matches the request. If so, construct a thunk that calls the controller with the correct arguments. Otherwise, return None.
val apply :
('a, 'w, 'r) Madge.Route.t ->
(unit -> 'a) ->
Madge.Request.t ->
((module Madge__.Serialisation.JSONABLE with type t = 'r) ->
(unit -> 'w) ->
'z) ->
(unit -> 'z) optionGiven a route, a controller, a request, and a continuation, check whether the route matches. If so, construct a thunk that calls the controller with the correct arguments and passes it to the continuation. Otherwise, return None. For instance, apply' is simply apply route controller request (fun _ f -> f ()).
module type STRINGABLE = sig ... endmodule type JSONABLE = sig ... endmodule SString : sig ... endmodule SUnit : sig ... endmodule SStatusCode : sig ... endmodule SSlug : sig ... endmodule JString : sig ... endmodule JUri : sig ... endmodule JUnit : sig ... endmodule JVoid : sig ... endmodule JBool : sig ... endmodule JInt : sig ... endmodule JFloat : sig ... endmodule type Internal_endpoints = sig ... endmodule type Endpoints = sig ... endmodule Make_endpoints (Internal : sig ... end) : sig ... endexception Error of errorFollow the route, call the endpoint, get the result and unserialise it, or returns an error.
val call_gen :
?retry:bool ->
('a, 'z, 'r) Route.t ->
(('r, error) Stdlib.result Nes.Lwt.t -> 'z) ->
'aVariant of call that immediately receives a continuation taking the promise of a result.
val initialise_batch_route :
(Request.t list -> unit Nes.Lwt.t, unit Nes.Lwt.t, Response.t list) route ->
unit