Brasilapi.Banks.API (BrasilAPI v0.1.5)
View SourceClient for BrasilAPI Banks endpoints.
Provides functions to fetch information about Brazilian banks.
Summary
Functions
Fetches information about all Brazilian banks. We filter out any banks that do not have the code or ispb fields.
Fetches information about a specific bank by its code.
Functions
@spec get_all() :: {:ok, [Brasilapi.Banks.Bank.t()]} | {:error, map()}
Fetches information about all Brazilian banks. We filter out any banks that do not have the code or ispb fields.
Examples
iex> Brasilapi.Banks.API.get_all()
{:ok, [%Brasilapi.Banks.Bank{ispb: "00000000", name: "BCO DO BRASIL S.A.", code: 1, full_name: "Banco do Brasil S.A."}]}
iex> Brasilapi.Banks.API.get_all()
{:error, %{reason: :timeout}}
@spec get_by_code(integer() | String.t()) :: {:ok, Brasilapi.Banks.Bank.t()} | {:error, map()}
Fetches information about a specific bank by its code.
Parameters
code
- The bank code (integer)
Examples
iex> Brasilapi.Banks.API.get_by_code(1)
{:ok, %Brasilapi.Banks.Bank{ispb: "00000000", name: "BCO DO BRASIL S.A.", code: 1, full_name: "Banco do Brasil S.A."}}
iex> Brasilapi.Banks.API.get_by_code(999999)
{:error, %{status: 404, message: "Not found"}}