firefly-iii 0.3.0

Rust API client for firefly-iii
Documentation
/*
 * Firefly III API v6.4.14
 *
 * This is the documentation of the Firefly III API. Please report any bugs or issues. You may use the \"Authorize\" button to try the API below. <br><br> Please keep in mind that the demo site does **not** accept requests from `curl`, `colly`, `wget`, etc. You must use a browser or a tool like Insomnia to make your test requests. <br><br> To learn more about the idiosyncrasies of this API, please read about the API in the [Firefly III API documentation](https://docs.firefly-iii.org/references/firefly-iii/api/). <br><br> <small>This file was last generated on 2025-12-26 @ 15:17:41 (Europe/Amsterdam)</small>
 *
 * The version of the OpenAPI document: v6.4.14
 * Contact: james@firefly-iii.org
 * Generated by: https://openapi-generator.tech
 */

#![allow(unused_imports)]

use crate::models::{self, *};
use std::fmt;

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct RecurrenceTransactionUpdate {
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Amount of the transaction.
    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
    pub amount: Option<String>,
    /// Foreign amount of the transaction.
    #[serde(rename = "foreign_amount", skip_serializing_if = "Option::is_none")]
    pub foreign_amount: Option<String>,
    /// Submit either a currency_id or a currency_code.
    #[serde(rename = "currency_id", skip_serializing_if = "Option::is_none")]
    pub currency_id: Option<String>,
    /// Submit either a currency_id or a currency_code.
    #[serde(rename = "currency_code", skip_serializing_if = "Option::is_none")]
    pub currency_code: Option<String>,
    /// 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<String>,
    /// The budget ID for this transaction.
    #[serde(rename = "budget_id", skip_serializing_if = "Option::is_none")]
    pub budget_id: Option<String>,
    /// Category ID for this transaction.
    #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")]
    pub category_id: 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<String>,
    /// 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<String>,
    /// Array of tags.
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<String>>,
    #[serde(rename = "piggy_bank_id", skip_serializing_if = "Option::is_none")]
    pub piggy_bank_id: Option<String>,
    /// Optional.
    #[serde(rename = "bill_id", skip_serializing_if = "Option::is_none")]
    pub bill_id: Option<String>,
}

impl RecurrenceTransactionUpdate {
    pub fn new(id: String) -> RecurrenceTransactionUpdate {
        RecurrenceTransactionUpdate {
            id,
            description: None,
            amount: None,
            foreign_amount: None,
            currency_id: None,
            currency_code: None,
            foreign_currency_id: None,
            budget_id: None,
            category_id: None,
            source_id: None,
            destination_id: None,
            tags: None,
            piggy_bank_id: None,
            bill_id: None,
        }
    }
}

impl fmt::Display for RecurrenceTransactionUpdate {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match serde_json::to_string(self) {
            Ok(json) => write!(f, "{}", json),
            Err(_) => write!(f, "{{{{}}}}"),
        }
    }
}