Skip to main content

asana/model/
story_base.rs

1use serde::{Serialize, Deserialize};
2use super::AsanaResource;
3#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4pub struct StoryBase {
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    ///[Opt In](/docs/inputoutput-options). HTML formatted text for a comment. This will not include the name of the creator.
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub html_text: Option<String>,
14    ///*Conditional*. Whether the story should be pinned on the resource.
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub is_pinned: Option<bool>,
17    ///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.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub resource_subtype: Option<String>,
20    ///The name of the sticker in this story. `null` if there is no sticker.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub sticker_name: Option<String>,
23    ///The plain text of the comment to add. Cannot be used with html_text.
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub text: Option<String>,
26}
27impl std::fmt::Display for StoryBase {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
29        write!(f, "{}", serde_json::to_string(self).unwrap())
30    }
31}
32impl std::ops::Deref for StoryBase {
33    type Target = AsanaResource;
34    fn deref(&self) -> &Self::Target {
35        &self.asana_resource
36    }
37}
38impl std::ops::DerefMut for StoryBase {
39    fn deref_mut(&mut self) -> &mut Self::Target {
40        &mut self.asana_resource
41    }
42}