parcelwing 0.1.0

Official Rust SDK for the Parcel Wing API.
Documentation
use parcelwing::{Client, EmailSendRequest};

#[tokio::main]
async fn main() -> Result<(), parcelwing::Error> {
    let api_key = std::env::var("PARCELWING_API_KEY")
        .expect("Set PARCELWING_API_KEY before running this example.");

    let client = match std::env::var("PARCELWING_BASE_URL") {
        Ok(base_url) if !base_url.trim().is_empty() => {
            Client::builder(api_key).base_url(base_url).build()?
        }
        _ => Client::new(api_key)?,
    };

    let emails = client
        .emails()
        .send(
            EmailSendRequest::new("Parcel Wing <hello@yourdomain.com>", "you@example.com")
                .subject("Hello from Parcel Wing and Rust")
                .text("This email was sent from the Parcel Wing Rust SDK.")
                .html("<strong>This email was sent from the Parcel Wing Rust SDK.</strong>"),
        )
        .await?;

    println!("{emails:#?}");

    Ok(())
}