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
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
 * Firefly III API
 *
 * This is the official documentation of the Firefly III API. You can find accompanying documentation on the website of Firefly III itself (see below). Please report any bugs or issues. This version of the API is live from version v4.7.9 and onwards. You may use the \"Authorize\" button to try the API below. 
 *
 * The version of the OpenAPI document: 0.10.4
 * Contact: thegrumpydictator@gmail.com
 * Generated by: https://openapi-generator.tech
 */


use serde::{Deserialize, Serialize};



#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct RecurrenceTransaction {
    #[serde(rename = "description")]
    pub description: String,
    /// Amount of the transaction.
    #[serde(rename = "amount")]
    pub amount: f64,
    /// Foreign amount of the transaction.
    #[serde(rename = "foreign_amount", skip_serializing_if = "Option::is_none")]
    pub foreign_amount: Option<f64>,
    /// Submit either a currency_id or a currency_code.
    #[serde(rename = "currency_id", skip_serializing_if = "Option::is_none")]
    pub currency_id: Option<i32>,
    /// Submit either a currency_id or a currency_code.
    #[serde(rename = "currency_code", skip_serializing_if = "Option::is_none")]
    pub currency_code: Option<String>,
    #[serde(rename = "currency_symbol", skip_serializing_if = "Option::is_none")]
    pub currency_symbol: Option<String>,
    /// Number of decimals in the currency
    #[serde(rename = "currency_decimal_places", skip_serializing_if = "Option::is_none")]
    pub currency_decimal_places: Option<i32>,
    /// Submit either a foreign_currency_id or a foreign_currency_code, or neither.
    #[serde(rename = "foreign_currency_id", skip_serializing_if = "Option::is_none")]
    pub foreign_currency_id: Option<i32>,
    /// Submit either a foreign_currency_id or a foreign_currency_code, or neither.
    #[serde(rename = "foreign_currency_code", skip_serializing_if = "Option::is_none")]
    pub foreign_currency_code: Option<String>,
    #[serde(rename = "foreign_currency_symbol", skip_serializing_if = "Option::is_none")]
    pub foreign_currency_symbol: Option<String>,
    /// Number of decimals in the currency
    #[serde(rename = "foreign_currency_decimal_places", skip_serializing_if = "Option::is_none")]
    pub foreign_currency_decimal_places: Option<i32>,
    /// The budget ID for this transaction.
    #[serde(rename = "budget_id", skip_serializing_if = "Option::is_none")]
    pub budget_id: Option<i32>,
    /// The name of the budget to be used. If the budget name is unknown, the ID will be used or the value will be ignored.
    #[serde(rename = "budget_name", skip_serializing_if = "Option::is_none")]
    pub budget_name: Option<String>,
    /// Category ID for this transaction.
    #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
    pub category_id: Option<i32>,
    /// Category name for this transaction.
    #[serde(rename = "category_name", skip_serializing_if = "Option::is_none")]
    pub category_name: Option<String>,
    /// ID of the source account. Submit either this or source_name.
    #[serde(rename = "source_id", skip_serializing_if = "Option::is_none")]
    pub source_id: Option<i32>,
    /// Name of the source account. Submit either this or source_id.
    #[serde(rename = "source_name", skip_serializing_if = "Option::is_none")]
    pub source_name: Option<String>,
    #[serde(rename = "source_iban", skip_serializing_if = "Option::is_none")]
    pub source_iban: Option<String>,
    #[serde(rename = "source_type", skip_serializing_if = "Option::is_none")]
    pub source_type: Option<crate::models::AccountTypeProperty>,
    /// ID of the destination account. Submit either this or destination_name.
    #[serde(rename = "destination_id", skip_serializing_if = "Option::is_none")]
    pub destination_id: Option<i32>,
    /// Name of the destination account. Submit either this or destination_id.
    #[serde(rename = "destination_name", skip_serializing_if = "Option::is_none")]
    pub destination_name: Option<String>,
    #[serde(rename = "destination_iban", skip_serializing_if = "Option::is_none")]
    pub destination_iban: Option<String>,
    #[serde(rename = "destination_type", skip_serializing_if = "Option::is_none")]
    pub destination_type: Option<crate::models::AccountTypeProperty>,
    /// Array of tags.
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<String>>,
    /// Optional. Use either this or the piggy_bank_name
    #[serde(rename = "piggy_bank_id", skip_serializing_if = "Option::is_none")]
    pub piggy_bank_id: Option<i32>,
    /// Optional. Use either this or the piggy_bank_id
    #[serde(rename = "piggy_bank_name", skip_serializing_if = "Option::is_none")]
    pub piggy_bank_name: Option<String>,
}

impl RecurrenceTransaction {
    pub fn new(description: String, amount: f64) -> RecurrenceTransaction {
        RecurrenceTransaction {
            description,
            amount,
            foreign_amount: None,
            currency_id: None,
            currency_code: None,
            currency_symbol: None,
            currency_decimal_places: None,
            foreign_currency_id: None,
            foreign_currency_code: None,
            foreign_currency_symbol: None,
            foreign_currency_decimal_places: None,
            budget_id: None,
            budget_name: None,
            category_id: None,
            category_name: None,
            source_id: None,
            source_name: None,
            source_iban: None,
            source_type: None,
            destination_id: None,
            destination_name: None,
            destination_iban: None,
            destination_type: None,
            tags: None,
            piggy_bank_id: None,
            piggy_bank_name: None,
        }
    }
}