netbox_openapi/models/
writable_custom_field_choice_set_request.rs1#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritableCustomFieldChoiceSetRequest {
15 #[serde(rename = "name")]
16 pub name: String,
17 #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
18 pub description: Option<String>,
19 #[serde(
21 rename = "base_choices",
22 default,
23 with = "::serde_with::rust::double_option",
24 skip_serializing_if = "Option::is_none"
25 )]
26 pub base_choices: Option<Option<BaseChoices>>,
27 #[serde(rename = "extra_choices")]
28 pub extra_choices: Vec<Vec<serde_json::Value>>,
29 #[serde(
31 rename = "order_alphabetically",
32 skip_serializing_if = "Option::is_none"
33 )]
34 pub order_alphabetically: Option<bool>,
35}
36
37impl WritableCustomFieldChoiceSetRequest {
38 pub fn new(
40 name: String,
41 extra_choices: Vec<Vec<serde_json::Value>>,
42 ) -> WritableCustomFieldChoiceSetRequest {
43 WritableCustomFieldChoiceSetRequest {
44 name,
45 description: None,
46 base_choices: None,
47 extra_choices,
48 order_alphabetically: None,
49 }
50 }
51}
52
53#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
55pub enum BaseChoices {
56 #[serde(rename = "IATA")]
57 Iata,
58 #[serde(rename = "ISO_3166")]
59 Iso3166,
60 #[serde(rename = "UN_LOCODE")]
61 UnLocode,
62 #[serde(rename = "")]
63 Empty,
64 #[serde(rename = "null")]
65 Null,
66}
67
68impl Default for BaseChoices {
69 fn default() -> BaseChoices {
70 Self::Iata
71 }
72}