asana/models/custom_field_base_all_of.rs
1/*
2 * Asana
3 *
4 * 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).
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12pub struct CustomFieldBaseAllOf {
13 /// [Opt In](/docs/input-output-options). The description of the custom field.
14 #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
15 pub description: Option<String>,
16 /// *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).
17 #[serde(rename = "enum_options", skip_serializing_if = "Option::is_none")]
18 pub enum_options: Option<Vec<crate::models::EnumOption>>,
19 /// 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.
20 #[serde(rename = "precision", skip_serializing_if = "Option::is_none")]
21 pub precision: Option<i32>,
22 /// The format of this custom field.
23 #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
24 pub format: Option<Format>,
25 /// ISO 4217 currency code to format this custom field. This will be null if the `format` is not `currency`.
26 #[serde(rename = "currency_code", skip_serializing_if = "Option::is_none")]
27 pub currency_code: Option<String>,
28 /// This is the string that appears next to the custom field value. This will be null if the `format` is not `custom`.
29 #[serde(rename = "custom_label", skip_serializing_if = "Option::is_none")]
30 pub custom_label: Option<String>,
31 /// 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`.
32 #[serde(
33 rename = "custom_label_position",
34 skip_serializing_if = "Option::is_none"
35 )]
36 pub custom_label_position: Option<CustomLabelPosition>,
37 /// 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.
38 #[serde(
39 rename = "is_global_to_workspace",
40 skip_serializing_if = "Option::is_none"
41 )]
42 pub is_global_to_workspace: Option<bool>,
43 /// *Conditional*. This flag describes whether a follower of a task with this field should receive inbox notifications from changes to this field.
44 #[serde(
45 rename = "has_notifications_enabled",
46 skip_serializing_if = "Option::is_none"
47 )]
48 pub has_notifications_enabled: Option<bool>,
49}
50
51impl CustomFieldBaseAllOf {
52 pub fn new() -> CustomFieldBaseAllOf {
53 CustomFieldBaseAllOf {
54 description: None,
55 enum_options: None,
56 precision: None,
57 format: None,
58 currency_code: None,
59 custom_label: None,
60 custom_label_position: None,
61 is_global_to_workspace: None,
62 has_notifications_enabled: None,
63 }
64 }
65}
66
67/// The format of this custom field.
68#[derive(
69 Clone,
70 Copy,
71 Debug,
72 Eq,
73 PartialEq,
74 Ord,
75 PartialOrd,
76 Hash,
77 Serialize,
78 Deserialize
79)]
80pub enum Format {
81 #[serde(rename = "currency")]
82 Currency,
83 #[serde(rename = "identifier")]
84 Identifier,
85 #[serde(rename = "percentage")]
86 Percentage,
87 #[serde(rename = "custom")]
88 Custom,
89 #[serde(rename = "none")]
90 None,
91}
92/// 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`.
93#[derive(
94 Clone,
95 Copy,
96 Debug,
97 Eq,
98 PartialEq,
99 Ord,
100 PartialOrd,
101 Hash,
102 Serialize,
103 Deserialize
104)]
105pub enum CustomLabelPosition {
106 #[serde(rename = "prefix")]
107 Prefix,
108 #[serde(rename = "suffix")]
109 Suffix,
110}