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 ChartDataSet {
    /// This is the title of the current set. It can refer to an account, a budget or another object (by name).
    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    /// The currency ID of the currency associated with this object.
    #[serde(rename = "currency_id", skip_serializing_if = "Option::is_none")]
    pub currency_id: Option<String>,
    /// The currency name of the currency associated with this object.
    #[serde(rename = "currency_name", skip_serializing_if = "Option::is_none")]
    pub currency_name: Option<String>,
    /// The currency code of the currency associated with this object.
    #[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>,
    #[serde(
        rename = "currency_decimal_places",
        skip_serializing_if = "Option::is_none"
    )]
    pub currency_decimal_places: Option<i32>,
    /// The currency ID of the administration's primary currency.
    #[serde(
        rename = "primary_currency_id",
        skip_serializing_if = "Option::is_none"
    )]
    pub primary_currency_id: Option<String>,
    /// The currency name of the administration's primary currency.
    #[serde(
        rename = "primary_currency_name",
        skip_serializing_if = "Option::is_none"
    )]
    pub primary_currency_name: Option<String>,
    /// The currency code of the administration's primary currency.
    #[serde(
        rename = "primary_currency_code",
        skip_serializing_if = "Option::is_none"
    )]
    pub primary_currency_code: Option<String>,
    /// The currency symbol of the administration's primary currency.
    #[serde(
        rename = "primary_currency_symbol",
        skip_serializing_if = "Option::is_none"
    )]
    pub primary_currency_symbol: Option<String>,
    /// The currency decimal places of the administration's primary currency.
    #[serde(
        rename = "primary_currency_decimal_places",
        skip_serializing_if = "Option::is_none"
    )]
    pub primary_currency_decimal_places: Option<i32>,
    #[serde(rename = "date", skip_serializing_if = "Option::is_none")]
    pub date: Option<String>,
    #[serde(rename = "start_date", skip_serializing_if = "Option::is_none")]
    pub start_date: Option<String>,
    #[serde(rename = "end_date", skip_serializing_if = "Option::is_none")]
    pub end_date: Option<String>,
    /// Indicated the type of chart that is expected to be rendered. You can safely ignore this if you want.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<String>,
    #[serde(rename = "period", skip_serializing_if = "Option::is_none")]
    pub period: Option<models::ChartDatasetPeriodProperty>,
    /// Used to indicate the Y axis for this data set. Is usually between 0 and 1 (left and right side of the chart).
    #[serde(rename = "yAxisID", skip_serializing_if = "Option::is_none")]
    pub y_axis_id: Option<i32>,
    /// The actual entries for this data set. They 'key' value is the label for the data point. The value is the actual (numerical) value.
    #[serde(rename = "entries", skip_serializing_if = "Option::is_none")]
    pub entries: Option<Vec<models::ChartDataPoint>>,
    /// The actual entries for this data set. They 'key' value is the label for the data point. The value is the actual (numerical) value.
    #[serde(rename = "pc_entries", skip_serializing_if = "Option::is_none")]
    pub pc_entries: Option<Vec<models::ChartDataPoint>>,
}

impl ChartDataSet {
    pub fn new() -> ChartDataSet {
        ChartDataSet {
            label: None,
            currency_id: None,
            currency_name: None,
            currency_code: None,
            currency_symbol: None,
            currency_decimal_places: None,
            primary_currency_id: None,
            primary_currency_name: None,
            primary_currency_code: None,
            primary_currency_symbol: None,
            primary_currency_decimal_places: None,
            date: None,
            start_date: None,
            end_date: None,
            r#type: None,
            period: None,
            y_axis_id: None,
            entries: None,
            pc_entries: None,
        }
    }
}

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