package gitlab-unix

  1. Overview
  2. Docs

Module Gitlab.APISource

Perform GitLab API requests.

Sourceval code_handler : expected_code:Cohttp.Code.status_code -> 'a -> 'a handler

code_handler ~expected_code parse is a response handler that fires for responses with status expected_code and applies parse.

Sourceval get : ?fail_handlers:'a parse handler list -> ?expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> 'a parse -> 'a Response.t Monad.t

get ?rate ?fail_handlers ?expected_code ?headers ?token ?params uri p is the p-parsed response to a GitLab API HTTP GET request to uri with extra query parameters params and extra headers headers. If token is supplied, it will be used instead of any token bound into the monad. p will only fire if the response status is expected_code which defaults to 200 OK. If the response status is not expected_code, fail_handlers, if any, will be checked in the order supplied. The rate parameter determines which rate limit accounting regime will be used for caching rate limit values in response headers.

Sourceval get_stream : ?fail_handlers:'a Stream.parse handler list -> ?expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> 'a Stream.parse -> 'a Stream.t

get_stream uri stream_p is the Stream.t encapsulating lazy stream_p-parsed responses to GitLab API HTTP GET requests to uri and its successors. For an explanation of the other parameters, see get.

Sourceval post : ?fail_handlers:'a parse handler list -> expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?body:string -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> 'a parse -> 'a Response.t Monad.t

post uri p is the p-parsed response to a GitLab API HTTP POST request to uri. For an explanation of the other parameters, see get.

Sourceval delete : ?fail_handlers:'a parse handler list -> ?expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> 'a parse -> 'a Response.t Monad.t

delete uri p is the p-parsed response to a GitLab API HTTP DELETE request to uri. For an explanation of the other parameters, see get.

Sourceval patch : ?fail_handlers:'a parse handler list -> expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?body:string -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> 'a parse -> 'a Response.t Monad.t

patch uri p is the p-parsed response to a GitLab API HTTP PATCH request to uri. For an explanation of the other parameters, see get.

Sourceval put : ?fail_handlers:'a parse handler list -> expected_code:Cohttp.Code.status_code -> ?headers:Cohttp.Header.t -> ?body:string -> ?token:Token.t -> ?params:(string * string) list -> uri:Uri.t -> 'a parse -> 'a Response.t Monad.t

put uri p is the p-parsed response to a GitLab API HTTP PUT request to uri. For an explanation of the other parameters, see get.

Sourceval set_user_agent : string -> unit Monad.t

set_user_agent ua contains monadic state that will cause bound requests to use the User-Agent header value of ua.

Sourceval set_token : Token.t -> unit Monad.t

set_token token contains monadic state that will cause bound requests to use token for authentication by default. This function enables the creation of large, generic monadic compositions that do not have to be parameterized by authentication token.

Sourceval get_rate : ?token:Token.t -> unit -> rates Monad.t

get_rate () is the cached rate limit information.

Sourceval get_rate_limit : ?token:Token.t -> unit -> int option Monad.t

get_rate_limit () is the cached total request quota for the current token.

Sourceval get_rate_remaining : ?token:Token.t -> unit -> int option Monad.t

get_rate_remaining () is the cached remaining request quota for the current token.

Sourceval get_rate_reset : ?token:Token.t -> unit -> float option Monad.t

get_rate_reset () is the cached, UNIX epoch expiry time (s) when the remaining request quota will be reset to the total request quota for the current token.

Sourceval string_of_message : Gitlab_t.message -> string

string_of_message message is the English language error message that GitLab generated in message.

OCaml

Innovation. Community. Security.