openapi_github/models/
repos_create_in_org_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 ReposCreateInOrgRequest {
16    /// The name of the repository.
17    #[serde(rename = "name")]
18    pub name: 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    /// Whether the repository is 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    /// Either `true` to enable issues for this repository or `false` to disable them.
32    #[serde(rename = "has_issues", skip_serializing_if = "Option::is_none")]
33    pub has_issues: Option<bool>,
34    /// 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.
35    #[serde(rename = "has_projects", skip_serializing_if = "Option::is_none")]
36    pub has_projects: Option<bool>,
37    /// Either `true` to enable the wiki for this repository or `false` to disable it.
38    #[serde(rename = "has_wiki", skip_serializing_if = "Option::is_none")]
39    pub has_wiki: Option<bool>,
40    /// Whether downloads are enabled.
41    #[serde(rename = "has_downloads", skip_serializing_if = "Option::is_none")]
42    pub has_downloads: Option<bool>,
43    /// Either `true` to make this repo available as a template repository or `false` to prevent it.
44    #[serde(rename = "is_template", skip_serializing_if = "Option::is_none")]
45    pub is_template: Option<bool>,
46    /// The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.
47    #[serde(rename = "team_id", skip_serializing_if = "Option::is_none")]
48    pub team_id: Option<i32>,
49    /// Pass `true` to create an initial commit with empty README.
50    #[serde(rename = "auto_init", skip_serializing_if = "Option::is_none")]
51    pub auto_init: Option<bool>,
52    /// Desired language or platform [.gitignore template](https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, \"Haskell\".
53    #[serde(rename = "gitignore_template", skip_serializing_if = "Option::is_none")]
54    pub gitignore_template: Option<String>,
55    /// Choose an [open source license template](https://choosealicense.com/) that best suits your needs, and then use the [license keyword](https://docs.github.com/articles/licensing-a-repository/#searching-github-by-license-type) as the `license_template` string. For example, \"mit\" or \"mpl-2.0\".
56    #[serde(rename = "license_template", skip_serializing_if = "Option::is_none")]
57    pub license_template: Option<String>,
58    /// Either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging.
59    #[serde(rename = "allow_squash_merge", skip_serializing_if = "Option::is_none")]
60    pub allow_squash_merge: Option<bool>,
61    /// Either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.
62    #[serde(rename = "allow_merge_commit", skip_serializing_if = "Option::is_none")]
63    pub allow_merge_commit: Option<bool>,
64    /// Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging.
65    #[serde(rename = "allow_rebase_merge", skip_serializing_if = "Option::is_none")]
66    pub allow_rebase_merge: Option<bool>,
67    /// Either `true` to allow auto-merge on pull requests, or `false` to disallow auto-merge.
68    #[serde(rename = "allow_auto_merge", skip_serializing_if = "Option::is_none")]
69    pub allow_auto_merge: Option<bool>,
70    /// Either `true` to allow automatically deleting head branches when pull requests are merged, or `false` to prevent automatic deletion. **The authenticated user must be an organization owner to set this property to `true`.**
71    #[serde(rename = "delete_branch_on_merge", skip_serializing_if = "Option::is_none")]
72    pub delete_branch_on_merge: Option<bool>,
73    /// 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.
74    #[serde(rename = "use_squash_pr_title_as_default", skip_serializing_if = "Option::is_none")]
75    pub use_squash_pr_title_as_default: Option<bool>,
76    /// 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).
77    #[serde(rename = "squash_merge_commit_title", skip_serializing_if = "Option::is_none")]
78    pub squash_merge_commit_title: Option<SquashMergeCommitTitle>,
79    /// 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.
80    #[serde(rename = "squash_merge_commit_message", skip_serializing_if = "Option::is_none")]
81    pub squash_merge_commit_message: Option<SquashMergeCommitMessage>,
82    /// 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).
83    #[serde(rename = "merge_commit_title", skip_serializing_if = "Option::is_none")]
84    pub merge_commit_title: Option<MergeCommitTitle>,
85    /// 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.
86    #[serde(rename = "merge_commit_message", skip_serializing_if = "Option::is_none")]
87    pub merge_commit_message: Option<MergeCommitMessage>,
88    /// The custom properties for the new repository. The keys are the custom property names, and the values are the corresponding custom property values.
89    #[serde(rename = "custom_properties", skip_serializing_if = "Option::is_none")]
90    pub custom_properties: Option<std::collections::HashMap<String, serde_json::Value>>,
91}
92
93impl ReposCreateInOrgRequest {
94    pub fn new(name: String) -> ReposCreateInOrgRequest {
95        ReposCreateInOrgRequest {
96            name,
97            description: None,
98            homepage: None,
99            private: None,
100            visibility: None,
101            has_issues: None,
102            has_projects: None,
103            has_wiki: None,
104            has_downloads: None,
105            is_template: None,
106            team_id: None,
107            auto_init: None,
108            gitignore_template: None,
109            license_template: None,
110            allow_squash_merge: None,
111            allow_merge_commit: None,
112            allow_rebase_merge: None,
113            allow_auto_merge: None,
114            delete_branch_on_merge: None,
115            use_squash_pr_title_as_default: None,
116            squash_merge_commit_title: None,
117            squash_merge_commit_message: None,
118            merge_commit_title: None,
119            merge_commit_message: None,
120            custom_properties: None,
121        }
122    }
123}
124/// The visibility of the repository.
125#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
126pub enum Visibility {
127    #[serde(rename = "public")]
128    Public,
129    #[serde(rename = "private")]
130    Private,
131}
132
133impl Default for Visibility {
134    fn default() -> Visibility {
135        Self::Public
136    }
137}
138/// 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).
139#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
140pub enum SquashMergeCommitTitle {
141    #[serde(rename = "PR_TITLE")]
142    PrTitle,
143    #[serde(rename = "COMMIT_OR_PR_TITLE")]
144    CommitOrPrTitle,
145}
146
147impl Default for SquashMergeCommitTitle {
148    fn default() -> SquashMergeCommitTitle {
149        Self::PrTitle
150    }
151}
152/// 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.
153#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
154pub enum SquashMergeCommitMessage {
155    #[serde(rename = "PR_BODY")]
156    PrBody,
157    #[serde(rename = "COMMIT_MESSAGES")]
158    CommitMessages,
159    #[serde(rename = "BLANK")]
160    Blank,
161}
162
163impl Default for SquashMergeCommitMessage {
164    fn default() -> SquashMergeCommitMessage {
165        Self::PrBody
166    }
167}
168/// 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).
169#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
170pub enum MergeCommitTitle {
171    #[serde(rename = "PR_TITLE")]
172    PrTitle,
173    #[serde(rename = "MERGE_MESSAGE")]
174    MergeMessage,
175}
176
177impl Default for MergeCommitTitle {
178    fn default() -> MergeCommitTitle {
179        Self::PrTitle
180    }
181}
182/// 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.
183#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
184pub enum MergeCommitMessage {
185    #[serde(rename = "PR_BODY")]
186    PrBody,
187    #[serde(rename = "PR_TITLE")]
188    PrTitle,
189    #[serde(rename = "BLANK")]
190    Blank,
191}
192
193impl Default for MergeCommitMessage {
194    fn default() -> MergeCommitMessage {
195        Self::PrBody
196    }
197}
198