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 AutocompletePiggy {
    #[serde(rename = "id")]
    pub id: String,
    /// Name of the piggy bank found by an auto-complete search.
    #[serde(rename = "name")]
    pub name: String,
    /// Currency ID for this piggy bank. This will always be the currency of the piggy bank, never the user's primary currency.
    #[serde(rename = "currency_id", skip_serializing_if = "Option::is_none")]
    pub currency_id: Option<String>,
    /// Currency code for this piggy bank. This will always be the currency of the piggy bank, never the user's primary currency.
    #[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>,
    /// Currency name for the currency used by this piggy bank. This will always be the currency of the piggy bank, never the user's primary currency.
    #[serde(rename = "currency_name", skip_serializing_if = "Option::is_none")]
    pub currency_name: Option<String>,
    /// Number of decimal places for the currency used by this piggy bank. This will always be the currency of the piggy bank, never the user's primary currency.
    #[serde(
        rename = "currency_decimal_places",
        skip_serializing_if = "Option::is_none"
    )]
    pub currency_decimal_places: Option<i32>,
    /// The group ID of the group this object is part of. NULL if no group.
    #[serde(rename = "object_group_id", skip_serializing_if = "Option::is_none")]
    pub object_group_id: Option<String>,
    /// The name of the group. NULL if no group.
    #[serde(rename = "object_group_title", skip_serializing_if = "Option::is_none")]
    pub object_group_title: Option<String>,
}

impl AutocompletePiggy {
    pub fn new(id: String, name: String) -> AutocompletePiggy {
        AutocompletePiggy {
            id,
            name,
            currency_id: None,
            currency_code: None,
            currency_symbol: None,
            currency_name: None,
            currency_decimal_places: None,
            object_group_id: None,
            object_group_title: None,
        }
    }
}

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