openapi_github/models/
branch_with_protection.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[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 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