ynab_api_async_fork/models/
account.rs

1/*
2 * YNAB API Endpoints
3 *
4 * Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body.  API Documentation is at https://api.ynab.com
5 *
6 * The version of the OpenAPI document: 1.72.1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Account {
16    #[serde(rename = "id")]
17    pub id: String,
18    #[serde(rename = "name")]
19    pub name: String,
20    #[serde(rename = "type")]
21    pub _type: crate::models::AccountType,
22    /// Whether this account is on budget or not
23    #[serde(rename = "on_budget")]
24    pub on_budget: bool,
25    /// Whether this account is closed or not
26    #[serde(rename = "closed")]
27    pub closed: bool,
28    #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
29    pub note: Option<String>,
30    /// The current balance of the account in milliunits format
31    #[serde(rename = "balance")]
32    pub balance: i64,
33    /// The current cleared balance of the account in milliunits format
34    #[serde(rename = "cleared_balance")]
35    pub cleared_balance: i64,
36    /// The current uncleared balance of the account in milliunits format
37    #[serde(rename = "uncleared_balance")]
38    pub uncleared_balance: i64,
39    /// The payee id which should be used when transferring to this account
40    #[serde(rename = "transfer_payee_id")]
41    pub transfer_payee_id: Option<String>,
42    /// Whether or not the account is linked to a financial institution for automatic transaction import.
43    #[serde(rename = "direct_import_linked", skip_serializing_if = "Option::is_none")]
44    pub direct_import_linked: Option<bool>,
45    /// If an account linked to a financial institution (direct_import_linked=true) and the linked connection is not in a healthy state, this will be true.
46    #[serde(rename = "direct_import_in_error", skip_serializing_if = "Option::is_none")]
47    pub direct_import_in_error: Option<bool>,
48    /// A date/time specifying when the account was last reconciled.
49    #[serde(rename = "last_reconciled_at", skip_serializing_if = "Option::is_none")]
50    pub last_reconciled_at: Option<String>,
51    /// The original debt/loan account balance, specified in milliunits format.
52    #[serde(rename = "debt_original_balance", skip_serializing_if = "Option::is_none")]
53    pub debt_original_balance: Option<i64>,
54    #[serde(rename = "debt_interest_rates", skip_serializing_if = "Option::is_none")]
55    pub debt_interest_rates: Option<::std::collections::HashMap<String, i64>>,
56    #[serde(rename = "debt_minimum_payments", skip_serializing_if = "Option::is_none")]
57    pub debt_minimum_payments: Option<::std::collections::HashMap<String, i64>>,
58    #[serde(rename = "debt_escrow_amounts", skip_serializing_if = "Option::is_none")]
59    pub debt_escrow_amounts: Option<::std::collections::HashMap<String, i64>>,
60    /// Whether or not the account has been deleted.  Deleted accounts will only be included in delta requests.
61    #[serde(rename = "deleted")]
62    pub deleted: bool,
63}
64
65impl Account {
66    pub fn new(id: String, name: String, _type: crate::models::AccountType, on_budget: bool, closed: bool, balance: i64, cleared_balance: i64, uncleared_balance: i64, transfer_payee_id: Option<String>, deleted: bool) -> Account {
67        Account {
68            id,
69            name,
70            _type,
71            on_budget,
72            closed,
73            note: None,
74            balance,
75            cleared_balance,
76            uncleared_balance,
77            transfer_payee_id,
78            direct_import_linked: None,
79            direct_import_in_error: None,
80            last_reconciled_at: None,
81            debt_original_balance: None,
82            debt_interest_rates: None,
83            debt_minimum_payments: None,
84            debt_escrow_amounts: None,
85            deleted,
86        }
87    }
88}
89
90