ynab_api_async_fork/models/
sub_transaction.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 SubTransaction {
16    #[serde(rename = "id")]
17    pub id: String,
18    #[serde(rename = "transaction_id")]
19    pub transaction_id: String,
20    /// The subtransaction amount in milliunits format
21    #[serde(rename = "amount")]
22    pub amount: i64,
23    #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
24    pub memo: Option<String>,
25    #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
26    pub payee_id: Option<String>,
27    #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
28    pub payee_name: Option<String>,
29    #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
30    pub category_id: Option<String>,
31    #[serde(rename = "category_name", skip_serializing_if = "Option::is_none")]
32    pub category_name: Option<String>,
33    /// If a transfer, the account_id which the subtransaction transfers to
34    #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
35    pub transfer_account_id: Option<String>,
36    /// If a transfer, the id of transaction on the other side of the transfer
37    #[serde(rename = "transfer_transaction_id", skip_serializing_if = "Option::is_none")]
38    pub transfer_transaction_id: Option<String>,
39    /// Whether or not the subtransaction has been deleted.  Deleted subtransactions will only be included in delta requests.
40    #[serde(rename = "deleted")]
41    pub deleted: bool,
42}
43
44impl SubTransaction {
45    pub fn new(id: String, transaction_id: String, amount: i64, deleted: bool) -> SubTransaction {
46        SubTransaction {
47            id,
48            transaction_id,
49            amount,
50            memo: None,
51            payee_id: None,
52            payee_name: None,
53            category_id: None,
54            category_name: None,
55            transfer_account_id: None,
56            transfer_transaction_id: None,
57            deleted,
58        }
59    }
60}
61
62