asana/model/
project_request.rs

1use serde::{Serialize, Deserialize};
2use super::ProjectBase;
3impl ProjectRequest {
4    pub fn new(name: impl Into<String>) -> Self {
5        use crate::model::ProjectCompact;
6        Self {
7            project_base: ProjectBase {
8                project_compact: ProjectCompact {
9                    name: Some(name.into()),
10                    ..ProjectCompact::default()
11                },
12                ..ProjectBase::default()
13            },
14            ..Self::default()
15        }
16    }
17}
18#[derive(Debug, Clone, Serialize, Deserialize, Default)]
19pub struct ProjectRequest {
20    #[serde(flatten)]
21    pub project_base: ProjectBase,
22    ///An object where each key is the GID of a custom field and its corresponding value is either an enum GID, string, number, or object (depending on the custom field type). See the [custom fields guide](/docs/custom-fields-guide) for details on creating and updating custom field values.
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub custom_fields: Option<serde_json::Value>,
25    ///*Create-only*. Comma separated string of users. Followers are a subset of members who have opted in to receive "tasks added" notifications for a project.
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub followers: Option<String>,
28    ///The current owner of the project, may be null.
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub owner: Option<String>,
31    ///The team that this project is shared with.
32    #[serde(skip_serializing_if = "Option::is_none")]
33    pub team: Option<String>,
34    ///The `gid` of a workspace.
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub workspace: Option<String>,
37}
38impl std::fmt::Display for ProjectRequest {
39    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
40        write!(f, "{}", serde_json::to_string(self).unwrap())
41    }
42}
43impl std::ops::Deref for ProjectRequest {
44    type Target = ProjectBase;
45    fn deref(&self) -> &Self::Target {
46        &self.project_base
47    }
48}
49impl std::ops::DerefMut for ProjectRequest {
50    fn deref_mut(&mut self) -> &mut Self::Target {
51        &mut self.project_base
52    }
53}