openapi-github 0.1.0

OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
Documentation
/*
 * GitHub's official OpenAPI spec + Octokit extension
 *
 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
 *
 * The version of the OpenAPI document: 16.6.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// RepositoryRuleset : A set of rules to apply when specified conditions are met.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RepositoryRuleset {
    /// The ID of the ruleset
    #[serde(rename = "id")]
    pub id: i32,
    /// The name of the ruleset
    #[serde(rename = "name")]
    pub name: String,
    /// The target of the ruleset  **Note**: The `push` target is in beta and is subject to change.
    #[serde(rename = "target", skip_serializing_if = "Option::is_none")]
    pub target: Option<Target>,
    /// The type of the source of the ruleset
    #[serde(rename = "source_type", skip_serializing_if = "Option::is_none")]
    pub source_type: Option<SourceType>,
    /// The name of the source
    #[serde(rename = "source")]
    pub source: String,
    #[serde(rename = "enforcement")]
    pub enforcement: models::RepositoryRuleEnforcement,
    /// The actors that can bypass the rules in this ruleset
    #[serde(rename = "bypass_actors", skip_serializing_if = "Option::is_none")]
    pub bypass_actors: Option<Vec<models::RepositoryRulesetBypassActor>>,
    /// The bypass type of the user making the API request for this ruleset. This field is only returned when querying the repository-level endpoint.
    #[serde(rename = "current_user_can_bypass", skip_serializing_if = "Option::is_none")]
    pub current_user_can_bypass: Option<CurrentUserCanBypass>,
    #[serde(rename = "node_id", skip_serializing_if = "Option::is_none")]
    pub node_id: Option<String>,
    #[serde(rename = "_links", skip_serializing_if = "Option::is_none")]
    pub _links: Option<Box<models::RepositoryRulesetLinks>>,
    #[serde(rename = "conditions", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub conditions: Option<Option<Box<models::RepositoryRulesetConditions>>>,
    #[serde(rename = "rules", skip_serializing_if = "Option::is_none")]
    pub rules: Option<Vec<models::RepositoryRule>>,
    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
    pub created_at: Option<String>,
    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
    pub updated_at: Option<String>,
}

impl RepositoryRuleset {
    /// A set of rules to apply when specified conditions are met.
    pub fn new(id: i32, name: String, source: String, enforcement: models::RepositoryRuleEnforcement) -> RepositoryRuleset {
        RepositoryRuleset {
            id,
            name,
            target: None,
            source_type: None,
            source,
            enforcement,
            bypass_actors: None,
            current_user_can_bypass: None,
            node_id: None,
            _links: None,
            conditions: None,
            rules: None,
            created_at: None,
            updated_at: None,
        }
    }
}
/// The target of the ruleset  **Note**: The `push` target is in beta and is subject to change.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Target {
    #[serde(rename = "branch")]
    Branch,
    #[serde(rename = "tag")]
    Tag,
    #[serde(rename = "push")]
    Push,
}

impl Default for Target {
    fn default() -> Target {
        Self::Branch
    }
}
/// The type of the source of the ruleset
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SourceType {
    #[serde(rename = "Repository")]
    Repository,
    #[serde(rename = "Organization")]
    Organization,
}

impl Default for SourceType {
    fn default() -> SourceType {
        Self::Repository
    }
}
/// The bypass type of the user making the API request for this ruleset. This field is only returned when querying the repository-level endpoint.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CurrentUserCanBypass {
    #[serde(rename = "always")]
    Always,
    #[serde(rename = "pull_requests_only")]
    PullRequestsOnly,
    #[serde(rename = "never")]
    Never,
}

impl Default for CurrentUserCanBypass {
    fn default() -> CurrentUserCanBypass {
        Self::Always
    }
}