aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/hybrid_transaction_all_of.rs
blob: 42fd515b510573393d2ab25ddd80e997ec61ac70 (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
/*
 * 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 HybridTransactionAllOf {
    /// Whether the hybrid transaction represents a regular transaction or a subtransaction
    #[serde(rename = "type")]
    pub _type: String,
    /// For subtransaction types, this is the id of the pararent transaction.  For transaction types, this id will be always be null.
    #[serde(rename = "parent_transaction_id", skip_serializing_if = "Option::is_none")]
    pub parent_transaction_id: Option<String>,
    #[serde(rename = "account_name")]
    pub account_name: String,
    #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
    pub payee_name: Option<String>,
    #[serde(rename = "category_name")]
    pub category_name: String,
}

impl HybridTransactionAllOf {
    pub fn new(_type: String, account_name: String, category_name: String) -> HybridTransactionAllOf {
        HybridTransactionAllOf {
            _type: _type,
            parent_transaction_id: None,
            account_name: account_name,
            payee_name: None,
            category_name: category_name,
        }
    }
}

/// Whether the hybrid transaction represents a regular transaction or a subtransaction
#[derive(Debug, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "transaction")]
    Transaction,
    #[serde(rename = "subtransaction")]
    Subtransaction,
}