findcep

package module
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

README

Findcep Go API Library

Go Reference

The Findcep Go library provides convenient access to the Findcep REST API from applications written in Go. The full API of this library can be found in api.md.

It is generated with Stainless.

Installation

import (
	"github.com/brennoo/findcep-go" // imported as findcep
)

Or to pin the version:

go get -u 'github.com/brennoo/findcep-go@v0.1.0-alpha.3'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/brennoo/findcep-go"
)

func main() {
	client := findcep.NewClient()
	endereco, err := client.Enderecos.Pesquisa(context.TODO(), findcep.EnderecoPesquisaParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", endereco.Hits)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: findcep.F("hello"),

	// Explicitly send `"description": null`
	Description: findcep.Null[string](),

	Point: findcep.F(findcep.Point{
		X: findcep.Int(0),
		Y: findcep.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: findcep.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the response JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := findcep.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Enderecos.Pesquisa(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *findcep.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Enderecos.Pesquisa(context.TODO(), findcep.EnderecoPesquisaParams{})
if err != nil {
	var apierr *findcep.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/endereco/pesquisa": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Enderecos.Pesquisa(
	ctx,
	findcep.EnderecoPesquisaParams{},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as param.Field[io.Reader]. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper findcep.FileParam(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := findcep.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Enderecos.Pesquisa(
	context.TODO(),
	findcep.EnderecoPesquisaParams{},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
endereco, err := client.Enderecos.Pesquisa(
	context.TODO(),
	findcep.EnderecoPesquisaParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", endereco)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]interface{}

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   findcep.F("id_xxxx"),
    Data: findcep.F(FooNewParamsData{
        FirstName: findcep.F("John"),
    }),
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := findcep.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (). This should be used to initialize new clients.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type Bairros

type Bairros struct {
	// Lista com todos os bairros
	Bairros []string `json:"bairros"`
	// Nome da Cidade
	Cidade string `json:"cidade"`
	// reservado para o futuro
	Extras []interface{} `json:"extras"`
	// é a chave unica da localidade resultada da junçao dos campos "uf|cidade" da base
	// de Cep usando "shake_128" com Output Lenght setado em 5 bytes em hexadecimal.
	// "python3.8" "import hashlib;
	// print(hashlib.shake_128(b'SP|Bebedouro').hexdigest(5))"
	HashKey string `json:"hash_key"`
	// todos os nomes dos bairros
	Uf string `json:"uf"`
	// campo cidade normalizado com lower case e replace dos espaços por "-" para ser
	// usado como parte da url
	URLKey string `json:"url_key"`
	// timestamp com ultima atualizacao do dado
	Version int64       `json:"version"`
	JSON    bairrosJSON `json:"-"`
}

func (*Bairros) UnmarshalJSON

func (r *Bairros) UnmarshalJSON(data []byte) (err error)

type Cep

type Cep struct {
	// Neighborhood
	Bairro string `json:"bairro"`
	// cep
	Cep string `json:"cep"`
	// City
	Cidade string `json:"cidade"`
	// IBGE Code
	CodigoIbge string `json:"codigo_ibge"`
	// Address complement only for directions
	Complemento string `json:"complemento"`
	// Address
	Logradouro string `json:"logradouro"`
	// Este campo só trará conteudo quando o campo "tipo" é igual a "cep_cod_especial e
	// cep_caixa_postal_comunitaria". Geralmente opcional para os formularios.
	Nome string `json:"nome"`
	// Status of CEP São denominados "completo" todos os ceps que não precisam de
	// interação manual do usuario para completar o endereço. Ver mais em "tipo". São
	// denominados "incompleto" todos os ceps que precisam ser completados pelo
	// usuario, pois esse tipo de cep geralmente não devolve os campos "logradouro/rua"
	// e "bairro". ver mais em "tipo".
	Status CepStatus `json:"status"`
	// cep_logradouro é um cep completo, com todos os campos do endereço fornecidas.
	// cep_localidade "14740-000" é um cep incompleto e regularmente conhecido como
	// "CEP ÚNICO", pois este cep engloba todo o municipio, pois a cidade ainda nao tem
	// populacao sufieciente para ter o cep catalogado por logradouro.
	// cep_agencia_correios "61603-970" é cep das agencias dos correios pelo Brasil.
	// cep_cod_especial "60150-901" é o cep grande usuario, e são os ceps destinados a
	// grandes empresas, universidades e outras denominacões que tenham um alto volume
	// de correspondencia, funcionando como uma mini-cidade, neste tipo de cep, o campo
	// "nome" trará a denominacao da instituição. cep_caixa_postal_comunitaria
	// "12918-991" é um cep incompleto e geralmente usado apenas para
	// "correspondencia", e regularmente "não é habilitado para entrega de encomendas"
	// por diversas transportadoras.
	Tipo CepTipo `json:"tipo"`
	// State
	Uf   string  `json:"uf"`
	JSON cepJSON `json:"-"`
}

func (*Cep) UnmarshalJSON

func (r *Cep) UnmarshalJSON(data []byte) (err error)

type CepRemovidoService

type CepRemovidoService struct {
	Options []option.RequestOption
}

CepRemovidoService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCepRemovidoService method instead.

func NewCepRemovidoService

func NewCepRemovidoService(opts ...option.RequestOption) (r *CepRemovidoService)

NewCepRemovidoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CepRemovidoService) Get

func (r *CepRemovidoService) Get(ctx context.Context, cepRemovido string, opts ...option.RequestOption) (res *Cep, err error)

Returns a map with address. Lista de ceps removidos. [11680000, 35570000, 62500000, 95180000, 13480637, 90040440, 77020902]

type CepService

type CepService struct {
	Options  []option.RequestOption
	Removido *CepRemovidoService
}

CepService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCepService method instead.

func NewCepService

func NewCepService(opts ...option.RequestOption) (r *CepService)

NewCepService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CepService) Get

func (r *CepService) Get(ctx context.Context, cep string, opts ...option.RequestOption) (res *Cep, err error)

Returns a map with address. Lista de ceps para validar todos os campos de retorno. [01234000, 01010000, 14740000, 61603970, 60150901, 12918991, 99999999]

type CepStatus

type CepStatus string

Status of CEP São denominados "completo" todos os ceps que não precisam de interação manual do usuario para completar o endereço. Ver mais em "tipo". São denominados "incompleto" todos os ceps que precisam ser completados pelo usuario, pois esse tipo de cep geralmente não devolve os campos "logradouro/rua" e "bairro". ver mais em "tipo".

const (
	CepStatusCompleto   CepStatus = "completo"
	CepStatusIncompleto CepStatus = "incompleto"
)

func (CepStatus) IsKnown

func (r CepStatus) IsKnown() bool

type CepTipo

type CepTipo string

cep_logradouro é um cep completo, com todos os campos do endereço fornecidas. cep_localidade "14740-000" é um cep incompleto e regularmente conhecido como "CEP ÚNICO", pois este cep engloba todo o municipio, pois a cidade ainda nao tem populacao sufieciente para ter o cep catalogado por logradouro. cep_agencia_correios "61603-970" é cep das agencias dos correios pelo Brasil. cep_cod_especial "60150-901" é o cep grande usuario, e são os ceps destinados a grandes empresas, universidades e outras denominacões que tenham um alto volume de correspondencia, funcionando como uma mini-cidade, neste tipo de cep, o campo "nome" trará a denominacao da instituição. cep_caixa_postal_comunitaria "12918-991" é um cep incompleto e geralmente usado apenas para "correspondencia", e regularmente "não é habilitado para entrega de encomendas" por diversas transportadoras.

const (
	CepTipoCepLogradouro             CepTipo = "cep_logradouro"
	CepTipoCepLocalidade             CepTipo = "cep_localidade"
	CepTipoCepAgenciaCorreios        CepTipo = "cep_agencia_correios"
	CepTipoCepCodEspecial            CepTipo = "cep_cod_especial"
	CepTipoCepCaixaPostalComunitaria CepTipo = "cep_caixa_postal_comunitaria"
)

func (CepTipo) IsKnown

func (r CepTipo) IsKnown() bool

type Cidades

type Cidades []CidadesItem

type CidadesItem

type CidadesItem struct {
	HashKey string          `json:"hash_key"`
	Nome    string          `json:"nome"`
	URLKey  string          `json:"url_key"`
	JSON    cidadesItemJSON `json:"-"`
}

func (*CidadesItem) UnmarshalJSON

func (r *CidadesItem) UnmarshalJSON(data []byte) (err error)

type Client

type Client struct {
	Options      []option.RequestOption
	Ceps         *CepService
	Enderecos    *EnderecoService
	Geolocations *GeolocationService
	GeoDistances *GeoDistanceService
	Localidades  *LocalidadeService
}

Client creates a struct with services and top level methods that help with interacting with the findcep API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned [url.Values] will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params interface{}, res interface{}, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type Endereco

type Endereco struct {
	Hits EnderecoHits `json:"hits"`
	JSON enderecoJSON `json:"-"`
}

func (*Endereco) UnmarshalJSON

func (r *Endereco) UnmarshalJSON(data []byte) (err error)

type EnderecoHits

type EnderecoHits struct {
	Hits  []EnderecoHitsHit `json:"hits"`
	Total int64             `json:"total"`
	JSON  enderecoHitsJSON  `json:"-"`
}

func (*EnderecoHits) UnmarshalJSON

func (r *EnderecoHits) UnmarshalJSON(data []byte) (err error)

type EnderecoHitsHit

type EnderecoHitsHit struct {
	Source interface{}         `json:"_source"`
	JSON   enderecoHitsHitJSON `json:"-"`
}

func (*EnderecoHitsHit) UnmarshalJSON

func (r *EnderecoHitsHit) UnmarshalJSON(data []byte) (err error)

type EnderecoPesquisaParams

type EnderecoPesquisaParams struct {
	// modelo do template de busca
	ID     param.Field[string]                       `json:"id"`
	Params param.Field[EnderecoPesquisaParamsParams] `json:"params"`
}

func (EnderecoPesquisaParams) MarshalJSON

func (r EnderecoPesquisaParams) MarshalJSON() (data []byte, err error)

type EnderecoPesquisaParamsParams

type EnderecoPesquisaParamsParams struct {
	// paginação dos resultados
	From param.Field[int64] `json:"from"`
	// termo para busca
	QueryString param.Field[string] `json:"query_string"`
	// quantidade de registros a serem exibidos
	Size param.Field[int64] `json:"size"`
}

func (EnderecoPesquisaParamsParams) MarshalJSON

func (r EnderecoPesquisaParamsParams) MarshalJSON() (data []byte, err error)

type EnderecoService

type EnderecoService struct {
	Options   []option.RequestOption
	Templates *EnderecoTemplateService
}

EnderecoService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEnderecoService method instead.

func NewEnderecoService

func NewEnderecoService(opts ...option.RequestOption) (r *EnderecoService)

NewEnderecoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EnderecoService) Pesquisa

func (r *EnderecoService) Pesquisa(ctx context.Context, body EnderecoPesquisaParams, opts ...option.RequestOption) (res *Endereco, err error)

Essa método aceita acentuação na busca e usa um modelo de aproximação das palavras para contornar erros de ortograficos de nomes e sobrenomes dos endereços.

type EnderecoTemplateCodigoIbgeNewParams

type EnderecoTemplateCodigoIbgeNewParams struct {
	// modelo do template de busca
	ID     param.Field[string]                                    `json:"id"`
	Params param.Field[EnderecoTemplateCodigoIbgeNewParamsParams] `json:"params"`
}

func (EnderecoTemplateCodigoIbgeNewParams) MarshalJSON

func (r EnderecoTemplateCodigoIbgeNewParams) MarshalJSON() (data []byte, err error)

type EnderecoTemplateCodigoIbgeNewParamsParams

type EnderecoTemplateCodigoIbgeNewParamsParams struct {
	// filtro para busca
	CodigoIbge param.Field[string] `json:"codigo_ibge"`
	// paginação dos resultados
	From param.Field[int64] `json:"from"`
	// termo para busca no campo logradouro
	QueryString param.Field[string] `json:"query_string"`
	// quantidade de registros a serem exibidos
	Size param.Field[int64] `json:"size"`
}

func (EnderecoTemplateCodigoIbgeNewParamsParams) MarshalJSON

func (r EnderecoTemplateCodigoIbgeNewParamsParams) MarshalJSON() (data []byte, err error)

type EnderecoTemplateCodigoIbgeService

type EnderecoTemplateCodigoIbgeService struct {
	Options []option.RequestOption
}

EnderecoTemplateCodigoIbgeService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEnderecoTemplateCodigoIbgeService method instead.

func NewEnderecoTemplateCodigoIbgeService

func NewEnderecoTemplateCodigoIbgeService(opts ...option.RequestOption) (r *EnderecoTemplateCodigoIbgeService)

NewEnderecoTemplateCodigoIbgeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EnderecoTemplateCodigoIbgeService) New

Essa método aceita acentuação na busca e usa um modelo de aproximação das palavras para contornar erros de ortograficos de nomes e sobrenomes dos endereços.

type EnderecoTemplateService

type EnderecoTemplateService struct {
	Options    []option.RequestOption
	CodigoIbge *EnderecoTemplateCodigoIbgeService
	Uf         *EnderecoTemplateUfService
}

EnderecoTemplateService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEnderecoTemplateService method instead.

func NewEnderecoTemplateService

func NewEnderecoTemplateService(opts ...option.RequestOption) (r *EnderecoTemplateService)

NewEnderecoTemplateService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type EnderecoTemplateUfCidadeNewParams

type EnderecoTemplateUfCidadeNewParams struct {
	// modelo do template de busca
	ID     param.Field[string]                                  `json:"id"`
	Params param.Field[EnderecoTemplateUfCidadeNewParamsParams] `json:"params"`
}

func (EnderecoTemplateUfCidadeNewParams) MarshalJSON

func (r EnderecoTemplateUfCidadeNewParams) MarshalJSON() (data []byte, err error)

type EnderecoTemplateUfCidadeNewParamsParams

type EnderecoTemplateUfCidadeNewParamsParams struct {
	// filtro para busca
	Cidade param.Field[string] `json:"cidade"`
	// paginação dos resultados
	From param.Field[int64] `json:"from"`
	// termo para busca no campo logradouro
	QueryString param.Field[string] `json:"query_string"`
	// quantidade de registros a serem exibidos
	Size param.Field[int64] `json:"size"`
	// filtro para busca
	Uf param.Field[string] `json:"uf"`
}

func (EnderecoTemplateUfCidadeNewParamsParams) MarshalJSON

func (r EnderecoTemplateUfCidadeNewParamsParams) MarshalJSON() (data []byte, err error)

type EnderecoTemplateUfCidadeService

type EnderecoTemplateUfCidadeService struct {
	Options []option.RequestOption
}

EnderecoTemplateUfCidadeService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEnderecoTemplateUfCidadeService method instead.

func NewEnderecoTemplateUfCidadeService

func NewEnderecoTemplateUfCidadeService(opts ...option.RequestOption) (r *EnderecoTemplateUfCidadeService)

NewEnderecoTemplateUfCidadeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EnderecoTemplateUfCidadeService) New

Essa método aceita acentuação na busca e usa um modelo de aproximação das palavras para contornar erros de ortograficos de nomes e sobrenomes dos endereços.

type EnderecoTemplateUfNewParams

type EnderecoTemplateUfNewParams struct {
	// modelo do template de busca
	ID     param.Field[string]                            `json:"id"`
	Params param.Field[EnderecoTemplateUfNewParamsParams] `json:"params"`
}

func (EnderecoTemplateUfNewParams) MarshalJSON

func (r EnderecoTemplateUfNewParams) MarshalJSON() (data []byte, err error)

type EnderecoTemplateUfNewParamsParams

type EnderecoTemplateUfNewParamsParams struct {
	// paginação dos resultados
	From param.Field[int64] `json:"from"`
	// termo para busca no campo logradouro
	QueryString param.Field[string] `json:"query_string"`
	// quantidade de registros a serem exibidos
	Size param.Field[int64] `json:"size"`
	// filtro para busca
	Uf param.Field[string] `json:"uf"`
}

func (EnderecoTemplateUfNewParamsParams) MarshalJSON

func (r EnderecoTemplateUfNewParamsParams) MarshalJSON() (data []byte, err error)

type EnderecoTemplateUfService

type EnderecoTemplateUfService struct {
	Options []option.RequestOption
	Cidade  *EnderecoTemplateUfCidadeService
}

EnderecoTemplateUfService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewEnderecoTemplateUfService method instead.

func NewEnderecoTemplateUfService

func NewEnderecoTemplateUfService(opts ...option.RequestOption) (r *EnderecoTemplateUfService)

NewEnderecoTemplateUfService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*EnderecoTemplateUfService) New

Essa método aceita acentuação na busca e usa um modelo de aproximação das palavras para contornar erros de ortograficos de nomes e sobrenomes dos endereços.

type Error

type Error = apierror.Error

type Estados

type Estados []EstadosItem

type EstadosItem

type EstadosItem struct {
	Nome   string            `json:"nome"`
	Region EstadosItemRegion `json:"region"`
	Sigla  string            `json:"sigla"`
	JSON   estadosItemJSON   `json:"-"`
}

func (*EstadosItem) UnmarshalJSON

func (r *EstadosItem) UnmarshalJSON(data []byte) (err error)

type EstadosItemRegion

type EstadosItemRegion struct {
	Nome  string                `json:"nome"`
	Sigla string                `json:"sigla"`
	JSON  estadosItemRegionJSON `json:"-"`
}

func (*EstadosItemRegion) UnmarshalJSON

func (r *EstadosItemRegion) UnmarshalJSON(data []byte) (err error)

type GeoDistanceDistanceFromCepToCepService

type GeoDistanceDistanceFromCepToCepService struct {
	Options []option.RequestOption
}

GeoDistanceDistanceFromCepToCepService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeoDistanceDistanceFromCepToCepService method instead.

func NewGeoDistanceDistanceFromCepToCepService

func NewGeoDistanceDistanceFromCepToCepService(opts ...option.RequestOption) (r *GeoDistanceDistanceFromCepToCepService)

NewGeoDistanceDistanceFromCepToCepService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GeoDistanceDistanceFromCepToCepService) List

func (r *GeoDistanceDistanceFromCepToCepService) List(ctx context.Context, cepFrom string, cepTo string, approximate float64, opts ...option.RequestOption) (res *GeolocationCep, err error)

Returns a distance between two cep. Lista de ceps para validar todos os campos de retorno. [01234000, 99945970, 01010000, 14740000, 61603970, 60150901, 12918991, 99999999]

type GeoDistanceDistanceFromCepToLatlonService

type GeoDistanceDistanceFromCepToLatlonService struct {
	Options []option.RequestOption
}

GeoDistanceDistanceFromCepToLatlonService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeoDistanceDistanceFromCepToLatlonService method instead.

func NewGeoDistanceDistanceFromCepToLatlonService

func NewGeoDistanceDistanceFromCepToLatlonService(opts ...option.RequestOption) (r *GeoDistanceDistanceFromCepToLatlonService)

NewGeoDistanceDistanceFromCepToLatlonService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GeoDistanceDistanceFromCepToLatlonService) List

func (r *GeoDistanceDistanceFromCepToLatlonService) List(ctx context.Context, cepFrom string, latlonTo string, approximate float64, opts ...option.RequestOption) (res *GeolocationCep, err error)

Returns a distance between two cep. Lista de ceps para validar todos os campos de retorno. [01234000, 99945970, 01010000, 14740000, 61603970, 60150901, 12918991, 99999999]

type GeoDistanceDistanceFromLatlonToLatlonService

type GeoDistanceDistanceFromLatlonToLatlonService struct {
	Options []option.RequestOption
}

GeoDistanceDistanceFromLatlonToLatlonService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeoDistanceDistanceFromLatlonToLatlonService method instead.

func NewGeoDistanceDistanceFromLatlonToLatlonService

func NewGeoDistanceDistanceFromLatlonToLatlonService(opts ...option.RequestOption) (r *GeoDistanceDistanceFromLatlonToLatlonService)

NewGeoDistanceDistanceFromLatlonToLatlonService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GeoDistanceDistanceFromLatlonToLatlonService) List

