customer/
customer.rs

1use rust_woocommerce::Customer;
2use rust_woocommerce::{ApiClient, Config};
3use tracing::info;
4
5#[tokio::main]
6async fn main() -> anyhow::Result<()> {
7    tracing_subscriber::fmt::init();
8    let config = Config::new("woo.toml")?;
9    let client = ApiClient::new(&config)?;
10    let customers = client.list_all::<Customer>().await?;
11    info!("Got {} customers", customers.len());
12    let retrieved: Customer = client.retrieve(customers.first().unwrap().id).await?;
13    info!("Retrieved customer name is {}", retrieved.first_name);
14    Ok(())
15}