1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
 * 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 CustomFieldRequest {
    /// 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>,
    /// The name of the custom field.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// The type of the custom field. Must be one of the given values.
    #[serde(rename = "resource_subtype", skip_serializing_if = "Option::is_none")]
    pub resource_subtype: Option<ResourceSubtype>,
    /// *Deprecated: new integrations should prefer the resource_subtype field.* The type of the custom field. Must be one of the given values.
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub _type: Option<Type>,
    /// *Conditional*. Only relevant for custom fields of type `enum`. This array specifies the possible values which an `enum` custom field can adopt. To modify the enum options, refer to [working with enum options](/docs/create-an-enum-option).
    #[serde(rename = "enum_options", skip_serializing_if = "Option::is_none")]
    pub enum_options: Option<Vec<crate::models::EnumOption>>,
    /// *Conditional*. Determines if the custom field is enabled or not.
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    /// *Conditional*. This number is the value of a number custom field.
    #[serde(rename = "number_value", skip_serializing_if = "Option::is_none")]
    pub number_value: Option<f32>,
    /// *Conditional*. This string is the value of a text custom field.
    #[serde(rename = "text_value", skip_serializing_if = "Option::is_none")]
    pub text_value: Option<String>,
    /// A string representation for the value of the custom field. Integrations that don't require the underlying type should use this field to read values. Using this field will future-proof an app against new custom field types.
    #[serde(rename = "display_value", skip_serializing_if = "Option::is_none")]
    pub display_value: Option<String>,
    /// [Opt In](/docs/input-output-options). The description of the custom field.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Only relevant for custom fields of type ‘Number’. This field dictates the number of places after the decimal to round to, i.e. 0 is integer values, 1 rounds to the nearest tenth, and so on. Must be between 0 and 6, inclusive. For percentage format, this may be unintuitive, as a value of 0.25 has a precision of 0, while a value of 0.251 has a precision of 1. This is due to 0.25 being displayed as 25%. The identifier format will always have a precision of 0.
    #[serde(rename = "precision", skip_serializing_if = "Option::is_none")]
    pub precision: Option<i32>,
    /// The format of this custom field.
    #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
    pub format: Option<Format>,
    /// ISO 4217 currency code to format this custom field. This will be null if the `format` is not `currency`.
    #[serde(rename = "currency_code", skip_serializing_if = "Option::is_none")]
    pub currency_code: Option<String>,
    /// This is the string that appears next to the custom field value. This will be null if the `format` is not `custom`.
    #[serde(rename = "custom_label", skip_serializing_if = "Option::is_none")]
    pub custom_label: Option<String>,
    /// Only relevant for custom fields with `custom` format. This depicts where to place the custom label. This will be null if the `format` is not `custom`.
    #[serde(rename = "custom_label_position", skip_serializing_if = "Option::is_none")]
    pub custom_label_position: Option<CustomLabelPosition>,
    /// This flag describes whether this custom field is available to every container in the workspace. Before project-specific custom fields, this field was always true.
    #[serde(rename = "is_global_to_workspace", skip_serializing_if = "Option::is_none")]
    pub is_global_to_workspace: Option<bool>,
    /// *Conditional*. This flag describes whether a follower of a task with this field should receive inbox notifications from changes to this field.
    #[serde(rename = "has_notifications_enabled", skip_serializing_if = "Option::is_none")]
    pub has_notifications_enabled: Option<bool>,
    /// *Create-Only* The workspace to create a custom field in.
    #[serde(rename = "workspace")]
    pub workspace: String,
}

impl CustomFieldRequest {
    pub fn new(workspace: String) -> CustomFieldRequest {
        CustomFieldRequest {
            gid: None,
            resource_type: None,
            name: None,
            resource_subtype: None,
            _type: None,
            enum_options: None,
            enabled: None,
            number_value: None,
            text_value: None,
            display_value: None,
            description: None,
            precision: None,
            format: None,
            currency_code: None,
            custom_label: None,
            custom_label_position: None,
            is_global_to_workspace: None,
            has_notifications_enabled: None,
            workspace,
        }
    }
}

/// The type of the custom field. Must be one of the given values.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ResourceSubtype {
    #[serde(rename = "text")]
    Text,
    #[serde(rename = "enum")]
    _Enum,
    #[serde(rename = "number")]
    Number,
}
/// *Deprecated: new integrations should prefer the resource_subtype field.* The type of the custom field. Must be one of the given values.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "text")]
    Text,
    #[serde(rename = "enum")]
    _Enum,
    #[serde(rename = "number")]
    Number,
}
/// The format of this custom field.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Format {
    #[serde(rename = "currency")]
    Currency,
    #[serde(rename = "identifier")]
    Identifier,
    #[serde(rename = "percentage")]
    Percentage,
    #[serde(rename = "custom")]
    Custom,
    #[serde(rename = "none")]
    None,
}
/// Only relevant for custom fields with `custom` format. This depicts where to place the custom label. This will be null if the `format` is not `custom`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CustomLabelPosition {
    #[serde(rename = "prefix")]
    Prefix,
    #[serde(rename = "suffix")]
    Suffix,
}