func (r *GeoDistanceDistanceFromLatlonToLatlonService) List(ctx context.Context, latlonFrom string, latlonTo string, approximate float64, opts ...option.RequestOption) (res *GeolocationCep, err error)

Returns a distance between two cep. Lista de ceps para validar todos os campos de retorno. [01234000, 99945970, 01010000, 14740000, 61603970, 60150901, 12918991, 99999999]

type GeoDistanceService

type GeoDistanceService struct {
	Options                    []option.RequestOption
	DistanceFromCepToCep       *GeoDistanceDistanceFromCepToCepService
	DistanceFromCepToLatlon    *GeoDistanceDistanceFromCepToLatlonService
	DistanceFromLatlonToLatlon *GeoDistanceDistanceFromLatlonToLatlonService
}

GeoDistanceService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeoDistanceService method instead.

func NewGeoDistanceService

func NewGeoDistanceService(opts ...option.RequestOption) (r *GeoDistanceService)

NewGeoDistanceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type GeolocationCep

type GeolocationCep struct {
	// geo location
	Location GeolocationCepLocation `json:"location"`
	// cep
	PostalCode string `json:"postal_code"`
	// true quando existir geo coodenadas disponiveis para o cep
	Status bool               `json:"status"`
	JSON   geolocationCepJSON `json:"-"`
}

