aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/scheduled_sub_transaction.rs
blob: dfc0aca9cc4eca86f1dac78f244345c17c604ccb (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
52
53
54
/*
 * 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
 */


#[allow(unused_imports)]
use serde_json::Value;


#[derive(Debug, Serialize, Deserialize)]
pub struct ScheduledSubTransaction {
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "scheduled_transaction_id")]
    pub scheduled_transaction_id: String,
    /// The scheduled 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")]
    pub category_id: String,
    /// If a transfer, the account_id which the scheduled subtransaction transfers to
    #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")]
    pub transfer_account_id: Option<String>,
    /// Whether or not the scheduled subtransaction has been deleted.  Deleted scheduled subtransactions will only be included in delta requests.
    #[serde(rename = "deleted")]
    pub deleted: bool,
}

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