Skip to main content

asana/model/
time_period_compact.rs

1use serde::{Serialize, Deserialize};
2use super::AsanaResource;
3#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4pub struct TimePeriodCompact {
5    ///A generic Asana Resource, containing a globally unique identifier.
6    #[serde(flatten)]
7    pub asana_resource: AsanaResource,
8    ///A string representing the cadence code and the fiscal year.
9    #[serde(skip_serializing_if = "Option::is_none")]
10    pub display_name: Option<String>,
11    ///The localized end date of the time period in `YYYY-MM-DD` format.
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub end_on: Option<String>,
14    ///The cadence and index of the time period. The value is one of: `FY`, `H1`, `H2`, `Q1`, `Q2`, `Q3`, or `Q4`.
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub period: Option<String>,
17    ///The localized start date of the time period in `YYYY-MM-DD` format.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub start_on: Option<String>,
20}
21impl std::fmt::Display for TimePeriodCompact {
22    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
23        write!(f, "{}", serde_json::to_string(self).unwrap())
24    }
25}
26impl std::ops::Deref for TimePeriodCompact {
27    type Target = AsanaResource;
28    fn deref(&self) -> &Self::Target {
29        &self.asana_resource
30    }
31}
32impl std::ops::DerefMut for TimePeriodCompact {
33    fn deref_mut(&mut self) -> &mut Self::Target {
34        &mut self.asana_resource
35    }
36}