openapi_github/models/
repos_update_request.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ReposUpdateRequest {
16    /// The name of the repository.
17    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
18    pub name: Option<String>,
19    /// A short description of the repository.
20    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
21    pub description: Option<String>,
22    /// A URL with more information about the repository.
23    #[serde(rename = "homepage", skip_serializing_if = "Option::is_none")]
24    pub homepage: Option<String>,
25    /// Either `true` to make the repository private or `false` to make it public. Default: `false`.   **Note**: You will get a `422` error if the organization restricts [changing repository visibility](https://docs.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private.
26    #[serde(rename = "private", skip_serializing_if = "Option::is_none")]
27    pub private: Option<bool>,
28    /// The visibility of the repository.
29    #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")]
30    pub visibility: Option<Visibility>,
31    #[serde(rename = "security_and_analysis", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32    pub security_and_analysis: Option<Option<Box<models::ReposUpdateRequestSecurityAndAnalysis>>>,
33    /// Either `true` to enable issues for this repository or `false` to disable them.
34    #[serde(rename = "has_issues", skip_serializing_if = "Option::is_none")]
35    pub has_issues: Option<bool>,
36    /// Either `true` to enable projects for this repository or `false` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is `false`, and if you pass `true`, the API returns an error.
37    #[serde(rename = "has_projects", skip_serializing_if = "Option::is_none")]
38    pub has_projects: Option<bool>,
39    /// Either `true` to enable the wiki for this repository or `false` to disable it.
40    #[serde(rename = "has_wiki", skip_serializing_if = "Option::is_none")]
41    pub has_wiki: Option<bool>,
42    /// Either `true` to make this repo available as a template repository or `false` to prevent it.
43    #[serde(rename = "is_template", skip_serializing_if = "Option::is_none")]
44    pub is_template: Option<bool>,
45    /// Updates the default branch for this repository.
46    #[serde(rename = "default_branch", skip_serializing_if = "Option::is_none")]
47    pub default_branch: Option<String>,
48    /// Either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
49    #[serde(rename = "allow_squash_merge", skip_serializing_if = "Option::is_none")]
50    pub allow_squash_merge: Option<bool>,
51    /// Either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
52    #[serde(rename = "allow_merge_commit", skip_serializing_if = "Option::is_none")]
53    pub allow_merge_commit: Option<bool>,
54    /// Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
55    #[serde(rename = "allow_rebase_merge", skip_serializing_if = "Option::is_none")]
56    pub allow_rebase_merge: Option<bool>,
57    /// Either `true` to allow auto-merge on pull requests, or `false` to disallow auto-merge.
58    #[serde(rename = "allow_auto_merge", skip_serializing_if = "Option::is_none")]
59    pub allow_auto_merge: Option<bool>,
60    /// Either `true` to allow automatically deleting head branches when pull requests are merged, or `false` to prevent automatic deletion.
61    #[serde(rename = "delete_branch_on_merge", skip_serializing_if = "Option::is_none")]
62    pub delete_branch_on_merge: Option<bool>,
63    /// Either `true` to always allow a pull request head branch that is behind its base branch to be updated even if it is not required to be up to date before merging, or false otherwise.
64    #[serde(rename = "allow_update_branch", skip_serializing_if = "Option::is_none")]
65    pub allow_update_branch: Option<bool>,
66    /// Either `true` to allow squash-merge commits to use pull request title, or `false` to use commit message. **This property has been deprecated. Please use `squash_merge_commit_title` instead.
67    #[serde(rename = "use_squash_pr_title_as_default", skip_serializing_if = "Option::is_none")]
68    pub use_squash_pr_title_as_default: Option<bool>,
69    /// The default value for a squash merge commit title:  - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).
70    #[serde(rename = "squash_merge_commit_title", skip_serializing_if = "Option::is_none")]
71    pub squash_merge_commit_title: Option<SquashMergeCommitTitle>,
72    /// The default value for a squash merge commit message:  - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message.
73    #[serde(rename = "squash_merge_commit_message", skip_serializing_if = "Option::is_none")]
74    pub squash_merge_commit_message: Option<SquashMergeCommitMessage>,
75    /// The default value for a merge commit title.  - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).
76    #[serde(rename = "merge_commit_title", skip_serializing_if = "Option::is_none")]
77    pub merge_commit_title: Option<MergeCommitTitle>,
78    /// The default value for a merge commit message.  - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message.
79    #[serde(rename = "merge_commit_message", skip_serializing_if = "Option::is_none")]
80    pub merge_commit_message: Option<MergeCommitMessage>,
81    /// Whether to archive this repository. `false` will unarchive a previously archived repository.
82    #[serde(rename = "archived", skip_serializing_if = "Option::is_none")]
83    pub archived: Option<bool>,
84    /// Either `true` to allow private forks, or `false` to prevent private forks.
85    #[serde(rename = "allow_forking", skip_serializing_if = "Option::is_none")]
86    pub allow_forking: Option<bool>,
87    /// Either `true` to require contributors to sign off on web-based commits, or `false` to not require contributors to sign off on web-based commits.
88    #[serde(rename = "web_commit_signoff_required", skip_serializing_if = "Option::is_none")]
89    pub web_commit_signoff_required: Option<bool>,
90}
91
92impl ReposUpdateRequest {
93    pub fn new() -> ReposUpdateRequest {
94        ReposUpdateRequest {
95            name: None,
96            description: None,
97            homepage: None,
98            private: None,
99            visibility: None,
100            security_and_analysis: None,
101            has_issues: None,
102            has_projects: None,
103            has_wiki: None,
104            is_template: None,
105            default_branch: None,
106            allow_squash_merge: None,
107            allow_merge_commit: None,
108            allow_rebase_merge: None,
109            allow_auto_merge: None,
110            delete_branch_on_merge: None,
111            allow_update_branch: None,
112            use_squash_pr_title_as_default: None,
113            squash_merge_commit_title: None,
114            squash_merge_commit_message: None,
115            merge_commit_title: None,
116            merge_commit_message: None,
117            archived: None,
118            allow_forking: None,
119            web_commit_signoff_required: None,
120        }
121    }
122}
123/// The visibility of the repository.
124#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
125pub enum Visibility {
126    #[serde(rename = "public")]
127    Public,
128    #[serde(rename = "private")]
129    Private,
130}
131
132impl Default for Visibility {
133    fn default() -> Visibility {
134        Self::Public
135    }
136}
137/// The default value for a squash merge commit title:  - `PR_TITLE` - default to the pull request's title. - `COMMIT_OR_PR_TITLE` - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).
138#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
139pub enum SquashMergeCommitTitle {
140    #[serde(rename = "PR_TITLE")]
141    PrTitle,
142    #[serde(rename = "COMMIT_OR_PR_TITLE")]
143    CommitOrPrTitle,
144}
145
146impl Default for SquashMergeCommitTitle {
147    fn default() -> SquashMergeCommitTitle {
148        Self::PrTitle
149    }
150}
151/// The default value for a squash merge commit message:  - `PR_BODY` - default to the pull request's body. - `COMMIT_MESSAGES` - default to the branch's commit messages. - `BLANK` - default to a blank commit message.
152#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
153pub enum SquashMergeCommitMessage {
154    #[serde(rename = "PR_BODY")]
155    PrBody,
156    #[serde(rename = "COMMIT_MESSAGES")]
157    CommitMessages,
158    #[serde(rename = "BLANK")]
159    Blank,
160}
161
162impl Default for SquashMergeCommitMessage {
163    fn default() -> SquashMergeCommitMessage {
164        Self::PrBody
165    }
166}
167/// The default value for a merge commit title.  - `PR_TITLE` - default to the pull request's title. - `MERGE_MESSAGE` - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).
168#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
169pub enum MergeCommitTitle {
170    #[serde(rename = "PR_TITLE")]
171    PrTitle,
172    #[serde(rename = "MERGE_MESSAGE")]
173    MergeMessage,
174}
175
176impl Default for MergeCommitTitle {
177    fn default() -> MergeCommitTitle {
178        Self::PrTitle
179    }
180}
181/// The default value for a merge commit message.  - `PR_TITLE` - default to the pull request's title. - `PR_BODY` - default to the pull request's body. - `BLANK` - default to a blank commit message.
182#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
183pub enum MergeCommitMessage {
184    #[serde(rename = "PR_BODY")]
185    PrBody,
186    #[serde(rename = "PR_TITLE")]
187    PrTitle,
188    #[serde(rename = "BLANK")]
189    Blank,
190}
191
192impl Default for MergeCommitMessage {
193    fn default() -> MergeCommitMessage {
194        Self::PrBody
195    }
196}
197