package resto-cohttp-server

  1. Overview
  2. Docs
type step = Resto_directory.Make(Encoding).step =
  1. | Static of string
  2. | Dynamic of Resto.Arg.descr
  3. | DynamicTail of Resto.Arg.descr

Possible error while registring services.

type conflict = Resto_directory.Make(Encoding).conflict =
  1. | CService of Resto.meth
  2. | CDir
  3. | CBuilder
  4. | CTail
  5. | CTypes of Resto.Arg.descr * Resto.Arg.descr
  6. | CType of Resto.Arg.descr * string list
type ('query, 'input, 'output, 'error) types = ('query, 'input, 'output, 'error) Resto_directory.Make(Encoding).types = {
  1. query : 'query Resto.Query.t;
  2. input : 'input Service.input;
  3. output : 'output Encoding.t;
  4. error : 'error Encoding.t;
}
type registered_service = Resto_directory.Make(Encoding).registered_service =
  1. | Service : {
    1. types : ('q, 'i, 'o, 'e) types;
    2. handler : 'q -> 'i -> ('o, 'e) Resto_directory.Answer.t Lwt.t;
    } -> registered_service
type 'prefix t = 'prefix Resto_directory.Make(Encoding).t

Dispatch tree

type 'prefix directory = 'prefix t
type lookup_error = [
  1. | `Not_found
  2. | `Method_not_allowed of Resto.meth list
  3. | `Cannot_parse_path of string list * Resto.Arg.descr * string
]
val lookup : 'prefix directory -> 'prefix -> Resto.meth -> string list -> (registered_service, [> lookup_error ]) Stdlib.result Lwt.t

Resolve a service.

val allowed_methods : 'prefix directory -> 'prefix -> string list -> (Resto.meth list, [> lookup_error ]) Stdlib.result Lwt.t
val transparent_lookup : 'prefix directory -> ('meth, 'prefix, 'params, 'query, 'input, 'output, 'error) Service.t -> 'params -> 'query -> 'input -> [> ('output, 'error) Resto_directory.Answer.t ] Lwt.t
val empty : 'prefix directory

Empty tree

val map : ('a -> 'b Lwt.t) -> 'b directory -> 'a directory
val prefix : ('pr, 'p) Resto.Path.path -> 'p directory -> 'pr directory
val merge : 'a directory -> 'a directory -> 'a directory
exception Conflict of step list * conflict
val register : 'prefix directory -> ('meth, 'prefix, 'params, 'query, 'input, 'output, 'error) Service.t -> ('params -> 'query -> 'input -> [< ('output, 'error) Resto_directory.Answer.t ] Lwt.t) -> 'prefix directory

Registring handler in service tree.

val register0 : unit directory -> ('m, unit, unit, 'q, 'i, 'o, 'e) Service.t -> ('q -> 'i -> [< ('o, 'e) Resto_directory.Answer.t ] Lwt.t) -> unit directory

Registring handler in service tree. Curryfied variant.

val register1 : 'prefix directory -> ('m, 'prefix, unit * 'a, 'q, 'i, 'o, 'e) Service.t -> ('a -> 'q -> 'i -> [< ('o, 'e) Resto_directory.Answer.t ] Lwt.t) -> 'prefix directory
val register2 : 'prefix directory -> ('m, 'prefix, (unit * 'a) * 'b, 'q, 'i, 'o, 'e) Service.t -> ('a -> 'b -> 'q -> 'i -> [< ('o, 'e) Resto_directory.Answer.t ] Lwt.t) -> 'prefix directory
val register3 : 'prefix directory -> ('m, 'prefix, ((unit * 'a) * 'b) * 'c, 'q, 'i, 'o, 'e) Service.t -> ('a -> 'b -> 'c -> 'q -> 'i -> [< ('o, 'e) Resto_directory.Answer.t ] Lwt.t) -> 'prefix directory
val register4 : 'prefix directory -> ('m, 'prefix, (((unit * 'a) * 'b) * 'c) * 'd, 'q, 'i, 'o, 'e) Service.t -> ('a -> 'b -> 'c -> 'd -> 'q -> 'i -> [< ('o, 'e) Resto_directory.Answer.t ] Lwt.t) -> 'prefix directory
val register5 : 'prefix directory -> ('m, 'prefix, ((((unit * 'a) * 'b) * 'c) * 'd) * 'f, 'q, 'i, 'o, 'e) Service.t -> ('a -> 'b -> 'c -> 'd -> 'f -> 'q -> 'i -> [< ('o, 'e) Resto_directory.Answer.t ] Lwt.t) -> 'prefix directory
val register_dynamic_directory : ?descr:string -> 'prefix directory -> ('prefix, 'a) Resto.Path.path -> ('a -> 'a directory Lwt.t) -> 'prefix directory

Registring dynamic subtree.

val register_dynamic_directory1 : ?descr:string -> 'prefix directory -> ('prefix, unit * 'a) Resto.Path.path -> ('a -> (unit * 'a) directory Lwt.t) -> 'prefix directory

Registring dynamic subtree. (Curryfied variant)

val register_dynamic_directory2 : ?descr:string -> 'prefix directory -> ('prefix, (unit * 'a) * 'b) Resto.Path.path -> ('a -> 'b -> ((unit * 'a) * 'b) directory Lwt.t) -> 'prefix directory
val register_dynamic_directory3 : ?descr:string -> 'prefix directory -> ('prefix, ((unit * 'a) * 'b) * 'c) Resto.Path.path -> ('a -> 'b -> 'c -> (((unit * 'a) * 'b) * 'c) directory Lwt.t) -> 'prefix directory
val register_describe_directory_service : 'prefix directory -> ('prefix, 'prefix, 'error) Service.description_service -> 'prefix directory

Registring a description service.

val describe_directory : recurse:bool -> ?arg:'a -> 'a directory -> Encoding.schema Resto.Description.directory Lwt.t
OCaml

Innovation. Community. Security.