123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263(*—————————————————————————————————————————————————————————————————————
Copyright (c) 2022-* Etienne Marais <etienne@maiste.fr>
Distributed under the MIT license. See terms at the end of this
file.
————————————————————————————————————————————————————————————————————*)(** This module gathers all the methods you need to be able to execute HTTP
requests to contact an API server. It must send application/json request. *)typeerror=[`Msgofstring]typeheaders=(string*string)listmoduletypeIntf=sigtype'aio(** The I/O monad used to execute HTTP request. *)valreturn:'a->'aio(** [return x] creates a value in the {!io} monad. *)valmap:('a->'b)->'aio->'bio(** [map f x] executes the [f] function and then wrap the result in the {!io}
monad. *)valbind:('a->'bio)->'aio->'bio(** [bind f x] is the same as {!map} but the function [f] should handle the
binding into the {!io} monad. *)valfail:error->'aio(** [fail err] is the equivalent of {!return} but with a failure in the {!io}
monad. *)valget:headers:headers->url:string->stringio(** [get ~headers ~url] executes a request to the server as a [GET] call and,
returns the result as a {!string}. *)valpost:headers:headers->url:string->string->stringio(** [post ~headers ~url body] executes a request to the server as a [POST]
call using {!body} to describe the request. It returns the result as a
{!string}. *)valput:headers:headers->url:string->string->stringio(** [put ~headers ~url body] executes a request to the server as a [PUT] call
using {!body} to describe the request. It returns the result as a
{!string}. *)valdelete:headers:headers->url:string->stringio(** [delete ~headers ~url] executes a request to the server as a [DELETE] call
and returns the result as a {!string}. *)end(*——————————————————————————————————————————————————————————————————————
Copyright (c) 2022-* Etienne Marais <etienne@maiste.fr>
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
————————————————————————————————————————————————————————————————————*)