func (*GeolocationCep) UnmarshalJSON

func (r *GeolocationCep) UnmarshalJSON(data []byte) (err error)

type GeolocationCepLocation

type GeolocationCepLocation struct {
	Lat  float64                    `json:"lat"`
	Lon  float64                    `json:"lon"`
	JSON geolocationCepLocationJSON `json:"-"`
}

geo location

func (*GeolocationCepLocation) UnmarshalJSON

func (r *GeolocationCepLocation) UnmarshalJSON(data []byte) (err error)

type GeolocationDistanceFromCepService

type GeolocationDistanceFromCepService struct {
	Options  []option.RequestOption
	ToCep    *GeolocationDistanceFromCepToCepService
	ToLatlon *GeolocationDistanceFromCepToLatlonService
}

GeolocationDistanceFromCepService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeolocationDistanceFromCepService method instead.

func NewGeolocationDistanceFromCepService

func NewGeolocationDistanceFromCepService(opts ...option.RequestOption) (r *GeolocationDistanceFromCepService)

NewGeolocationDistanceFromCepService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type GeolocationDistanceFromCepToCepService

type GeolocationDistanceFromCepToCepService struct {
	Options []option.RequestOption
}

GeolocationDistanceFromCepToCepService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeolocationDistanceFromCepToCepService method instead.

