aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/sub_transaction.rs
blob: 639d5e7ad094ca2bfb27001d27f3174cf335e195 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * YNAB API Endpoints
 *
 * 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.youneedabudget.com
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */



#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct SubTransaction {
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "transaction_id")]
    pub transaction_id: String,
    /// The subtransaction amount in milliunits format
    #[serde(rename = "amount")]
    pub amount: i64,
    #[serde(rename = "memo", skip_serializing_if = "Option::is_none")]
    pub memo: Option<String>,
    #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")]
    pub payee_id: Option<String>,
    #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
    pub category_id: Option<String>,
    /// If a transfer, the account_id which the subtransaction transfers to
    #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
    pub transfer_account_id: Option<String>,
    /// Whether or not the subtransaction has been deleted.  Deleted subtransactions will only be included in delta requests.
    #[serde(rename = "deleted")]
    pub deleted: bool,
}

impl SubTransaction {
    pub fn new(id: String, transaction_id: String, amount: i64, deleted: bool) -> SubTransaction {
        SubTransaction {
            id: id,
            transaction_id: transaction_id,
            amount: amount,
            memo: None,
            payee_id: None,
            category_id: None,
            transfer_account_id: None,
            deleted: deleted,
        }
    }
}