openapi_github/models/
pull_request_webhook.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 PullRequestWebhook {
16    #[serde(rename = "url")]
17    pub url: String,
18    #[serde(rename = "id")]
19    pub id: i32,
20    #[serde(rename = "node_id")]
21    pub node_id: String,
22    #[serde(rename = "html_url")]
23    pub html_url: String,
24    #[serde(rename = "diff_url")]
25    pub diff_url: String,
26    #[serde(rename = "patch_url")]
27    pub patch_url: String,
28    #[serde(rename = "issue_url")]
29    pub issue_url: String,
30    #[serde(rename = "commits_url")]
31    pub commits_url: String,
32    #[serde(rename = "review_comments_url")]
33    pub review_comments_url: String,
34    #[serde(rename = "review_comment_url")]
35    pub review_comment_url: String,
36    #[serde(rename = "comments_url")]
37    pub comments_url: String,
38    #[serde(rename = "statuses_url")]
39    pub statuses_url: String,
40    /// Number uniquely identifying the pull request within its repository.
41    #[serde(rename = "number")]
42    pub number: i32,
43    /// State of this Pull Request. Either `open` or `closed`.
44    #[serde(rename = "state")]
45    pub state: State,
46    #[serde(rename = "locked")]
47    pub locked: bool,
48    /// The title of the pull request.
49    #[serde(rename = "title")]
50    pub title: String,
51    #[serde(rename = "user")]
52    pub user: Box<models::SimpleUser>,
53    #[serde(rename = "body", deserialize_with = "Option::deserialize")]
54    pub body: Option<String>,
55    #[serde(rename = "labels")]
56    pub labels: Vec<models::PullRequestLabelsInner>,
57    #[serde(rename = "milestone", deserialize_with = "Option::deserialize")]
58    pub milestone: Option<Box<models::NullableMilestone>>,
59    #[serde(rename = "active_lock_reason", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
60    pub active_lock_reason: Option<Option<String>>,
61    #[serde(rename = "created_at")]
62    pub created_at: String,
63    #[serde(rename = "updated_at")]
64    pub updated_at: String,
65    #[serde(rename = "closed_at", deserialize_with = "Option::deserialize")]
66    pub closed_at: Option<String>,
67    #[serde(rename = "merged_at", deserialize_with = "Option::deserialize")]
68    pub merged_at: Option<String>,
69    #[serde(rename = "merge_commit_sha", deserialize_with = "Option::deserialize")]
70    pub merge_commit_sha: Option<String>,
71    #[serde(rename = "assignee", deserialize_with = "Option::deserialize")]
72    pub assignee: Option<Box<models::NullableSimpleUser>>,
73    #[serde(rename = "assignees", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
74    pub assignees: Option<Option<Vec<models::SimpleUser>>>,
75    #[serde(rename = "requested_reviewers", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
76    pub requested_reviewers: Option<Option<Vec<models::SimpleUser>>>,
77    #[serde(rename = "requested_teams", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
78    pub requested_teams: Option<Option<Vec<models::TeamSimple>>>,
79    #[serde(rename = "head")]
80    pub head: Box<models::PullRequestHead>,
81    #[serde(rename = "base")]
82    pub base: Box<models::PullRequestBase>,
83    #[serde(rename = "_links")]
84    pub _links: Box<models::PullRequestSimpleLinks>,
85    #[serde(rename = "author_association")]
86    pub author_association: models::AuthorAssociation,
87    #[serde(rename = "auto_merge", deserialize_with = "Option::deserialize")]
88    pub auto_merge: Option<Box<models::AutoMerge>>,
89    /// Indicates whether or not the pull request is a draft.
90    #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
91    pub draft: Option<bool>,
92    #[serde(rename = "merged")]
93    pub merged: bool,
94    #[serde(rename = "mergeable", deserialize_with = "Option::deserialize")]
95    pub mergeable: Option<bool>,
96    #[serde(rename = "rebaseable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
97    pub rebaseable: Option<Option<bool>>,
98    #[serde(rename = "mergeable_state")]
99    pub mergeable_state: String,
100    #[serde(rename = "merged_by", deserialize_with = "Option::deserialize")]
101    pub merged_by: Option<Box<models::NullableSimpleUser>>,
102    #[serde(rename = "comments")]
103    pub comments: i32,
104    #[serde(rename = "review_comments")]
105    pub review_comments: i32,
106    /// Indicates whether maintainers can modify the pull request.
107    #[serde(rename = "maintainer_can_modify")]
108    pub maintainer_can_modify: bool,
109    #[serde(rename = "commits")]
110    pub commits: i32,
111    #[serde(rename = "additions")]
112    pub additions: i32,
113    #[serde(rename = "deletions")]
114    pub deletions: i32,
115    #[serde(rename = "changed_files")]
116    pub changed_files: i32,
117    /// Whether to allow auto-merge for pull requests.
118    #[serde(rename = "allow_auto_merge", skip_serializing_if = "Option::is_none")]
119    pub allow_auto_merge: Option<bool>,
120    /// Whether to allow updating the pull request's branch.
121    #[serde(rename = "allow_update_branch", skip_serializing_if = "Option::is_none")]
122    pub allow_update_branch: Option<bool>,
123    /// Whether to delete head branches when pull requests are merged.
124    #[serde(rename = "delete_branch_on_merge", skip_serializing_if = "Option::is_none")]
125    pub delete_branch_on_merge: Option<bool>,
126    /// 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.
127    #[serde(rename = "merge_commit_message", skip_serializing_if = "Option::is_none")]
128    pub merge_commit_message: Option<MergeCommitMessage>,
129    /// 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\").
130    #[serde(rename = "merge_commit_title", skip_serializing_if = "Option::is_none")]
131    pub merge_commit_title: Option<MergeCommitTitle>,
132    /// 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.
133    #[serde(rename = "squash_merge_commit_message", skip_serializing_if = "Option::is_none")]
134    pub squash_merge_commit_message: Option<SquashMergeCommitMessage>,
135    /// 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).
136    #[serde(rename = "squash_merge_commit_title", skip_serializing_if = "Option::is_none")]
137    pub squash_merge_commit_title: Option<SquashMergeCommitTitle>,
138    /// Whether a squash merge commit can use the pull request title as default. **This property has been deprecated. Please use `squash_merge_commit_title` instead.**
139    #[serde(rename = "use_squash_pr_title_as_default", skip_serializing_if = "Option::is_none")]
140    pub use_squash_pr_title_as_default: Option<bool>,
141}
142
143impl PullRequestWebhook {
144    pub fn new(url: String, id: i32, node_id: String, html_url: String, diff_url: String, patch_url: String, issue_url: String, commits_url: String, review_comments_url: String, review_comment_url: String, comments_url: String, statuses_url: String, number: i32, state: State, locked: bool, title: String, user: models::SimpleUser, body: Option<String>, labels: Vec<models::PullRequestLabelsInner>, milestone: Option<models::NullableMilestone>, created_at: String, updated_at: String, closed_at: Option<String>, merged_at: Option<String>, merge_commit_sha: Option<String>, assignee: Option<models::NullableSimpleUser>, head: models::PullRequestHead, base: models::PullRequestBase, _links: models::PullRequestSimpleLinks, author_association: models::AuthorAssociation, auto_merge: Option<models::AutoMerge>, merged: bool, mergeable: Option<bool>, mergeable_state: String, merged_by: Option<models::NullableSimpleUser>, comments: i32, review_comments: i32, maintainer_can_modify: bool, commits: i32, additions: i32, deletions: i32, changed_files: i32) -> PullRequestWebhook {
145        PullRequestWebhook {
146            url,
147            id,
148            node_id,
149            html_url,
150            diff_url,
151            patch_url,
152            issue_url,
153            commits_url,
154            review_comments_url,
155            review_comment_url,
156            comments_url,
157            statuses_url,
158            number,
159            state,
160            locked,
161            title,
162            user: Box::new(user),
163            body,
164            labels,
165            milestone: milestone.map(Box::new),
166            active_lock_reason: None,
167            created_at,
168            updated_at,
169            closed_at,
170            merged_at,
171            merge_commit_sha,
172            assignee: assignee.map(Box::new),
173            assignees: None,
174            requested_reviewers: None,
175            requested_teams: None,
176            head: Box::new(head),
177            base: Box::new(base),
178            _links: Box::new(_links),
179            author_association,
180            auto_merge: auto_merge.map(Box::new),
181            draft: None,
182            merged,
183            mergeable,
184            rebaseable: None,
185            mergeable_state,
186            merged_by: merged_by.map(Box::new),
187            comments,
188            review_comments,
189            maintainer_can_modify,
190            commits,
191            additions,
192            deletions,
193            changed_files,
194            allow_auto_merge: None,
195            allow_update_branch: None,
196            delete_branch_on_merge: None,
197            merge_commit_message: None,
198            merge_commit_title: None,
199            squash_merge_commit_message: None,
200            squash_merge_commit_title: None,
201            use_squash_pr_title_as_default: None,
202        }
203    }
204}
205/// State of this Pull Request. Either `open` or `closed`.
206#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
207pub enum State {
208    #[serde(rename = "open")]
209    Open,
210    #[serde(rename = "closed")]
211    Closed,
212}
213
214impl Default for State {
215    fn default() -> State {
216        Self::Open
217    }
218}
219/// 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.
220#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
221pub enum MergeCommitMessage {
222    #[serde(rename = "PR_BODY")]
223    PrBody,
224    #[serde(rename = "PR_TITLE")]
225    PrTitle,
226    #[serde(rename = "BLANK")]
227    Blank,
228}
229
230impl Default for MergeCommitMessage {
231    fn default() -> MergeCommitMessage {
232        Self::PrBody
233    }
234}
235/// 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\").
236#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
237pub enum MergeCommitTitle {
238    #[serde(rename = "PR_TITLE")]
239    PrTitle,
240    #[serde(rename = "MERGE_MESSAGE")]
241    MergeMessage,
242}
243
244impl Default for MergeCommitTitle {
245    fn default() -> MergeCommitTitle {
246        Self::PrTitle
247    }
248}
249/// 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.
250#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
251pub enum SquashMergeCommitMessage {
252    #[serde(rename = "PR_BODY")]
253    PrBody,
254    #[serde(rename = "COMMIT_MESSAGES")]
255    CommitMessages,
256    #[serde(rename = "BLANK")]
257    Blank,
258}
259
260impl Default for SquashMergeCommitMessage {
261    fn default() -> SquashMergeCommitMessage {
262        Self::PrBody
263    }
264}
265/// 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).
266#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
267pub enum SquashMergeCommitTitle {
268    #[serde(rename = "PR_TITLE")]
269    PrTitle,
270    #[serde(rename = "COMMIT_OR_PR_TITLE")]
271    CommitOrPrTitle,
272}
273
274impl Default for SquashMergeCommitTitle {
275    fn default() -> SquashMergeCommitTitle {
276        Self::PrTitle
277    }
278}
279