func NewGeolocationDistanceFromCepToCepService

func NewGeolocationDistanceFromCepToCepService(opts ...option.RequestOption) (r *GeolocationDistanceFromCepToCepService)

NewGeolocationDistanceFromCepToCepService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GeolocationDistanceFromCepToCepService) List

Returns a distance between two cep. Lista de ceps para validar todos os campos de retorno. [01234000, 99945970, 01010000, 14740000, 61603970, 60150901, 12918991, 99999999]

type GeolocationDistanceFromCepToLatlonService

type GeolocationDistanceFromCepToLatlonService struct {
	Options []option.RequestOption
}

GeolocationDistanceFromCepToLatlonService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeolocationDistanceFromCepToLatlonService method instead.

func NewGeolocationDistanceFromCepToLatlonService

func NewGeolocationDistanceFromCepToLatlonService(opts ...option.RequestOption) (r *GeolocationDistanceFromCepToLatlonService)

NewGeolocationDistanceFromCepToLatlonService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GeolocationDistanceFromCepToLatlonService) List

func (r *GeolocationDistanceFromCepToLatlonService) List(ctx context.Context, cepFrom string, latlonTo string, opts ...option.RequestOption) (res *GeolocationCep, err error)

Returns a distance between two cep. Lista de ceps para validar todos os campos de retorno. [01234000, 99945970, 01010000, 14740000, 61603970, 60150901, 12918991, 99999999]

