Skip to main content

Crate rust_ynab

Crate rust_ynab 

Source
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).
CategoryGroup
A group of budget categories.
Client
Client is the YNAB API client. Use Client::new() to create one.
CurrencyFormat
DateFormat
ExistingTransaction
Request body for updating an existing transaction (PUT single).
GetHybridTransactionsBuilder
HybridTransaction
MoneyMovement
A movement of money between categories. Amounts are in milliunits (divide by 1000 for display).
MoneyMovementGroup
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.
PayeeLocation
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.
PlanDetails
A single plan with all related entities. This resource is effectively a full plan export.
PlanSettings
Date and currency format settings for a plan.
PostPayee
Request body for creating a new payee. Name is required and must not exceed 500 characters.
SaveAccount
The account to create.
SaveCategory
The category to update. Only specified (non-None) fields will be changed.
SaveCategoryGroup
The category group to create or update.
SaveMonthCategory
The month category to update. Only budgeted (assigned) can be changed.
SavePayee
Request body for updating an existing payee. All fields are optional; omitted fields are not changed.
SaveScheduledTransaction
Request body for creating or updating a scheduled transaction.
SaveSubTransaction
A subtransaction within a split transaction to be created or updated.
SaveTransactionResponse
Response from creating or single updating transactions.
SaveTransactionWithIdOrImportId
Request body for a single transaction within a batch update (PATCH). Either id or import_id must be specified to identify the transaction.
SaveTransactionsResponse
Response from creating or batch-updating transactions.
ScheduledSubtransaction
A line item within a split scheduled transaction. Amounts are in milliunits (divide by 1000 for display).
ScheduledTransaction
A scheduled transaction returned by dedicated scheduled transaction endpoints. Includes named fields (account_name, payee_name, category_name) and subtransactions not present in the plan export. For the plan export variant, see ScheduledTransactionSummary. Amounts are in milliunits (divide by 1000 for display).
ScheduledTransactionSummary
A scheduled transaction as returned in the plan export (PlanDetails.scheduled_transactions). A reduced form of ScheduledTransaction — no account_name, payee_name, category_name, or subtransactions. Amounts are in milliunits (divide by 1000 for display).
ServerKnowledge
An opaque, monotonically increasing sync cursor returned alongside most list/write responses. Store it and pass it back into .with_server_knowledge() on a later call to receive only the changes since that point (a delta request).
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) and subtransactions not present in the plan export. For the plan export variant, see TransactionSummary. Amounts are in milliunits (divide by 1000 for display).
TransactionSummary
A transaction as returned in the plan export (PlanDetails.transactions). A reduced form of Transaction — no account_name, payee_name, category_name, or subtransactions. Amounts are in milliunits (divide by 1000 for display).
User
The authenticated YNAB user.

Enums§

AccountType
The type of account.
ClearedStatus
The cleared status of a transaction.
Error
FlagColor
The color of a transaction flag.
Frequency
The recurrence frequency of a scheduled transaction.
GoalType
The type of savings or spending goal assigned to a category.
HybridTransactionType
PlanId
Identifies a plan for use in API requests.
SaveAccountType
The type of account usable to create a new account.
TransactionType
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.