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

Module for handling Immediate Region (Região Imediata) queries from IBGE.

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

# `all`

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

Get all immediate regions.

## Parameters

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

## Examples

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

## See Also

[IBGE API: Regiões Imediatas](https://servicodados.ibge.gov.br/api/docs/localidades#api-Regioes_imediatas-regioes-imediatasGet)

# `all!`

```elixir
@spec all!(Keyword.t()) :: [ExIbge.Geography.ImmediateRegion.t()]
```

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

## Examples

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

# `find`

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

Get immediate 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.ImmediateRegion.find(330001)
    {:ok, [%ExIbge.Geography.ImmediateRegion{id: 330001, name: "Rio de Janeiro", ...}]}

## See Also

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

# `find!`

```elixir
@spec find!(integer() | String.t() | [integer() | String.t()], Keyword.t()) :: [
  ExIbge.Geography.ImmediateRegion.t()
]
```

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

## Examples

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

# `get_by_intermediate_region`

```elixir
@spec get_by_intermediate_region(
  integer() | String.t() | [integer() | String.t()],
  Keyword.t()
) :: {:ok, [ExIbge.Geography.ImmediateRegion.t()]} | {:error, any()}
```

Get immediate regions by intermediate region identifier(s).

## Parameters

  * `intermediate_region_ids` - A single integer ID or a list of integer IDs.
  * `query` - Optional parameters supported by the API.

## Examples

    iex> ExIbge.Locality.ImmediateRegion.get_by_intermediate_region(3301)
    {:ok, [%ExIbge.Geography.ImmediateRegion{...}, ...]}

## See Also

[IBGE API: Regiões Imediatas por Região Intermediária](https://servicodados.ibge.gov.br/api/docs/localidades#api-Regioes_imediatas-regioes_intermediariasRegiaoIntermediariaRegioesImediatasGet)

# `get_by_intermediate_region!`

```elixir
@spec get_by_intermediate_region!(
  integer() | String.t() | [integer() | String.t()],
  Keyword.t()
) :: [ExIbge.Geography.ImmediateRegion.t()]
```

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

## Examples

    iex> ExIbge.Locality.ImmediateRegion.get_by_intermediate_region!(3301)
    [%ExIbge.Geography.ImmediateRegion{...}, ...]

# `get_by_region`

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

Get immediate 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.ImmediateRegion.get_by_region(3)
    {:ok, [%ExIbge.Geography.ImmediateRegion{...}, ...]}

## See Also

[IBGE API: Regiões Imediatas por Região](https://servicodados.ibge.gov.br/api/docs/localidades#api-Regioes_imediatas-regioesMacrorregiaoRegioesImediatasGet)

# `get_by_region!`

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

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

## Examples

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

# `get_by_state`

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

Get immediate 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.ImmediateRegion.get_by_state(33)
    {:ok, [%ExIbge.Geography.ImmediateRegion{...}, ...]}

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

## See Also

[IBGE API: Regiões Imediatas por UF](https://servicodados.ibge.gov.br/api/docs/localidades#api-Regioes_imediatas-estadosUFRegioesImediatasGet)

# `get_by_state!`

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

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

## Examples

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

---

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