api

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHTTPClientNotSet is returned when a method is called and the http client is not configured.
	ErrHTTPClientNotSet = errors.New("http client not set")
)

Functions

This section is empty.

Types

type API

type API struct {
	UFs        UFs
	Distritos  Distritos
	Municipios Municipios
	Regioes    Regioes
}

API is the IBGE Localidades API object.

func New

func New(client httpClient) *API

type Distrito

type Distrito struct {
	ID        int       `json:"id"`
	Nome      string    `json:"nome"`
	Municipio Municipio `json:"municipio"`
}

Distrito representa um Distrito.

type Distritos

type Distritos struct {
	// contains filtered or unexported fields
}

func (*Distritos) Distritos

func (d *Distritos) Distritos(ctx context.Context) (DistritosResponse, error)

Distritos List all the Distritos. Returns a list of Distritos. GET https://servicodados.ibge.gov.br/api/v1/localidades/distritos

type DistritosResponse

type DistritosResponse []Distrito

DistritosResponse represents the response of the Distritos methods.

type Mesorregiao

type Mesorregiao struct {
	ID   int    `json:"id"`
	Nome string `json:"nome"`
	UF   UF     `json:"UF"`
}

Mesorregiao representa uma Mesorregião.

type Microrregiao

type Microrregiao struct {
	ID          int         `json:"id"`
	Nome        string      `json:"nome"`
	Mesorregiao Mesorregiao `json:"mesorregiao"`
}

Microrregiao representa uma Microrregião.

type Municipio

type Municipio struct {
	ID             int            `json:"id"`
	Nome           string         `json:"nome"`
	Microrregiao   Microrregiao   `json:"microrregiao"`
	RegiaoImediata RegiaoImediata `json:"regiao-imediata"`
}

Municipio representa um Município.

type Municipios

type Municipios struct {
	// contains filtered or unexported fields
}

func (*Municipios) Municipios

func (d *Municipios) Municipios(ctx context.Context) (MunicipiosResponse, error)

Municipios List all the Municípios. Returns a list of Municipios. GET https://servicodados.ibge.gov.br/api/v1/localidades/municipios

type MunicipiosResponse

type MunicipiosResponse []Municipio

MunicipiosResponse represents the response of the Municipios methods.

type Regiao

type Regiao struct {
	ID    int    `json:"id"`
	Nome  string `json:"nome"`
	Sigla string `json:"sigla"`
}

Regiao representa uma Região do país.

type RegiaoImediata

type RegiaoImediata struct {
	ID                  int                 `json:"id"`
	Nome                string              `json:"nome"`
	RegiaoIntermediaria RegiaoIntermediaria `json:"regiao-intermediaria"`
}

RegiaoImediata representa uma Região Imediata.

type RegiaoIntermediaria

type RegiaoIntermediaria struct {
	ID   int    `json:"id"`
	Nome string `json:"nome"`
	UF   UF     `json:"UF"`
}

RegiaoIntermediaria representa uma Região Intermediária.

type Regioes

type Regioes struct {
	// contains filtered or unexported fields
}

func (*Regioes) Regioes

func (d *Regioes) Regioes(ctx context.Context) (RegioesResponse, error)

Regioes List all the Municípios. Returns a list of Regioes. GET https://servicodados.ibge.gov.br/api/v1/localidades/regioes

type RegioesResponse

type RegioesResponse []Regiao

RegioesResponse represents the response of the Regioes methods.

type UF

type UF struct {
	ID     int    `json:"id"`
	Nome   string `json:"nome"`
	Sigla  string `json:"sigla"`
	Regiao Regiao `json:"regiao"`
}

UF representa uma Unidade da Federação.

type UFs

type UFs struct {
	// contains filtered or unexported fields
}

func (*UFs) UFs

func (ufs *UFs) UFs(ctx context.Context) (UFsResponse, error)

UFs List all the UFs. Returns a list of UFs. GET https://servicodados.ibge.gov.br/api/v1/localidades/estados

type UFsResponse

type UFsResponse []UF

UFsResponse represents the response of the UFs methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL