# `ExIbge.Locality.Region`
[🔗](https://github.com/pedrohfonseca81/ex_ibge/blob/main/lib/ex_ibge/locality/region.ex#L1)

Module for handling Region (Macrorregião) queries from IBGE.

This module provides functions to fetch Regions (Norte, Nordeste, Sudeste, Sul, Centro-Oeste).

# `all`

```elixir
@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

[IBGE API: Regiões](https://servicodados.ibge.gov.br/api/docs/localidades#api-Regioes-regioesGet)

# `all!`

```elixir
@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"}, ...]

# `find`

```elixir
@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

[IBGE API: Região por ID](https://servicodados.ibge.gov.br/api/docs/localidades#api-Regioes-regioesMacrorregiaoGet)

# `find!`

```elixir
@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"}]

---

*Consult [api-reference.md](api-reference.md) for complete listing*