type GeolocationDistanceFromLatlonService

type GeolocationDistanceFromLatlonService struct {
	Options  []option.RequestOption
	ToLatlon *GeolocationDistanceFromLatlonToLatlonService
}

GeolocationDistanceFromLatlonService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeolocationDistanceFromLatlonService method instead.

func NewGeolocationDistanceFromLatlonService

func NewGeolocationDistanceFromLatlonService(opts ...option.RequestOption) (r *GeolocationDistanceFromLatlonService)

NewGeolocationDistanceFromLatlonService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type GeolocationDistanceFromLatlonToLatlonService

type GeolocationDistanceFromLatlonToLatlonService struct {
	Options []option.RequestOption
}

GeolocationDistanceFromLatlonToLatlonService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeolocationDistanceFromLatlonToLatlonService method instead.

func NewGeolocationDistanceFromLatlonToLatlonService

func NewGeolocationDistanceFromLatlonToLatlonService(opts ...option.RequestOption) (r *GeolocationDistanceFromLatlonToLatlonService)

NewGeolocationDistanceFromLatlonToLatlonService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GeolocationDistanceFromLatlonToLatlonService) List

func (r *GeolocationDistanceFromLatlonToLatlonService) List(ctx context.Context, latlonFrom string, latlonTo string, opts ...option.RequestOption) (res *GeolocationCep, err error)

