netbox-openapi 0.6.0

low level netbox bindings (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * NetBox REST API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 4.6.2 (4.6)
 *
 * Generated by: https://openapi-generator.tech
 */

/// CustomFieldChoiceSet : Adds an `owner` field for models which have a ForeignKey to users.Owner.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct CustomFieldChoiceSet {
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<i32>,
    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    #[serde(rename = "display_url", skip_serializing_if = "Option::is_none")]
    pub display_url: Option<String>,
    #[serde(rename = "display", skip_serializing_if = "Option::is_none")]
    pub display: Option<String>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(rename = "base_choices", skip_serializing_if = "Option::is_none")]
    pub base_choices: Option<Box<crate::models::CustomFieldChoiceSetBaseChoices>>,
    #[serde(rename = "extra_choices")]
    pub extra_choices: Vec<Vec<serde_json::Value>>,
    #[serde(rename = "choice_colors", skip_serializing_if = "Option::is_none")]
    pub choice_colors: Option<ChoiceColors>,
    /// Choices are automatically ordered alphabetically
    #[serde(
        rename = "order_alphabetically",
        skip_serializing_if = "Option::is_none"
    )]
    pub order_alphabetically: Option<bool>,
    #[serde(rename = "choices_count", skip_serializing_if = "Option::is_none")]
    pub choices_count: Option<i32>,
    #[serde(
        rename = "owner",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub owner: Option<Option<Box<crate::models::BriefOwner>>>,
    #[serde(
        rename = "created",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub created: Option<Option<String>>,
    #[serde(
        rename = "last_updated",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_updated: Option<Option<String>>,
}

impl CustomFieldChoiceSet {
    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
    pub fn new(name: String, extra_choices: Vec<Vec<serde_json::Value>>) -> CustomFieldChoiceSet {
        CustomFieldChoiceSet {
            id: None,
            url: None,
            display_url: None,
            display: None,
            name,
            description: None,
            base_choices: None,
            extra_choices,
            choice_colors: None,
            order_alphabetically: None,
            choices_count: None,
            owner: None,
            created: None,
            last_updated: None,
        }
    }
}

///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ChoiceColors {
    #[serde(rename = "blue")]
    Blue,
    #[serde(rename = "indigo")]
    Indigo,
    #[serde(rename = "purple")]
    Purple,
    #[serde(rename = "pink")]
    Pink,
    #[serde(rename = "red")]
    Red,
    #[serde(rename = "orange")]
    Orange,
    #[serde(rename = "yellow")]
    Yellow,
    #[serde(rename = "green")]
    Green,
    #[serde(rename = "teal")]
    Teal,
    #[serde(rename = "cyan")]
    Cyan,
    #[serde(rename = "gray")]
    Gray,
    #[serde(rename = "black")]
    Black,
    #[serde(rename = "white")]
    White,
}

impl Default for ChoiceColors {
    fn default() -> ChoiceColors {
        Self::Blue
    }
}