ynab_api_async_fork/models/
hybrid_transaction_all_of.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 HybridTransactionAllOf {
16    /// Whether the hybrid transaction represents a regular transaction or a subtransaction
17    #[serde(rename = "type")]
18    pub _type: Type,
19    /// For subtransaction types, this is the id of the parent transaction.  For transaction types, this id will be always be null.
20    #[serde(rename = "parent_transaction_id", skip_serializing_if = "Option::is_none")]
21    pub parent_transaction_id: Option<String>,
22    #[serde(rename = "account_name")]
23    pub account_name: String,
24    #[serde(rename = "payee_name", skip_serializing_if = "Option::is_none")]
25    pub payee_name: Option<String>,
26    /// The name of the category.  If a split transaction, this will be 'Split'.
27    #[serde(rename = "category_name", skip_serializing_if = "Option::is_none")]
28    pub category_name: Option<String>,
29}
30
31impl HybridTransactionAllOf {
32    pub fn new(_type: Type, account_name: String) -> HybridTransactionAllOf {
33        HybridTransactionAllOf {
34            _type,
35            parent_transaction_id: None,
36            account_name,
37            payee_name: None,
38            category_name: None,
39        }
40    }
41}
42
43/// Whether the hybrid transaction represents a regular transaction or a subtransaction
44#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
45pub enum Type {
46    #[serde(rename = "transaction")]
47    Transaction,
48    #[serde(rename = "subtransaction")]
49    Subtransaction,
50}
51