openapi_github/models/
page.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/// Page : The configuration for GitHub Pages for a repository.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Page {
17    /// The API address for accessing this Page resource.
18    #[serde(rename = "url")]
19    pub url: String,
20    /// The status of the most recent build of the Page.
21    #[serde(rename = "status", deserialize_with = "Option::deserialize")]
22    pub status: Option<Status>,
23    /// The Pages site's custom domain
24    #[serde(rename = "cname", deserialize_with = "Option::deserialize")]
25    pub cname: Option<String>,
26    /// The state if the domain is verified
27    #[serde(rename = "protected_domain_state", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub protected_domain_state: Option<Option<ProtectedDomainState>>,
29    /// The timestamp when a pending domain becomes unverified.
30    #[serde(rename = "pending_domain_unverified_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub pending_domain_unverified_at: Option<Option<String>>,
32    /// Whether the Page has a custom 404 page.
33    #[serde(rename = "custom_404")]
34    pub custom_404: bool,
35    /// The web address the Page can be accessed from.
36    #[serde(rename = "html_url", skip_serializing_if = "Option::is_none")]
37    pub html_url: Option<String>,
38    /// The process in which the Page will be built.
39    #[serde(rename = "build_type", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
40    pub build_type: Option<Option<BuildType>>,
41    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
42    pub source: Option<Box<models::PagesSourceHash>>,
43    /// Whether the GitHub Pages site is publicly visible. If set to `true`, the site is accessible to anyone on the internet. If set to `false`, the site will only be accessible to users who have at least `read` access to the repository that published the site.
44    #[serde(rename = "public")]
45    pub public: bool,
46    #[serde(rename = "https_certificate", skip_serializing_if = "Option::is_none")]
47    pub https_certificate: Option<Box<models::PagesHttpsCertificate>>,
48    /// Whether https is enabled on the domain
49    #[serde(rename = "https_enforced", skip_serializing_if = "Option::is_none")]
50    pub https_enforced: Option<bool>,
51}
52
53impl Page {
54    /// The configuration for GitHub Pages for a repository.
55    pub fn new(url: String, status: Option<Status>, cname: Option<String>, custom_404: bool, public: bool) -> Page {
56        Page {
57            url,
58            status,
59            cname,
60            protected_domain_state: None,
61            pending_domain_unverified_at: None,
62            custom_404,
63            html_url: None,
64            build_type: None,
65            source: None,
66            public,
67            https_certificate: None,
68            https_enforced: None,
69        }
70    }
71}
72/// The status of the most recent build of the Page.
73#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
74pub enum Status {
75    #[serde(rename = "built")]
76    Built,
77    #[serde(rename = "building")]
78    Building,
79    #[serde(rename = "errored")]
80    Errored,
81}
82
83impl Default for Status {
84    fn default() -> Status {
85        Self::Built
86    }
87}
88/// The state if the domain is verified
89#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
90pub enum ProtectedDomainState {
91    #[serde(rename = "pending")]
92    Pending,
93    #[serde(rename = "verified")]
94    Verified,
95    #[serde(rename = "unverified")]
96    Unverified,
97}
98
99impl Default for ProtectedDomainState {
100    fn default() -> ProtectedDomainState {
101        Self::Pending
102    }
103}
104/// The process in which the Page will be built.
105#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
106pub enum BuildType {
107    #[serde(rename = "legacy")]
108    Legacy,
109    #[serde(rename = "workflow")]
110    Workflow,
111}
112
113impl Default for BuildType {
114    fn default() -> BuildType {
115        Self::Legacy
116    }
117}
118