asana 0.1.1

asana bindings for rust
Documentation
/*
 * Asana
 *
 * This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/developer-docs/master/defs/asana_oas.yaml).
 *
 * The version of the OpenAPI document: 1.0
 *
 * Generated by: https://openapi-generator.tech
 */

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct TaskResponse {
    /// Globally unique identifier of the resource, as a string.
    #[serde(rename = "gid", skip_serializing_if = "Option::is_none")]
    pub gid: Option<String>,
    /// The base type of this resource.
    #[serde(rename = "resource_type", skip_serializing_if = "Option::is_none")]
    pub resource_type: Option<String>,
    /// Name of the task. This is generally a short sentence fragment that fits on a line in the UI for maximum readability. However, it can be longer.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// *Conditional* Reflects the approval status of this task. This field is kept in sync with `completed`, meaning `pending` translates to false while `approved`, `rejected`, and `changes_requested` translate to true. If you set completed to true, this field will be set to `approved`.
    #[serde(
        rename = "approval_status",
        skip_serializing_if = "Option::is_none"
    )]
    pub approval_status: Option<ApprovalStatus>,
    /// True if the task is currently marked complete, false if not.
    #[serde(rename = "completed", skip_serializing_if = "Option::is_none")]
    pub completed: Option<bool>,
    /// The time at which this task was completed, or null if the task is incomplete.
    #[serde(rename = "completed_at", skip_serializing_if = "Option::is_none")]
    pub completed_at: Option<String>,
    #[serde(rename = "completed_by", skip_serializing_if = "Option::is_none")]
    pub completed_by: Option<Box<crate::models::UserCompact>>,
    /// The time at which this resource was created.
    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
    /// [Opt In](/docs/input-output-options). Array of resources referencing tasks that this task depends on. The objects contain only the gid of the dependency.
    #[serde(rename = "dependencies", skip_serializing_if = "Option::is_none")]
    pub dependencies: Option<Vec<crate::models::AsanaResource>>,
    /// [Opt In](/docs/input-output-options). Array of resources referencing tasks that depend on this task. The objects contain only the ID of the dependent.
    #[serde(rename = "dependents", skip_serializing_if = "Option::is_none")]
    pub dependents: Option<Vec<crate::models::AsanaResource>>,
    /// The UTC date and time on which this task is due, or null if the task has no due time. This takes an ISO 8601 date string in UTC and should not be used together with `due_on`.
    #[serde(rename = "due_at", skip_serializing_if = "Option::is_none")]
    pub due_at: Option<String>,
    /// The localized date on which this task is due, or null if the task has no due date.  This takes a date with `YYYY-MM-DD` format and should not be used together with due_at.
    #[serde(rename = "due_on", skip_serializing_if = "Option::is_none")]
    pub due_on: Option<String>,
    #[serde(rename = "external", skip_serializing_if = "Option::is_none")]
    pub external: Option<Box<crate::models::TaskBaseAllOfExternal>>,
    /// [Opt In](/docs/input-output-options). The notes of the text with formatting as HTML.
    #[serde(rename = "html_notes", skip_serializing_if = "Option::is_none")]
    pub html_notes: Option<String>,
    /// *Deprecated - please use liked instead* True if the task is hearted by the authorized user, false if not.
    #[serde(rename = "hearted", skip_serializing_if = "Option::is_none")]
    pub hearted: Option<bool>,
    /// *Deprecated - please use likes instead* Array of likes for users who have hearted this task.
    #[serde(rename = "hearts", skip_serializing_if = "Option::is_none")]
    pub hearts: Option<Vec<crate::models::Like>>,
    /// [Opt In](/docs/input-output-options). In some contexts tasks can be rendered as a visual separator; for instance, subtasks can appear similar to [sections](/docs/asana-sections) without being true `section` objects. If a `task` object is rendered this way in any context it will have the property `is_rendered_as_separator` set to `true`.
    #[serde(
        rename = "is_rendered_as_separator",
        skip_serializing_if = "Option::is_none"
    )]
    pub is_rendered_as_separator: Option<bool>,
    /// True if the task is liked by the authorized user, false if not.
    #[serde(rename = "liked", skip_serializing_if = "Option::is_none")]
    pub liked: Option<bool>,
    /// Array of likes for users who have liked this task.
    #[serde(rename = "likes", skip_serializing_if = "Option::is_none")]
    pub likes: Option<Vec<crate::models::Like>>,
    /// *Create-only*. Array of projects this task is associated with and the section it is in. At task creation time, this array can be used to add the task to specific sections. After task creation, these associations can be modified using the `addProject` and `removeProject` endpoints. Note that over time, more types of memberships may be added to this property.
    #[serde(rename = "memberships", skip_serializing_if = "Option::is_none")]
    pub memberships: Option<Vec<crate::models::TaskBaseAllOfMemberships>>,
    /// The time at which this task was last modified.  *Note: This does not currently reflect any changes in associations such as projects or comments that may have been added or removed from the task.*
    #[serde(rename = "modified_at", skip_serializing_if = "Option::is_none")]
    pub modified_at: Option<String>,
    /// More detailed, free-form textual information associated with the task.
    #[serde(rename = "notes", skip_serializing_if = "Option::is_none")]
    pub notes: Option<String>,
    /// *Deprecated - please use likes instead* The number of users who have hearted this task.
    #[serde(rename = "num_hearts", skip_serializing_if = "Option::is_none")]
    pub num_hearts: Option<i32>,
    /// The number of users who have liked this task.
    #[serde(rename = "num_likes", skip_serializing_if = "Option::is_none")]
    pub num_likes: Option<i32>,
    /// [Opt In](/docs/input-output-options). The number of subtasks on this task.
    #[serde(rename = "num_subtasks", skip_serializing_if = "Option::is_none")]
    pub num_subtasks: Option<i32>,
    /// 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. The resource_subtype `milestone` represent a single moment in time. This means tasks with this subtype cannot have a start_date.
    #[serde(
        rename = "resource_subtype",
        skip_serializing_if = "Option::is_none"
    )]
    pub resource_subtype: Option<ResourceSubtype>,
    /// The day on which work begins for the task , or null if the task has no start date. This takes a date with `YYYY-MM-DD` format. *Note: `due_on` or `due_at` must be present in the request when setting or unsetting the `start_on` parameter.*
    #[serde(rename = "start_on", skip_serializing_if = "Option::is_none")]
    pub start_on: Option<String>,
    #[serde(rename = "assignee", skip_serializing_if = "Option::is_none")]
    pub assignee: Option<Box<crate::models::UserCompact>>,
    /// Array of custom field values applied to the task. These represent the custom field values recorded on this project for a particular custom field. For example, these custom field values will contain an `enum_value` property for custom fields of type `enum`, a `text_value` property for custom fields of type `text`, and so on. Please note that the `gid` returned on each custom field value *is identical* to the `gid` of the custom field, which allows referencing the custom field metadata through the `/custom_fields/custom_field-gid` endpoint.
    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
    pub custom_fields: Option<Vec<crate::models::CustomFieldResponse>>,
    /// Array of users following this task.
    #[serde(rename = "followers", skip_serializing_if = "Option::is_none")]
    pub followers: Option<Vec<crate::models::UserCompact>>,
    #[serde(rename = "parent", skip_serializing_if = "Option::is_none")]
    pub parent: Option<Box<crate::models::TaskCompact>>,
    /// *Create-only.* Array of projects this task is associated with. At task creation time, this array can be used to add the task to many projects at once. After task creation, these associations can be modified using the addProject and removeProject endpoints.
    #[serde(rename = "projects", skip_serializing_if = "Option::is_none")]
    pub projects: Option<Vec<crate::models::ProjectCompact>>,
    /// Array of tags associated with this task. In order to change tags on an existing task use `addTag` and `removeTag`.
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<crate::models::TagCompact>>,
    #[serde(rename = "workspace", skip_serializing_if = "Option::is_none")]
    pub workspace: Option<Box<crate::models::WorkspaceCompact>>,
    /// A url that points directly to the object within Asana.
    #[serde(rename = "permalink_url", skip_serializing_if = "Option::is_none")]
    pub permalink_url: Option<String>,
}

