Module for handling Region (Macrorregião) queries from IBGE.
This module provides functions to fetch Regions (Norte, Nordeste, Sudeste, Sul, Centro-Oeste).
Summary
Functions
@spec all(Keyword.t()) :: {:ok, [ExIbge.Geography.Region.t()]} | {:error, any()}
Get all regions (Macrorregiões).
Parameters
query- Optional parameters supported by the API (e.g.,order_by: :name).
Examples
iex> ExIbge.Locality.Region.all()
{:ok, [%ExIbge.Geography.Region{id: 3, acronym: "SE", name: "Sudeste"}, ...]}See Also
@spec all!(Keyword.t()) :: [ExIbge.Geography.Region.t()]
Same as all/1, but raises an error on failure.
Params and options are the same as all/1.
Examples
iex> ExIbge.Locality.Region.all!()
[%ExIbge.Geography.Region{id: 3, acronym: "SE", name: "Sudeste"}, ...]
@spec find(integer() | String.t() | [integer() | String.t()], Keyword.t()) :: {:ok, [ExIbge.Geography.Region.t()]} | {:error, any()}
Get region(s) by identifier(s).
Parameters
ids- A single integer ID or a list of integer IDs.query- Optional parameters supported by the API.
Examples
# Get a single region
iex> ExIbge.Locality.Region.find(3)
{:ok, [%ExIbge.Geography.Region{id: 3, acronym: "SE", name: "Sudeste"}]}
# Get multiple regions
iex> ExIbge.Locality.Region.find([3, 4])
{:ok, [%ExIbge.Geography.Region{id: 3, ...}, %ExIbge.Geography.Region{id: 4, ...}]}See Also
@spec find!(integer() | String.t() | [integer() | String.t()], Keyword.t()) :: [ ExIbge.Geography.Region.t() ]
Same as find/2, but raises an error on failure.
Params and options are the same as find/2.
Examples
iex> ExIbge.Locality.Region.find!(3)
[%ExIbge.Geography.Region{id: 3, acronym: "SE", name: "Sudeste"}]