/*
* 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 RecurrenceTransactionStore {
#[serde(rename = "description")]
pub description: String,
/// Amount of the transaction.
#[serde(rename = "amount")]
pub amount: 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>,
/// 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>,
/// 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.
#[serde(rename = "source_id")]
pub source_id: String,
/// ID of the destination account.
#[serde(rename = "destination_id")]
pub destination_id: String,
/// Array of tags.
#[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<String>>,
/// Optional.
#[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 RecurrenceTransactionStore {
pub fn new(
description: String,
amount: String,
source_id: String,
destination_id: String,
) -> RecurrenceTransactionStore {
RecurrenceTransactionStore {
description,
amount,
foreign_amount: None,
currency_id: None,
currency_code: None,
foreign_currency_id: None,
foreign_currency_code: None,
budget_id: None,
category_id: None,
source_id,
destination_id,
tags: None,
piggy_bank_id: None,
bill_id: None,
}
}
}
impl fmt::Display for RecurrenceTransactionStore {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match serde_json::to_string(self) {
Ok(json) => write!(f, "{}", json),
Err(_) => write!(f, "{{{{}}}}"),
}
}
}