impl TaskResponse {
    pub fn new() -> TaskResponse {
        TaskResponse {
            gid: None,
            resource_type: None,
            name: None,
            approval_status: None,
            completed: None,
            completed_at: None,
            completed_by: None,
            created_at: None,
            dependencies: None,
            dependents: None,
            due_at: None,
            due_on: None,
            external: None,
            html_notes: None,
            hearted: None,
            hearts: None,
            is_rendered_as_separator: None,
            liked: None,
            likes: None,
            memberships: None,
            modified_at: None,
            notes: None,
            num_hearts: None,
            num_likes: None,
            num_subtasks: None,
            resource_subtype: None,
            start_on: None,
            assignee: None,
            custom_fields: None,
            followers: None,
            parent: None,
            projects: None,
            tags: None,
            workspace: None,
            permalink_url: None,
        }
    }
}

/// *Conditional* Reflects the approval status of this task. This field is kept in sync with `completed`, meaning `pending` translates to false while `approved`, `rejected`, and `changes_requested` translate to true. If you set completed to true, this field will be set to `approved`.
#[derive(
    Clone,
    Copy,
    Debug,
    Eq,
    PartialEq,
    Ord,
    PartialOrd,
    Hash,
    Serialize,
    Deserialize
)]
pub enum ApprovalStatus {
    #[serde(rename = "pending")]
    Pending,
    #[serde(rename = "approved")]
    Approved,
    #[serde(rename = "rejected")]
    Rejected,
    #[serde(rename = "changes_requested")]
    ChangesRequested,
}
/// 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. The resource_subtype `milestone` represent a single moment in time. This means tasks with this subtype cannot have a start_date.
#[derive(
    Clone,
    Copy,
    Debug,
    Eq,
    PartialEq,
    Ord,
    PartialOrd,
    Hash,
    Serialize,
    Deserialize
)]
pub enum ResourceSubtype {
    #[serde(rename = "default_task")]
    DefaultTask,
    #[serde(rename = "milestone")]
    Milestone,
    #[serde(rename = "section")]
    Section,
    #[serde(rename = "approval")]
    Approval,
}