Skip to main content

asana/model/
goal_response.rs

1use serde::{Serialize, Deserialize};
2use super::{GoalBase, Like, UserCompact};
3#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4pub struct GoalResponse {
5    #[serde(flatten)]
6    pub goal_base: GoalBase,
7    #[serde(skip_serializing_if = "Option::is_none")]
8    pub current_status_update: Option<serde_json::Value>,
9    ///Array of users who are members of this goal.
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub followers: Option<Vec<UserCompact>>,
12    ///Array of likes for users who have liked this goal.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub likes: Option<Vec<Like>>,
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub metric: Option<serde_json::Value>,
17    ///The number of users who have liked this goal.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub num_likes: Option<i64>,
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub owner: Option<serde_json::Value>,
22    /**The current status of this goal. When the goal is open, its status can be `green`, `yellow`, and `red` to reflect "On Track", "At Risk", and "Off Track", respectively. When the goal is closed, the value can be `missed`, `achieved`, `partial`, or `dropped`.
23*Note* you can only write to this property if `metric` is set.*/
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub status: Option<String>,
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub team: Option<serde_json::Value>,
28    #[serde(skip_serializing_if = "Option::is_none")]
29    pub time_period: Option<serde_json::Value>,
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub workspace: Option<serde_json::Value>,
32}
33impl std::fmt::Display for GoalResponse {
34    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
35        write!(f, "{}", serde_json::to_string(self).unwrap())
36    }
37}
38impl std::ops::Deref for GoalResponse {
39    type Target = GoalBase;
40    fn deref(&self) -> &Self::Target {
41        &self.goal_base
42    }
43}
44impl std::ops::DerefMut for GoalResponse {
45    fn deref_mut(&mut self) -> &mut Self::Target {
46        &mut self.goal_base
47    }
48}