#brasil #api-bindings #api-client #brasil-api

brasilapi-client

Rust client implementation to consume BrasilAPI

6 releases

0.2.2 Dec 20, 2021
0.2.1 Oct 1, 2021
0.2.0 Sep 22, 2021
0.1.3 Sep 8, 2021

#1253 in #api-client

MIT license

29KB
645 lines

Brasil API - Rust client wrapper

Rust

Rust client implementation for Brasil API

BrasilAPI GitHub Project

Installation

To use this client, add the following to your Cargo.toml:

[dependencies]
brasilapi-client = "0.2"

You may also choose a runtime

futures = "0.3" # If not using async runtimes

Getting Started

 use brasilapi_client::{client::BrasilApiClient};
 use futures::executor::block_on;

 fn main() { block_on(async move {
     // As this API is public, you can use the following default builder
     let cli = BrasilApiClient::new_default();

     // Get the address info for zipcode  "01402-000"
     let zipcode_answer = cli.get_cep("01402-000", None).await.unwrap();

     println!("Street: {}", zipcode_answer.street);
 })}

Output:

Street: Avenida Brigadeiro Luiz Antonio

APIs

Banks

Implemented

CEP (zipcode)

  • V1 -> Implemented
  • V2 -> Implemented

CNPJ

TODO

DDD

Implemented

National Holidays - (Brasil)

Implemented

FIPE

TODO

IBGE

TODO

Dependencies

~16–26MB
~405K SLoC