package ezjs_fetch

  1. Overview
  2. Docs
type ('a, 'b) result = ('a, 'b) Stdlib.result =
  1. | Ok of 'a
  2. | Error of 'b
val optdef : ('a -> 'b) -> 'c option -> 'd Js_of_ocaml.Js.optdef
val to_listf : ('a -> 'b) -> 'c Js_of_ocaml.Js.js_array Js_of_ocaml.Js.t -> 'b list
class type 'a next = object ... end
class type 'a iterator = object ... end
class type 'a array_from = object ... end
class type headers = object ... end
class type body = object ... end
class type request_init = object ... end
class type abort_signal = object ... end
class type fetch_init = object ... end
class type request = object ... end
class type response_js = object ... end
class type global_scope = object ... end
val global_scope : global_scope Js_of_ocaml.Js.t Stdlib.ref
val init_worker : unit -> unit
val make_headers : (string * string) list -> headers Js_of_ocaml.Js.t
val get_headers : headers Js_of_ocaml.Js.t -> (string * string) list
type request_body =
  1. | RBlob of Js_of_ocaml.File.blob Js_of_ocaml.Js.t
  2. | RString of string
  3. | RBuffer of Js_of_ocaml.Typed_array.arrayBuffer Js_of_ocaml.Js.t
  4. | RFormData of Js_of_ocaml.Form.formData Js_of_ocaml.Js.t
  5. | RUrlParam of (string * string) list
val request_init : ?cache:string -> ?credentials:string -> ?headers:(string * string) list -> ?integrity:string -> ?meth:string -> ?mode:string -> ?redirect:string -> ?referrer:string -> ?body:request_body -> unit -> 'a Js_of_ocaml.Js.optdef
val request : ?cache:string -> ?credentials:string -> ?headers:(string * string) list -> ?integrity:string -> ?meth:string -> ?mode:string -> ?redirect:string -> ?referrer:string -> ?body:request_body -> string -> request Js_of_ocaml.Js.t
val fetch_init : ?cache:string -> ?credentials:string -> ?headers:(string * string) list -> ?integrity:string -> ?meth:string -> ?mode:string -> ?redirect:string -> ?referrer:string -> ?body:request_body -> ?referrerPolicy:string -> ?keepalive:bool -> unit -> fetch_init Js_of_ocaml.Js.t Js_of_ocaml.Js.optdef
val fetch_base : ?cache:string -> ?credentials:string -> ?headers:(string * string) list -> ?integrity:string -> ?meth:string -> ?mode:string -> ?redirect:string -> ?referrer:string -> ?body:request_body -> ?referrerPolicy:string -> ?keepalive:bool -> string -> response_js Js_of_ocaml.Js.t promise
type 'a response = {
  1. headers : (string * string) list;
  2. ok : bool;
  3. redirected : bool;
  4. status : int;
  5. status_text : string;
  6. typ : string;
  7. url : string;
  8. body_used : bool;
  9. body : 'a;
}
val (>>=?) : ('a, 'b) result Lwt.t -> ('c -> ('d, 'e) result Lwt.t) -> ('d, 'e) result Lwt.t
val (>|=?) : ('a, 'b) result Lwt.t -> ('c -> 'd) -> ('e, 'f) result Lwt.t
val to_lwt_str : ?msg:string -> 'a Ezjs_min.Promise_lwt.promise Ezjs_min.Js.t -> ('b, string) result Lwt.t
val to_lwt_opt : ?msg:string -> ('a -> 'b) -> 'c Js_of_ocaml.Js.Opt.t Ezjs_min.Promise_lwt.promise Ezjs_min.Js.t -> ('d, string) result Lwt.t
val to_js : < json : 'a Js_of_ocaml__Js.t Js_of_ocaml.Js.Opt.t Ezjs_min.Promise_lwt.promise Ezjs_min.Js.t Js_of_ocaml.Js.meth.. > Js_of_ocaml.Js.t -> ('b Js_of_ocaml__Js.t, string) result Lwt.t
val fetch : ?cache:string -> ?credentials:string -> ?headers:(string * string) list -> ?integrity:string -> ?meth:string -> ?mode:string -> ?redirect:string -> ?referrer:string -> ?body:request_body -> ?referrerPolicy:string -> ?keepalive:bool -> string -> (response_js Js_of_ocaml.Js.t -> ('a, string) result Lwt.t) -> ('a response, string) result Lwt.t
val fetch_request : request Js_of_ocaml.Js.t -> (response_js Js_of_ocaml.Js.t -> ('a, string) result Lwt.t) -> ('a response, string) result Lwt.t