Skip to main content

Crate unirate_api

Crate unirate_api 

Source
Expand description

§UniRate API — Rust client

Official Rust client for the UniRate API — free, real-time and historical currency exchange rates plus VAT rates.

§Quick start

use unirate_api::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new("your-api-key");

    let rate = client.get_rate("USD", "EUR").await?;
    println!("USD → EUR: {}", rate);

    let converted = client.convert(100.0, "USD", "EUR").await?;
    println!("100 USD = {} EUR", converted);

    Ok(())
}

Get a free API key at https://unirateapi.com.

Re-exports§

pub use client::Client;
pub use client::ClientBuilder;
pub use error::UniRateError;
pub use models::HistoricalLimit;
pub use models::HistoricalLimitsResponse;
pub use models::VatRate;
pub use models::VatRateResponse;
pub use models::VatRatesResponse;

Modules§

client
HTTP client and builder.
endpoints
Endpoint implementations for Client.
error
Error types for the UniRate client.
models
Response models for the UniRate API.

Constants§

DEFAULT_BASE_URL
Default UniRate API base URL.
VERSION
Crate version, exposed as the User-Agent suffix.