Returns a distance between two cep. Lista de ceps para validar todos os campos de retorno. [01234000, 99945970, 01010000, 14740000, 61603970, 60150901, 12918991, 99999999]

type GeolocationDistanceService

type GeolocationDistanceService struct {
	Options    []option.RequestOption
	FromCep    *GeolocationDistanceFromCepService
	FromLatlon *GeolocationDistanceFromLatlonService
}

GeolocationDistanceService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeolocationDistanceService method instead.

func NewGeolocationDistanceService

func NewGeolocationDistanceService(opts ...option.RequestOption) (r *GeolocationDistanceService)

NewGeolocationDistanceService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type GeolocationService

type GeolocationService struct {
	Options   []option.RequestOption
	Distances *GeolocationDistanceService
}

GeolocationService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewGeolocationService method instead.

func NewGeolocationService

func NewGeolocationService(opts ...option.RequestOption) (r *GeolocationService)

NewGeolocationService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*GeolocationService) Get

func (r *GeolocationService) Get(ctx context.Context, cep string, opts ...option.RequestOption) (res *GeolocationCep, err error)

Returns a map with geo coordinates. Lista de ceps para validar todos os campos de retorno. [01234000, 99945970, 01010000, 14740000, 61603970, 60150901, 12918991, 99999999]

