openapi_github/models/
simple_pull_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 SimplePullRequest {
16    #[serde(rename = "_links")]
17    pub _links: Box<models::WebhooksPullRequest5Links>,
18    #[serde(rename = "active_lock_reason", deserialize_with = "Option::deserialize")]
19    pub active_lock_reason: Option<ActiveLockReason>,
20    #[serde(rename = "assignee", deserialize_with = "Option::deserialize")]
21    pub assignee: Option<Box<models::User1>>,
22    #[serde(rename = "assignees")]
23    pub assignees: Vec<models::User1>,
24    /// How the author is associated with the repository.
25    #[serde(rename = "author_association")]
26    pub author_association: AuthorAssociation,
27    #[serde(rename = "auto_merge", deserialize_with = "Option::deserialize")]
28    pub auto_merge: Option<Box<models::PullRequestAutoMerge>>,
29    #[serde(rename = "base")]
30    pub base: Box<models::PullRequestBase>,
31    #[serde(rename = "body", deserialize_with = "Option::deserialize")]
32    pub body: Option<String>,
33    #[serde(rename = "closed_at", deserialize_with = "Option::deserialize")]
34    pub closed_at: Option<String>,
35    #[serde(rename = "comments_url")]
36    pub comments_url: String,
37    #[serde(rename = "commits_url")]
38    pub commits_url: String,
39    #[serde(rename = "created_at")]
40    pub created_at: String,
41    #[serde(rename = "diff_url")]
42    pub diff_url: String,
43    #[serde(rename = "draft")]
44    pub draft: bool,
45    #[serde(rename = "head")]
46    pub head: Box<models::WebhookPullRequestReviewCommentDeletedPullRequestHead>,
47    #[serde(rename = "html_url")]
48    pub html_url: String,
49    #[serde(rename = "id")]
50    pub id: i32,
51    #[serde(rename = "issue_url")]
52    pub issue_url: String,
53    #[serde(rename = "labels")]
54    pub labels: Vec<models::Label>,
55    #[serde(rename = "locked")]
56    pub locked: bool,
57    #[serde(rename = "merge_commit_sha", deserialize_with = "Option::deserialize")]
58    pub merge_commit_sha: Option<String>,
59    #[serde(rename = "merged_at", deserialize_with = "Option::deserialize")]
60    pub merged_at: Option<String>,
61    #[serde(rename = "milestone", deserialize_with = "Option::deserialize")]
62    pub milestone: Option<Box<models::Milestone1>>,
63    #[serde(rename = "node_id")]
64    pub node_id: String,
65    #[serde(rename = "number")]
66    pub number: i32,
67    #[serde(rename = "patch_url")]
68    pub patch_url: String,
69    #[serde(rename = "requested_reviewers")]
70    pub requested_reviewers: Vec<models::PullRequestRequestedReviewersInner>,
71    #[serde(rename = "requested_teams")]
72    pub requested_teams: Vec<models::Team>,
73    #[serde(rename = "review_comment_url")]
74    pub review_comment_url: String,
75    #[serde(rename = "review_comments_url")]
76    pub review_comments_url: String,
77    #[serde(rename = "state")]
78    pub state: State,
79    #[serde(rename = "statuses_url")]
80    pub statuses_url: String,
81    #[serde(rename = "title")]
82    pub title: String,
83    #[serde(rename = "updated_at")]
84    pub updated_at: String,
85    #[serde(rename = "url")]
86    pub url: String,
87    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
88    pub user: Option<Box<models::User1>>,
89}
90
91impl SimplePullRequest {
92    pub fn new(_links: models::WebhooksPullRequest5Links, active_lock_reason: Option<ActiveLockReason>, assignee: Option<models::User1>, assignees: Vec<models::User1>, author_association: AuthorAssociation, auto_merge: Option<models::PullRequestAutoMerge>, base: models::PullRequestBase, body: Option<String>, closed_at: Option<String>, comments_url: String, commits_url: String, created_at: String, diff_url: String, draft: bool, head: models::WebhookPullRequestReviewCommentDeletedPullRequestHead, html_url: String, id: i32, issue_url: String, labels: Vec<models::Label>, locked: bool, merge_commit_sha: Option<String>, merged_at: Option<String>, milestone: Option<models::Milestone1>, node_id: String, number: i32, patch_url: String, requested_reviewers: Vec<models::PullRequestRequestedReviewersInner>, requested_teams: Vec<models::Team>, review_comment_url: String, review_comments_url: String, state: State, statuses_url: String, title: String, updated_at: String, url: String, user: Option<models::User1>) -> SimplePullRequest {
93        SimplePullRequest {
94            _links: Box::new(_links),
95            active_lock_reason,
96            assignee: assignee.map(Box::new),
97            assignees,
98            author_association,
99            auto_merge: auto_merge.map(Box::new),
100            base: Box::new(base),
101            body,
102            closed_at,
103            comments_url,
104            commits_url,
105            created_at,
106            diff_url,
107            draft,
108            head: Box::new(head),
109            html_url,
110            id,
111            issue_url,
112            labels,
113            locked,
114            merge_commit_sha,
115            merged_at,
116            milestone: milestone.map(Box::new),
117            node_id,
118            number,
119            patch_url,
120            requested_reviewers,
121            requested_teams,
122            review_comment_url,
123            review_comments_url,
124            state,
125            statuses_url,
126            title,
127            updated_at,
128            url,
129            user: user.map(Box::new),
130        }
131    }
132}
133/// 
134#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
135pub enum ActiveLockReason {
136    #[serde(rename = "resolved")]
137    Resolved,
138    #[serde(rename = "off-topic")]
139    OffTopic,
140    #[serde(rename = "too heated")]
141    TooHeated,
142    #[serde(rename = "spam")]
143    Spam,
144}
145
146impl Default for ActiveLockReason {
147    fn default() -> ActiveLockReason {
148        Self::Resolved
149    }
150}
151/// How the author is associated with the repository.
152#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
153pub enum AuthorAssociation {
154    #[serde(rename = "COLLABORATOR")]
155    Collaborator,
156    #[serde(rename = "CONTRIBUTOR")]
157    Contributor,
158    #[serde(rename = "FIRST_TIMER")]
159    FirstTimer,
160    #[serde(rename = "FIRST_TIME_CONTRIBUTOR")]
161    FirstTimeContributor,
162    #[serde(rename = "MANNEQUIN")]
163    Mannequin,
164    #[serde(rename = "MEMBER")]
165    Member,
166    #[serde(rename = "NONE")]
167    None,
168    #[serde(rename = "OWNER")]
169    Owner,
170}
171
172impl Default for AuthorAssociation {
173    fn default() -> AuthorAssociation {
174        Self::Collaborator
175    }
176}
177/// 
178#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
179pub enum State {
180    #[serde(rename = "open")]
181    Open,
182    #[serde(rename = "closed")]
183    Closed,
184}
185
186impl Default for State {
187    fn default() -> State {
188        Self::Open
189    }
190}
191