openapi_github/models/
org_custom_property.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// OrgCustomProperty : Custom property defined on an organization
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OrgCustomProperty {
17    /// The name of the property
18    #[serde(rename = "property_name")]
19    pub property_name: String,
20    /// The type of the value for the property
21    #[serde(rename = "value_type")]
22    pub value_type: ValueType,
23    /// Whether the property is required.
24    #[serde(rename = "required", skip_serializing_if = "Option::is_none")]
25    pub required: Option<bool>,
26    #[serde(rename = "default_value", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub default_value: Option<Option<Box<models::OrgsCreateOrUpdateCustomPropertyRequestDefaultValue>>>,
28    /// Short description of the property
29    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub description: Option<Option<String>>,
31    /// An ordered list of the allowed values of the property. The property can have up to 200 allowed values.
32    #[serde(rename = "allowed_values", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub allowed_values: Option<Option<Vec<String>>>,
34    /// Who can edit the values of the property
35    #[serde(rename = "values_editable_by", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub values_editable_by: Option<Option<ValuesEditableBy>>,
37}
38
39impl OrgCustomProperty {
40    /// Custom property defined on an organization
41    pub fn new(property_name: String, value_type: ValueType) -> OrgCustomProperty {
42        OrgCustomProperty {
43            property_name,
44            value_type,
45            required: None,
46            default_value: None,
47            description: None,
48            allowed_values: None,
49            values_editable_by: None,
50        }
51    }
52}
53/// The type of the value for the property
54#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
55pub enum ValueType {
56    #[serde(rename = "string")]
57    String,
58    #[serde(rename = "single_select")]
59    SingleSelect,
60}
61
62impl Default for ValueType {
63    fn default() -> ValueType {
64        Self::String
65    }
66}
67/// Who can edit the values of the property
68#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
69pub enum ValuesEditableBy {
70    #[serde(rename = "org_actors")]
71    Actors,
72    #[serde(rename = "org_and_repo_actors")]
73    AndRepoActors,
74}
75
76impl Default for ValuesEditableBy {
77    fn default() -> ValuesEditableBy {
78        Self::Actors
79    }
80}
81