type Ibge

type Ibge struct {
	// Nome da Cidade
	Cidade string `json:"cidade"`
	// Texto com codigo ibge
	CodigoIbge string `json:"codigo_ibge"`
	// reservado para o futuro
	Extras []interface{} `json:"extras"`
	// é a chave unica da localidade resultada da junçao dos campos "uf|cidade" da base
	// de Cep usando "shake_128" com Output Lenght setado em 5 bytes em hexadecimal.
	// python3 -c "import hashlib;
	// print(hashlib.shake_128(b'SP|Bebedouro').hexdigest(5))"
	HashKey string `json:"hash_key"`
	// todos os nomes dos bairros
	Uf string `json:"uf"`
	// campo cidade normalizado com lower case e replace dos espaços por "-" para ser
	// usado como parte da url
	URLKey string   `json:"url_key"`
	JSON   ibgeJSON `json:"-"`
}

func (*Ibge) UnmarshalJSON

func (r *Ibge) UnmarshalJSON(data []byte) (err error)

type LocalidadeCidadeBairroService

type LocalidadeCidadeBairroService struct {
	Options []option.RequestOption
}

LocalidadeCidadeBairroService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeCidadeBairroService method instead.

func NewLocalidadeCidadeBairroService

func NewLocalidadeCidadeBairroService(opts ...option.RequestOption) (r *LocalidadeCidadeBairroService)

NewLocalidadeCidadeBairroService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*LocalidadeCidadeBairroService) List

func (r *LocalidadeCidadeBairroService) List(ctx context.Context, cidadeHash string, opts ...option.RequestOption) (res *Bairros, err error)

Returns a map of bairros

type LocalidadeCidadeIbgeService

type LocalidadeCidadeIbgeService struct {
	Options []option.RequestOption
}

LocalidadeCidadeIbgeService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeCidadeIbgeService method instead.

func NewLocalidadeCidadeIbgeService

func NewLocalidadeCidadeIbgeService(opts ...option.RequestOption) (r *LocalidadeCidadeIbgeService)

NewLocalidadeCidadeIbgeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*LocalidadeCidadeIbgeService) Get

func (r *LocalidadeCidadeIbgeService) Get(ctx context.Context, cidadeHash string, opts ...option.RequestOption) (res *Ibge, err error)

Returns a IBGE code id

type LocalidadeCidadeService

type LocalidadeCidadeService struct {
	Options []option.RequestOption
	Bairros *LocalidadeCidadeBairroService
	Ibge    *LocalidadeCidadeIbgeService
}

LocalidadeCidadeService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeCidadeService method instead.

func NewLocalidadeCidadeService

func NewLocalidadeCidadeService(opts ...option.RequestOption) (r *LocalidadeCidadeService)

NewLocalidadeCidadeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type LocalidadeCodigoMunicipioService

type LocalidadeCodigoMunicipioService struct {
	Options []option.RequestOption
}

LocalidadeCodigoMunicipioService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeCodigoMunicipioService method instead.

