openapi_github/models/
branch_with_protection.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/// BranchWithProtection : Branch With Protection
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct BranchWithProtection {
17    #[serde(rename = "name")]
18    pub name: String,
19    #[serde(rename = "commit")]
20    pub commit: Box<models::Commit>,
21    #[serde(rename = "_links")]
22    pub _links: Box<models::BranchWithProtectionLinks>,
23    #[serde(rename = "protected")]
24    pub protected: bool,
25    #[serde(rename = "protection")]
26    pub protection: Box<models::BranchProtection>,
27    #[serde(rename = "protection_url")]
28    pub protection_url: String,
29    #[serde(rename = "pattern", skip_serializing_if = "Option::is_none")]
30    pub pattern: Option<String>,
31    #[serde(rename = "required_approving_review_count", skip_serializing_if = "Option::is_none")]
32    pub required_approving_review_count: Option<i32>,
33}
34
35impl BranchWithProtection {
36    /// Branch With Protection
37    pub fn new(name: String, commit: models::Commit, _links: models::BranchWithProtectionLinks, protected: bool, protection: models::BranchProtection, protection_url: String) -> BranchWithProtection {
38        BranchWithProtection {
39            name,
40            commit: Box::new(commit),
41            _links: Box::new(_links),
42            protected,
43            protection: Box::new(protection),
44            protection_url,
45            pattern: None,
46            required_approving_review_count: None,
47        }
48    }
49}
50