Sends procedure calls to a Bowline handler over HTTP and maps every outcome
to {:ok, value} or {:error, %BowlineClient.Error{}}.
Queries go out as GET with the input in the input query parameter;
mutations and sensitive queries go out as POST with a JSON body. A
procedure mounted on a custom path uses rest/6, which spreads the input
over individual query parameters when the method carries no body.
Summary
Functions
Calls a query or mutation and decodes the output with decode.
Builds a transport for the API served at base_url.
Calls a procedure mounted on a custom path.
Opens a subscription and returns a lazy stream of decoded messages.
Sends an upload: the JSON input as the first multipart part and the file as the second.
Types
@type call_opts() :: [ headers: %{optional(String.t()) => String.t()}, timeout: pos_integer() ]
@type method() :: :get | :post | :put | :patch | :delete
@type t() :: %BowlineClient.Transport{ base_url: String.t(), headers: headers(), req: Req.Request.t() }
Functions
@spec call(t(), String.t(), method(), map(), decoder(), call_opts()) :: {:ok, term()} | {:error, BowlineClient.Error.t()}
Calls a query or mutation and decodes the output with decode.
Builds a transport for the API served at base_url.
Options: :headers as a map or a zero-arity function evaluated per call, and
:req as extra options for Req.new/1.
@spec rest(t(), String.t(), method(), map(), decoder(), call_opts()) :: {:ok, term()} | {:error, BowlineClient.Error.t()}
Calls a procedure mounted on a custom path.
A method that carries no body sends the input as individual query parameters
rather than as a single input parameter.
@spec subscribe(t(), String.t(), map(), decoder(), call_opts()) :: {:ok, Enumerable.t()} | {:error, BowlineClient.Error.t()}
Opens a subscription and returns a lazy stream of decoded messages.
@spec upload( t(), String.t(), map(), Enumerable.t() | binary(), String.t(), decoder(), call_opts() ) :: {:ok, term()} | {:error, BowlineClient.Error.t()}
Sends an upload: the JSON input as the first multipart part and the file as the second.