Skip to main content

netbox_openapi/models/
custom_field_choice_set.rs

1/*
2 * NetBox REST API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.5.9-Docker-4.0.2 (4.5)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// CustomFieldChoiceSet : Adds an `owner` field for models which have a ForeignKey to users.Owner.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct CustomFieldChoiceSet {
15    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
16    pub id: Option<i32>,
17    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
18    pub url: Option<String>,
19    #[serde(rename = "display_url", skip_serializing_if = "Option::is_none")]
20    pub display_url: Option<String>,
21    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
22    pub display: Option<String>,
23    #[serde(rename = "name")]
24    pub name: String,
25    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
26    pub description: Option<String>,
27    #[serde(rename = "base_choices", skip_serializing_if = "Option::is_none")]
28    pub base_choices: Option<Box<crate::models::CustomFieldChoiceSetBaseChoices>>,
29    #[serde(rename = "extra_choices")]
30    pub extra_choices: Vec<Vec<serde_json::Value>>,
31    /// Choices are automatically ordered alphabetically
32    #[serde(
33        rename = "order_alphabetically",
34        skip_serializing_if = "Option::is_none"
35    )]
36    pub order_alphabetically: Option<bool>,
37    #[serde(rename = "choices_count", skip_serializing_if = "Option::is_none")]
38    pub choices_count: Option<i32>,
39    #[serde(
40        rename = "owner",
41        default,
42        with = "::serde_with::rust::double_option",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub owner: Option<Option<Box<crate::models::BriefOwner>>>,
46    #[serde(
47        rename = "created",
48        default,
49        with = "::serde_with::rust::double_option",
50        skip_serializing_if = "Option::is_none"
51    )]
52    pub created: Option<Option<String>>,
53    #[serde(
54        rename = "last_updated",
55        default,
56        with = "::serde_with::rust::double_option",
57        skip_serializing_if = "Option::is_none"
58    )]
59    pub last_updated: Option<Option<String>>,
60}
61
62impl CustomFieldChoiceSet {
63    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
64    pub fn new(name: String, extra_choices: Vec<Vec<serde_json::Value>>) -> CustomFieldChoiceSet {
65        CustomFieldChoiceSet {
66            id: None,
67            url: None,
68            display_url: None,
69            display: None,
70            name,
71            description: None,
72            base_choices: None,
73            extra_choices,
74            order_alphabetically: None,
75            choices_count: None,
76            owner: None,
77            created: None,
78            last_updated: None,
79        }
80    }
81}