HTTP client for BrasilAPI endpoints.
Provides a consistent interface for making HTTP requests to BrasilAPI with proper error handling, retries, and response parsing.
Summary
Functions
Makes a DELETE request to the specified path.
Makes a GET request to the specified path.
Makes a POST request to the specified path.
Makes a PUT request to the specified path.
Types
@type error_response() :: {:error, map()}
@type mapper(result, mapped) :: (result -> mapped)
@type response() :: success_response() | error_response()
@type success_response() :: {:ok, term()}
Functions
Makes a DELETE request to the specified path.
Parameters
path- The API path (without base URL)opts- Additional options (optional)
Makes a GET request to the specified path.
Parameters
path- The API path (without base URL)opts- Additional options (optional)
Examples
iex> Brasilapi.Client.get("/banks/v1")
{:ok, [%{"ispb" => "00000000", "name" => "BCO DO BRASIL S.A.", ...}]}
iex> Brasilapi.Client.get("/banks/v1/999999")
{:error, %{status: 404, message: "Not found"}}
Makes a POST request to the specified path.
Parameters
path- The API path (without base URL)body- The request bodyopts- Additional options (optional)
Makes a PUT request to the specified path.
Parameters
path- The API path (without base URL)body- The request bodyopts- Additional options (optional)