Skip to main content

asana/model/
job_compact.rs

1use serde::{Serialize, Deserialize};
2use super::{AsanaResource, ProjectCompact, ProjectTemplateCompact};
3#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4pub struct JobCompact {
5    ///A generic Asana Resource, containing a globally unique identifier.
6    #[serde(flatten)]
7    pub asana_resource: AsanaResource,
8    #[serde(skip_serializing_if = "Option::is_none")]
9    pub new_project: Option<ProjectCompact>,
10    #[serde(skip_serializing_if = "Option::is_none")]
11    pub new_project_template: Option<ProjectTemplateCompact>,
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub new_task: Option<serde_json::Value>,
14    ///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.
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub resource_subtype: Option<String>,
17    ///The current status of this job. The value is one of: `not_started`, `in_progress`, `succeeded`, or `failed`.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub status: Option<String>,
20}
21impl std::fmt::Display for JobCompact {
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 JobCompact {
27    type Target = AsanaResource;
28    fn deref(&self) -> &Self::Target {
29        &self.asana_resource
30    }
31}
32impl std::ops::DerefMut for JobCompact {
33    fn deref_mut(&mut self) -> &mut Self::Target {
34        &mut self.asana_resource
35    }
36}