Skip to main content

asana/model/
goal_base.rs

1use serde::{Serialize, Deserialize};
2use super::AsanaResource;
3#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4pub struct GoalBase {
5    ///A generic Asana Resource, containing a globally unique identifier.
6    #[serde(flatten)]
7    pub asana_resource: AsanaResource,
8    ///The localized day on which this goal is due. This takes a date with format `YYYY-MM-DD`.
9    #[serde(skip_serializing_if = "Option::is_none")]
10    pub due_on: Option<String>,
11    ///The notes of the goal with formatting as HTML.
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub html_notes: Option<String>,
14    ///*Conditional*. This property is only present when the `workspace` provided is an organization. Whether the goal belongs to the `workspace` (and is listed as part of the workspace’s goals) or not. If it isn’t a workspace-level goal, it is a team-level goal, and is associated with the goal’s team.
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub is_workspace_level: Option<bool>,
17    ///True if the goal is liked by the authorized user, false if not.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub liked: Option<bool>,
20    ///The name of the goal.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub name: Option<String>,
23    ///Free-form textual information associated with the goal (i.e. its description).
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub notes: Option<String>,
26    ///The day on which work for this goal begins, or null if the goal has no start date. This takes a date with `YYYY-MM-DD` format, and cannot be set unless there is an accompanying due date.
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub start_on: Option<String>,
29}
30impl std::fmt::Display for GoalBase {
31    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
32        write!(f, "{}", serde_json::to_string(self).unwrap())
33    }
34}
35impl std::ops::Deref for GoalBase {
36    type Target = AsanaResource;
37    fn deref(&self) -> &Self::Target {
38        &self.asana_resource
39    }
40}
41impl std::ops::DerefMut for GoalBase {
42    fn deref_mut(&mut self) -> &mut Self::Target {
43        &mut self.asana_resource
44    }
45}