Module EzAPIServerUtils.Directory

module StringMap : sig ... end
module MethMap : sig ... end
module Step : sig ... end
type conflict =
| CService
| CDir
| CBuilder
| CCustom
| CTypes of EzAPI.Arg.descr * EzAPI.Arg.descr
| CType of EzAPI.Arg.descr * string list
and 'a directory = {
services : 'a registered_service MethMap.t;
subdirs : 'a subdirectories option;
}
and _ subdirectories =
| Suffixes : 'a directory StringMap.t -> 'a subdirectories
| Arg : 'a1 EzAPI.Arg.t * ('a * 'a1) directory -> 'a subdirectories
and _ registered_service =
| Http : {
service : ('a'i'o'e's) EzAPI.Service.t;
handler : 'a -> 'i -> ('o'e) Stdlib.result Answer.t Lwt.t;
} -> 'a registered_service
| Websocket : {
service : ('a'i'o'e's) EzAPI.Service.t;
react : 'a -> 'i -> ('o'e) Stdlib.result Lwt.t;
bg : 'a -> (('o'e) Stdlib.result -> unit) -> unit Lwt.t;
onclose : ('a -> unit Lwt.t) option;
step : float option;
} -> 'a registered_service
val empty : 'a directory
type t = EzAPI.Req.t directory
type resolved_directory =
| Dir : 'a directory * 'a -> resolved_directory
type lookup_error = [
| `Not_found
| `Cannot_parse of EzAPI.Arg.descr * string * string list
| `Method_not_allowed
]
type handler_error = [
| EzEncoding.destruct_error
| `unsupported of string option
| `handler_exn of exn
| `handler_error of string
]
type ws_frame = [
| `binary of string
| `text of string
| `none
]
type lookup_ok = [
| `head
| `options of (string * string) list
| `http of string -> (string Answer.thandler_error) Stdlib.result Lwt.t
| `ws of (string -> (ws_framehandler_error) Stdlib.result Lwt.t) * (((ws_framehandler_error) Stdlib.result -> unit) -> unit Lwt.t) * (unit -> unit Lwt.t) option * float option
]
val resolve : a. string list -> 'a directory -> 'a -> string list -> (resolved_directorylookup_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.thandler_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) -> ('a -> (('c'd) Stdlib.result -> 'e) -> 'f) -> 'a -> 'b EzAPI.IO.io -> 'c EzAPI.io -> 'd Json_encoding.encoding -> (string -> (ws_frame[> `cannot_destruct of string * string | `handler_error of string | `handler_exn of exn | `unexpected_field of string ]) Result.result Lwt.t) * (((ws_frame[> `handler_error of string ]) Stdlib.result -> 'e) -> 'f)
val lookup : ?⁠meth:[< `DELETE | `GET | `HEAD | `OPTIONS | `PATCH | `POST | `PUT ] -> ?⁠content_type:string -> 'a directory -> 'a -> string list -> (lookup_oklookup_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 -> ('dStep.t list * 'c) 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'b'c'd'e) EzAPI.Service.t -> 'a registered_service) -> (tStep.t list * conflict) Stdlib.result
val register_http : t -> ('a'b'c'd[< EzAPI.Security.scheme ]) EzAPI.Service.t -> ('a -> 'b -> ('c'd) Stdlib.result Answer.t Lwt.t) -> (tStep.t list * conflict) Stdlib.result
val register_ws : t -> ?⁠onclose:('a -> unit Lwt.t) -> ?⁠step:float -> react:('a -> 'b -> ('c'd) Stdlib.result Lwt.t) -> bg:('a -> (('c'd) Stdlib.result -> unit) -> unit Lwt.t) -> ('a'b'c'd[< EzAPI.Security.scheme ]) EzAPI.Service.t -> (tStep.t list * conflict) Stdlib.result