package ez_api

  1. Overview
  2. Docs
module StringMap : sig ... end
module MethMap : sig ... end
module Step : sig ... end
type conflict =
  1. | CService of EzAPI.Meth.t
  2. | CTypes of EzAPI.Arg.descr * EzAPI.Arg.descr
and 'a directory = {
  1. services : 'a registered_service MethMap.t;
  2. subdirs : 'a static_subdirectories option * 'a variable_subdirectories option;
}
and 'a static_subdirectories = 'a directory StringMap.t
and _ variable_subdirectories =
  1. | Arg : 'a1 EzAPI.Arg.t * ('a * 'a1) directory -> 'a variable_subdirectories
and _ registered_service =
  1. | Http : {
    1. service : ('a, 'i, 'o, 'e, 's) EzAPI.Service.t;
    2. handler : 'a -> 'i -> ('o, 'e) Stdlib.result Answer.t Lwt.t;
    } -> 'a registered_service
  2. | Websocket : {
    1. service : ('a, 'i, 'o, 'e, 's) EzAPI.Service.t;
    2. react : 'a -> 'i -> ('o, 'e) Stdlib.result Lwt.t;
    3. bg : 'a -> (('o, 'e) Stdlib.result -> unit) -> unit Lwt.t;
    4. onclose : ('a -> unit Lwt.t) option;
    5. step : float option;
    } -> 'a registered_service
val empty : 'a directory
type resolved_directory =
  1. | Dir : 'a directory * 'a -> resolved_directory
type lookup_error = [
  1. | `Not_found
  2. | `Cannot_parse of EzAPI.Arg.descr * string * string list
  3. | `Method_not_allowed
]
type handler_error = [
  1. | EzEncoding.destruct_error
  2. | `unsupported of string option
  3. | `handler_exn of exn
  4. | `handler_error of string
]
type ws_frame = [
  1. | `binary of string
  2. | `text of string
  3. | `none
]
type lookup_ok = [
  1. | `head
  2. | `options of (string * string) list
  3. | `http of string -> (string Answer.t, handler_error) Stdlib.result Lwt.t
  4. | `ws of (string -> (ws_frame, handler_error) Stdlib.result Lwt.t) * (((ws_frame, handler_error) Stdlib.result -> unit) -> unit Lwt.t) * (unit -> unit Lwt.t) option * float option
]
val conflict_to_string : conflict -> string
val resolve : 'a. string list -> 'a directory -> 'a -> string list -> (resolved_directory, lookup_error) Stdlib.result Lwt.t
val io_to_answer : 'a. code:int -> 'a EzAPI.io -> 'a -> string Answer.t
val ser_handler : 'i 'o 'e. ?content_type:string -> ('a -> 'i -> ('o, 'e) Stdlib.result Answer.t Lwt.t) -> 'a -> 'i EzAPI.io -> 'o EzAPI.io -> 'e Json_encoding.encoding -> string -> (string Answer.t, handler_error) Stdlib.result Lwt.t
val io_to_ws_frame : 'a. 'a EzAPI.io -> 'a -> ws_frame
val ser_websocket : ('a -> 'b -> ('c, 'd) Stdlib.result Lwt.t) -> ('e -> (('c, 'd) Stdlib.result -> 'f) -> 'g) -> 'h -> 'i EzAPI.IO.io -> 'j EzAPI.io -> 'k Json_encoding.encoding -> (string -> (ws_frame, [> `destruct_exn of exn | `handler_error of string | `handler_exn of exn ]) Stdlib.result Lwt.t) * (((ws_frame, [> `handler_error of string ]) Stdlib.result -> 'l) -> 'm)
val lookup : ?meth:[< `DELETE | `GET | `HEAD | `OPTIONS | `PATCH | `POST | `PUT ] -> ?content_type:string -> 'a directory -> 'b -> string list -> (lookup_ok, lookup_error) Stdlib.result Lwt.t
val step_of_path : ('a, 'b) EzAPI.Path.t -> Step.t list
val conflict : ('a, 'b) EzAPI.Path.t -> 'c -> ('d, Step.t list * 'e) Stdlib.result
val insert : 'r 'a. ('r, 'a) EzAPI.Path.t -> 'r directory -> ('a directory * ('a directory -> 'r directory), Step.t list * conflict) Stdlib.result
val register : 'a. t -> ('a, 'b, 'c, 'd, [< EzAPI.Security.scheme ] as 'e) EzAPI.Service.t -> (('a, 'f, 'g, 'h, 'i) EzAPI.Service.t -> 'a registered_service) -> (t, Step.t list * conflict) Stdlib.result
val register_http : t -> ('a, 'b, 'c, 'd, [< EzAPI.Security.scheme ]) EzAPI.Service.t -> ('e -> 'f -> ('g, 'h) Stdlib.result Answer.t Lwt.t) -> (t, Step.t list * conflict) Stdlib.result
val register_ws : t -> ?onclose:('a -> unit Lwt.t) -> ?step:float -> react:('b -> 'c -> ('d, 'e) Stdlib.result Lwt.t) -> bg:('f -> (('g, 'h) Stdlib.result -> unit) -> unit Lwt.t) -> ('i, 'j, 'k, 'l, [< EzAPI.Security.scheme ]) EzAPI.Service.t -> (t, Step.t list * conflict) Stdlib.result