rust-ynab 0.4.5

A Rust client for the YNAB API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use rust_ynab::Client;
use rust_ynab::PlanId;
use rust_ynab::print_transaction_table;

/// Fetches all transactions for the test plan and prints them as a table.
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let token = std::env::var("YNAB_TOKEN")?;
    let client = Client::new(&token)?;

    let plan_id_str = std::env::var("YNAB_TEST_PLAN_ID")?;
    let plan_id: uuid::Uuid = plan_id_str.parse()?;

    let (txs, _) = client.get_transactions(PlanId::Id(plan_id)).send().await?;

    print_transaction_table(&txs);
    Ok(())
}