Skip to main content

asana/model/
story_compact.rs

1use serde::{Serialize, Deserialize};
2use super::{AsanaResource, UserCompact};
3#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4pub struct StoryCompact {
5    ///A generic Asana Resource, containing a globally unique identifier.
6    #[serde(flatten)]
7    pub asana_resource: AsanaResource,
8    ///The time at which this resource was created.
9    #[serde(skip_serializing_if = "Option::is_none")]
10    pub created_at: Option<chrono::DateTime<chrono::Utc>>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub created_by: Option<UserCompact>,
13    ///The subtype of this resource. Different subtypes retain many of the same fields and behavior, but may render differently in Asana or represent resources with different semantic meaning.
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub resource_subtype: Option<String>,
16    #[doc = "*Create-only*. Human-readable text for the story or comment.\nThis will not include the name of the creator.\n*Note: This is not guaranteed to be stable for a given type of story. For example, text for a reassignment may not always say “assigned to …” as the text for a story can both be edited and change based on the language settings of the user making the request.*\nUse the `resource_subtype` property to discover the action that created the story."]
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub text: Option<String>,
19}
20impl std::fmt::Display for StoryCompact {
21    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
22        write!(f, "{}", serde_json::to_string(self).unwrap())
23    }
24}
25impl std::ops::Deref for StoryCompact {
26    type Target = AsanaResource;
27    fn deref(&self) -> &Self::Target {
28        &self.asana_resource
29    }
30}
31impl std::ops::DerefMut for StoryCompact {
32    fn deref_mut(&mut self) -> &mut Self::Target {
33        &mut self.asana_resource
34    }
35}