ExIbge.Locality.IntermediateRegion (ex_ibge v0.4.0)

Copy Markdown View Source

Module for handling Intermediate Region (Região Intermediária) queries from IBGE.

This module provides functions to fetch Intermediate Regions by various geographical hierarchies (State, Region).

Summary

Functions

Get all intermediate regions.

Same as all/1, but raises an error on failure.

Get intermediate region(s) by identifier(s).

Same as find/2, but raises an error on failure.

Get intermediate regions by region identifier(s).

Same as get_by_region/2, but raises an error on failure.

Get intermediate regions by state identifier(s).

Same as get_by_state/2, but raises an error on failure.

Functions

all(query \\ [])

@spec all(Keyword.t()) ::
  {:ok, [ExIbge.Geography.IntermediateRegion.t()]} | {:error, any()}

Get all intermediate regions.

Parameters

  • query - Optional parameters supported by the API (e.g., order_by: :name).

Examples

iex> ExIbge.Locality.IntermediateRegion.all()
{:ok, [%ExIbge.Geography.IntermediateRegion{id: 3301, name: "Rio de Janeiro", ...}, ...]}

See Also

IBGE API: Regiões Intermediárias

all!(query \\ [])

Same as all/1, but raises an error on failure.

Examples

iex> ExIbge.Locality.IntermediateRegion.all!()
[%ExIbge.Geography.IntermediateRegion{id: 3301, name: "Rio de Janeiro", ...}, ...]

find(ids, query \\ [])

@spec find(integer() | String.t() | [integer() | String.t()], Keyword.t()) ::
  {:ok, [ExIbge.Geography.IntermediateRegion.t()]} | {:error, any()}

Get intermediate 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

iex> ExIbge.Locality.IntermediateRegion.find(3301)
{:ok, [%ExIbge.Geography.IntermediateRegion{id: 3301, name: "Rio de Janeiro", ...}]}

See Also

IBGE API: Região Intermediária por ID

find!(ids, query \\ [])

Same as find/2, but raises an error on failure.

Examples

iex> ExIbge.Locality.IntermediateRegion.find!(3301)
[%ExIbge.Geography.IntermediateRegion{id: 3301, name: "Rio de Janeiro", ...}]

get_by_region(region_ids, query \\ [])

@spec get_by_region(integer() | String.t() | [integer() | String.t()], Keyword.t()) ::
  {:ok, [ExIbge.Geography.IntermediateRegion.t()]} | {:error, any()}

Get intermediate regions by region identifier(s).

Parameters

  • region_ids - A single integer ID or a list of integer IDs.
  • query - Optional parameters supported by the API.

Examples

iex> ExIbge.Locality.IntermediateRegion.get_by_region(3)
{:ok, [%ExIbge.Geography.IntermediateRegion{...}, ...]}

See Also

IBGE API: Regiões Intermediárias por Região

get_by_region!(region_ids, query \\ [])

@spec get_by_region!(integer() | String.t() | [integer() | String.t()], Keyword.t()) ::
  [
    ExIbge.Geography.IntermediateRegion.t()
  ]

Same as get_by_region/2, but raises an error on failure.

Examples

iex> ExIbge.Locality.IntermediateRegion.get_by_region!(3)
[%ExIbge.Geography.IntermediateRegion{...}, ...]

get_by_state(uf_ids, query \\ [])

@spec get_by_state(
  integer() | atom() | String.t() | [integer() | atom() | String.t()],
  Keyword.t()
) :: {:ok, [ExIbge.Geography.IntermediateRegion.t()]} | {:error, any()}

Get intermediate regions by state identifier(s).

Parameters

  • uf_ids - A single identifier or list of identifiers (Integer ID or Atom UFs).
  • query - Optional parameters supported by the API.

Examples

iex> ExIbge.Locality.IntermediateRegion.get_by_state(33)
{:ok, [%ExIbge.Geography.IntermediateRegion{...}, ...]}

iex> ExIbge.Locality.IntermediateRegion.get_by_state(:rj)
{:ok, [%ExIbge.Geography.IntermediateRegion{...}, ...]}

See Also

IBGE API: Regiões Intermediárias por UF

get_by_state!(uf_ids, query \\ [])

@spec get_by_state!(
  integer() | atom() | String.t() | [integer() | atom() | String.t()],
  Keyword.t()
) :: [ExIbge.Geography.IntermediateRegion.t()]

Same as get_by_state/2, but raises an error on failure.

Examples

iex> ExIbge.Locality.IntermediateRegion.get_by_state!(33)
[%ExIbge.Geography.IntermediateRegion{...}, ...]