//! Print API key usage stats.
//!
//! Run with: `RANDOM_ORG_API_KEY=... cargo run --example usage`

use randomorg_rpc::Client;

#[tokio::main]
async fn main() -> Result<(), randomorg_rpc::Error> {
    let key = std::env::var("RANDOM_ORG_API_KEY").expect("RANDOM_ORG_API_KEY missing");
    let client = Client::new(key);

    let u = client.get_usage().await?;
    println!("status:         {}", u.status);
    println!("created:        {}", u.creation_time);
    println!("bits left:      {}", u.bits_left);
    println!("requests left:  {}", u.requests_left);
    println!("total bits:     {}", u.total_bits);
    println!("total requests: {}", u.total_requests);
    Ok(())
}