func NewLocalidadeCodigoMunicipioService

func NewLocalidadeCodigoMunicipioService(opts ...option.RequestOption) (r *LocalidadeCodigoMunicipioService)

NewLocalidadeCodigoMunicipioService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*LocalidadeCodigoMunicipioService) Get

func (r *LocalidadeCodigoMunicipioService) Get(ctx context.Context, codigoIbge string, opts ...option.RequestOption) (res *Ibge, err error)

Returns a IBGE code id

type LocalidadeCodigoService

type LocalidadeCodigoService struct {
	Options   []option.RequestOption
	Municipio *LocalidadeCodigoMunicipioService
}

LocalidadeCodigoService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeCodigoService method instead.

func NewLocalidadeCodigoService

func NewLocalidadeCodigoService(opts ...option.RequestOption) (r *LocalidadeCodigoService)

NewLocalidadeCodigoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type LocalidadeEstadoCidadeBairroService

type LocalidadeEstadoCidadeBairroService struct {
	Options []option.RequestOption
}

LocalidadeEstadoCidadeBairroService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeEstadoCidadeBairroService method instead.

func NewLocalidadeEstadoCidadeBairroService

func NewLocalidadeEstadoCidadeBairroService(opts ...option.RequestOption) (r *LocalidadeEstadoCidadeBairroService)

NewLocalidadeEstadoCidadeBairroService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*LocalidadeEstadoCidadeBairroService) List

func (r *LocalidadeEstadoCidadeBairroService) List(ctx context.Context, uf string, cidadeKey string, opts ...option.RequestOption) (res *Bairros, err error)

Returns a map of bairros

type LocalidadeEstadoCidadeIbgeService

type LocalidadeEstadoCidadeIbgeService struct {
	Options []option.RequestOption
}

LocalidadeEstadoCidadeIbgeService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeEstadoCidadeIbgeService method instead.

func NewLocalidadeEstadoCidadeIbgeService

func NewLocalidadeEstadoCidadeIbgeService(opts ...option.RequestOption) (r *LocalidadeEstadoCidadeIbgeService)

NewLocalidadeEstadoCidadeIbgeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*LocalidadeEstadoCidadeIbgeService) Get

func (r *LocalidadeEstadoCidadeIbgeService) Get(ctx context.Context, uf string, cidadeKey string, opts ...option.RequestOption) (res *Ibge, err error)

Returns a IBGE code id

type LocalidadeEstadoCidadeService

type LocalidadeEstadoCidadeService struct {
	Options []option.RequestOption
	Bairros *LocalidadeEstadoCidadeBairroService
	Ibge    *LocalidadeEstadoCidadeIbgeService
}

LocalidadeEstadoCidadeService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeEstadoCidadeService method instead.

func NewLocalidadeEstadoCidadeService

func NewLocalidadeEstadoCidadeService(opts ...option.RequestOption) (r *LocalidadeEstadoCidadeService)

NewLocalidadeEstadoCidadeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*LocalidadeEstadoCidadeService) List

func (r *LocalidadeEstadoCidadeService) List(ctx context.Context, uf string, opts ...option.RequestOption) (res *Cidades, err error)

Returns a list of Cities per State

type LocalidadeEstadoService

type LocalidadeEstadoService struct {
	Options []option.RequestOption
	Cidades *LocalidadeEstadoCidadeService
	Cidade  *LocalidadeEstadoCidadeService
}

LocalidadeEstadoService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeEstadoService method instead.

func NewLocalidadeEstadoService

func NewLocalidadeEstadoService(opts ...option.RequestOption) (r *LocalidadeEstadoService)

NewLocalidadeEstadoService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*LocalidadeEstadoService) List

func (r *LocalidadeEstadoService) List(ctx context.Context, opts ...option.RequestOption) (res *Estados, err error)

Returns a list of states

type LocalidadeService

type LocalidadeService struct {
	Options []option.RequestOption
	Estados *LocalidadeEstadoService
	Estado  *LocalidadeEstadoService
	Cidade  *LocalidadeCidadeService
	Codigo  *LocalidadeCodigoService
}

LocalidadeService contains methods and other services that help with interacting with the findcep API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLocalidadeService method instead.

func NewLocalidadeService

func NewLocalidadeService(opts ...option.RequestOption) (r *LocalidadeService)

NewLocalidadeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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