legiscan

Crates.iolegiscan
lib.rslegiscan
version0.1.4
sourcesrc
created_at2021-12-23 06:14:36.277604
updated_at2023-09-26 08:12:21.94097
descriptionA client wrapper for the Legiscan REST API
homepagehttps://github.com/populist-vote/legiscan
repositoryhttps://github.com/populist-vote/legiscan
max_upload_size
id502073
size42,468
Wiley McKay Conte (wileybaba)

documentation

https://docs.rs/legiscan

README

Legiscan

A strongly typed client for the Legiscan REST API

Docs

https://docs.rs/legiscan/latest/legiscan/

Quick Start

To get started, you'll need to instantiate a LegiscanProxy in your program. You have two options:

use legiscan::LegiscanProxy
// If you have a `LEGISCAN_API_KEY` set in your .env or environment
let proxy = LegiscanProxy::new().unwrap();
// If you want to pass in the API key from elsewhere
let proxy = LegiscanProxy::new_from_key(your_api_key);

Once you've got your proxy instantiated, you can query Legiscan's API with ease. All responses are strongly typed with serde and serde_json so you will have easy access to all nested fields in a Legiscan response. Here's a quick example:

let bill_id = 1167968 // From the Legiscan docs
let bill = proxy.get_bill(bill_id).await.unwrap();
println!("{}", bill.state) // "MD"
println!("{}", bill.bill_number) // "SB181"
Commit count: 17

cargo fmt