Metabase (metabase v0.0.0)
Client used to make HTTP requests.
making-requests
Making Requests
Requests can be made using the send/2
function. This function accepts a
Metabase.RequestOperation
struct as the first argument and a keyword list of
configuration options as the second argument.
example
Example
iex> %Metabase.RequestOperation{}
...> |> Map.put(:body, username: "person@mymetabase.com", password: "fakepassword")
...> |> Map.put(:method, :post)
...> |> Map.put(:path, "/session")
...> |> Metabase.send(host: "mymetabase.com/api")
{:ok, %Metabase.Response{}}
configuration
Configuration
The send/2
function takes a keyword list of configuration options as the
second argument. These provide the client with additional details needed to
make a request and various other options for how the client should process the
request and how it should behave.
options
Options
:client
- HTTP client adapter used to make the request. Defaults toMetabase.HTTP.Hackney
.:client_opts
- Configuration options passed to the client adapter:headers
- HTTP headers used when making a request:host
- Hostname used when making a request. This field is required.:json_codec
- Module used to encode and decode JSON. Defaults toJason
.:port
- HTTP port used when making a request:protocol
- HTTP protocol used when making a request:retry
- Module implementing a request retry strategy. Disabled when set tofalse
. Defaults tofalse
.:retry_opts
- Options used to control the behavior of the retry module
Link to this section Summary
Functions
Send an HTTP request.
Link to this section Types
Link to this type
headers_t()
Link to this type
method_t()
@type method_t() :: :delete | :get | :head | :patch | :post | :put
Link to this type
response_t()
@type response_t() :: {:ok, Metabase.Response.t()} | {:error, Metabase.Response.t() | any()}
Link to this type
status_code_t()
@type status_code_t() :: pos_integer()
Link to this section Functions
Link to this function
send(operation, old_opts)
@spec send( Metabase.RequestOperation.t(), keyword() ) :: Metabase.Response.t()
Send an HTTP request.