metabase
is published on Hex. Add it to
your list of dependencies in mix.exs
:
def deps do
[
{:metabase, "~> 0.1"}
]
end
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.
iex> %Metabase.RequestOperation{}
...> |> Map.put(:body, username: "[email protected]", password: "fakepassword")
...> |> Map.put(:method, :post)
...> |> Map.put(:path, "/session")
...> |> Metabase.send(host: "mymetabase.com/")
{:ok, %Metabase.Response{}}
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.
: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
.:path
- Base path used when building the URL to send a request to. Defaults to/api
.: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