Expand description
A Rust client for the YNAB API.
§Quick Start
use rust_ynab::{Client, PlanId};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new(&std::env::var("YNAB_TOKEN")?)?;
let plans = client.get_plans().include_accounts().send().await?;
for plan in plans {
println!("{}", plan.name);
}
Ok(())
}Structs§
- Account
- A plan account. Amounts are in milliunits (divide by 1000 for display).
- ApiError
- Category
- A budget category. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC) and are in milliunits (divide by 1000 for display).
- Category
Group - A group of budget categories.
- Client
- Client is the YNAB API client. Use Client::new() to create one.
- Currency
Format - Date
Format - Existing
Transaction - Request body for updating an existing transaction (PUT single).
- GetHybrid
Transactions Builder - Hybrid
Transaction - Money
Movement - A movement of money between categories. Amounts are in milliunits (divide by 1000 for display).
- Money
Movement Group - A group of related money movements.
- Month
- A plan month. This is where Ready to Assign, Age of Money, and category amounts (assigned, activity, available) are available. Amounts are in milliunits (divide by 1000 for display).
- NewCategory
- The category to create.
- NewTransaction
- Request body for creating a new transaction.
- Payee
- A payee for a plan.
- Payee
Location - A GPS location stored when a transaction is entered on a mobile device. Locations will not be available for all payees.
- Plan
- Summary information for a plan.
- Plan
Details - A single plan with all related entities. This resource is effectively a full plan export.
- Plan
Settings - Date and currency format settings for a plan.
- Post
Payee - Request body for creating a new payee. Name is required and must not exceed 500 characters.
- Save
Account - The account to create.
- Save
Category - The category to update. Only specified (non-
None) fields will be changed. - Save
Category Group - The category group to create or update.
- Save
Month Category - The month category to update. Only
budgeted(assigned) can be changed. - Save
Payee - Request body for updating an existing payee. All fields are optional; omitted fields are not changed.
- Save
Scheduled Transaction - Request body for creating or updating a scheduled transaction.
- Save
SubTransaction - A subtransaction within a split transaction to be created or updated.
- Save
Transaction Response - Response from creating or single updating transactions.
- Save
Transaction With IdOr Import Id - Request body for a single transaction within a batch update (PATCH).
Either
idorimport_idmust be specified to identify the transaction. - Save
Transactions Response - Response from creating or batch-updating transactions.
- Scheduled
Subtransaction - A line item within a split scheduled transaction. Amounts are in milliunits (divide by 1000 for display).
- Scheduled
Transaction - A scheduled transaction returned by dedicated scheduled transaction endpoints. Includes named
fields (
account_name,payee_name,category_name) andsubtransactionsnot present in the plan export. For the plan export variant, seeScheduledTransactionSummary. Amounts are in milliunits (divide by 1000 for display). - Scheduled
Transaction Summary - A scheduled transaction as returned in the plan export (
PlanDetails.scheduled_transactions). A reduced form ofScheduledTransaction— noaccount_name,payee_name,category_name, orsubtransactions. Amounts are in milliunits (divide by 1000 for display). - Subtransaction
- A line item within a split transaction. Amounts are in milliunits (divide by 1000 for display).
- Transaction
- A transaction returned by dedicated transaction endpoints (
get_transactions,get_transaction, etc.). Includes named fields (account_name,payee_name,category_name) andsubtransactionsnot present in the plan export. For the plan export variant, seeTransactionSummary. Amounts are in milliunits (divide by 1000 for display). - Transaction
Summary - A transaction as returned in the plan export (
PlanDetails.transactions). A reduced form ofTransaction— noaccount_name,payee_name,category_name, orsubtransactions. Amounts are in milliunits (divide by 1000 for display). - User
- The authenticated YNAB user.
Enums§
- Account
Type - The type of account.
- Cleared
Status - The cleared status of a transaction.
- Error
- Flag
Color - The color of a transaction flag.
- Frequency
- The recurrence frequency of a scheduled transaction.
- Goal
Type - The type of savings or spending goal assigned to a category.
- Hybrid
Transaction Type - PlanId
- Identifies a plan for use in API requests.
- Save
Account Type - The type of account usable to create a new account.
- Transaction
Type - Filter to apply when fetching transactions. Pass to
.transaction_type()on a [GetTransactionsBuilder] to limit results to uncategorized or unapproved transactions.
Functions§
- milliunits_
to_ amount - Converts a YNAB milliunit amount to a dollar amount. For display only. For arithmetic use milliunits.