openapi_github/models/
pull_request_review_comment_1.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/// PullRequestReviewComment1 : The [comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request) itself.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct PullRequestReviewComment1 {
17    #[serde(rename = "_links")]
18    pub _links: Box<models::WebhooksReviewCommentLinks>,
19    /// How the author is associated with the repository.
20    #[serde(rename = "author_association")]
21    pub author_association: AuthorAssociation,
22    /// The text of the comment.
23    #[serde(rename = "body")]
24    pub body: String,
25    /// The SHA of the commit to which the comment applies.
26    #[serde(rename = "commit_id")]
27    pub commit_id: String,
28    #[serde(rename = "created_at")]
29    pub created_at: String,
30    /// The diff of the line that the comment refers to.
31    #[serde(rename = "diff_hunk")]
32    pub diff_hunk: String,
33    /// HTML URL for the pull request review comment.
34    #[serde(rename = "html_url")]
35    pub html_url: String,
36    /// The ID of the pull request review comment.
37    #[serde(rename = "id")]
38    pub id: i32,
39    /// The comment ID to reply to.
40    #[serde(rename = "in_reply_to_id", skip_serializing_if = "Option::is_none")]
41    pub in_reply_to_id: Option<i32>,
42    /// The line of the blob to which the comment applies. The last line of the range for a multi-line comment
43    #[serde(rename = "line", deserialize_with = "Option::deserialize")]
44    pub line: Option<i32>,
45    /// The node ID of the pull request review comment.
46    #[serde(rename = "node_id")]
47    pub node_id: String,
48    /// The SHA of the original commit to which the comment applies.
49    #[serde(rename = "original_commit_id")]
50    pub original_commit_id: String,
51    /// The line of the blob to which the comment applies. The last line of the range for a multi-line comment
52    #[serde(rename = "original_line", deserialize_with = "Option::deserialize")]
53    pub original_line: Option<i32>,
54    /// The index of the original line in the diff to which the comment applies.
55    #[serde(rename = "original_position")]
56    pub original_position: i32,
57    /// The first line of the range for a multi-line comment.
58    #[serde(rename = "original_start_line", deserialize_with = "Option::deserialize")]
59    pub original_start_line: Option<i32>,
60    /// The relative path of the file to which the comment applies.
61    #[serde(rename = "path")]
62    pub path: String,
63    /// The line index in the diff to which the comment applies.
64    #[serde(rename = "position", deserialize_with = "Option::deserialize")]
65    pub position: Option<i32>,
66    /// The ID of the pull request review to which the comment belongs.
67    #[serde(rename = "pull_request_review_id", deserialize_with = "Option::deserialize")]
68    pub pull_request_review_id: Option<i32>,
69    /// URL for the pull request that the review comment belongs to.
70    #[serde(rename = "pull_request_url")]
71    pub pull_request_url: String,
72    #[serde(rename = "reactions")]
73    pub reactions: Box<models::Reactions>,
74    /// The side of the first line of the range for a multi-line comment.
75    #[serde(rename = "side")]
76    pub side: Side,
77    /// The first line of the range for a multi-line comment.
78    #[serde(rename = "start_line", deserialize_with = "Option::deserialize")]
79    pub start_line: Option<i32>,
80    /// The side of the first line of the range for a multi-line comment.
81    #[serde(rename = "start_side", deserialize_with = "Option::deserialize")]
82    pub start_side: Option<StartSide>,
83    /// The level at which the comment is targeted, can be a diff line or a file.
84    #[serde(rename = "subject_type", skip_serializing_if = "Option::is_none")]
85    pub subject_type: Option<SubjectType>,
86    #[serde(rename = "updated_at")]
87    pub updated_at: String,
88    /// URL for the pull request review comment
89    #[serde(rename = "url")]
90    pub url: String,
91    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
92    pub user: Option<Box<models::User1>>,
93}
94
95impl PullRequestReviewComment1 {
96    /// The [comment](https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request) itself.
97    pub fn new(_links: models::WebhooksReviewCommentLinks, author_association: AuthorAssociation, body: String, commit_id: String, created_at: String, diff_hunk: String, html_url: String, id: i32, line: Option<i32>, node_id: String, original_commit_id: String, original_line: Option<i32>, original_position: i32, original_start_line: Option<i32>, path: String, position: Option<i32>, pull_request_review_id: Option<i32>, pull_request_url: String, reactions: models::Reactions, side: Side, start_line: Option<i32>, start_side: Option<StartSide>, updated_at: String, url: String, user: Option<models::User1>) -> PullRequestReviewComment1 {
98        PullRequestReviewComment1 {
99            _links: Box::new(_links),
100            author_association,
101            body,
102            commit_id,
103            created_at,
104            diff_hunk,
105            html_url,
106            id,
107            in_reply_to_id: None,
108            line,
109            node_id,
110            original_commit_id,
111            original_line,
112            original_position,
113            original_start_line,
114            path,
115            position,
116            pull_request_review_id,
117            pull_request_url,
118            reactions: Box::new(reactions),
119            side,
120            start_line,
121            start_side,
122            subject_type: None,
123            updated_at,
124            url,
125            user: user.map(Box::new),
126        }
127    }
128}
129/// How the author is associated with the repository.
130#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
131pub enum AuthorAssociation {
132    #[serde(rename = "COLLABORATOR")]
133    Collaborator,
134    #[serde(rename = "CONTRIBUTOR")]
135    Contributor,
136    #[serde(rename = "FIRST_TIMER")]
137    FirstTimer,
138    #[serde(rename = "FIRST_TIME_CONTRIBUTOR")]
139    FirstTimeContributor,
140    #[serde(rename = "MANNEQUIN")]
141    Mannequin,
142    #[serde(rename = "MEMBER")]
143    Member,
144    #[serde(rename = "NONE")]
145    None,
146    #[serde(rename = "OWNER")]
147    Owner,
148}
149
150impl Default for AuthorAssociation {
151    fn default() -> AuthorAssociation {
152        Self::Collaborator
153    }
154}
155/// The side of the first line of the range for a multi-line comment.
156#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
157pub enum Side {
158    #[serde(rename = "LEFT")]
159    Left,
160    #[serde(rename = "RIGHT")]
161    Right,
162}
163
164impl Default for Side {
165    fn default() -> Side {
166        Self::Left
167    }
168}
169/// The side of the first line of the range for a multi-line comment.
170#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
171pub enum StartSide {
172    #[serde(rename = "LEFT")]
173    Left,
174    #[serde(rename = "RIGHT")]
175    Right,
176}
177
178impl Default for StartSide {
179    fn default() -> StartSide {
180        Self::Left
181    }
182}
183/// The level at which the comment is targeted, can be a diff line or a file.
184#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
185pub enum SubjectType {
186    #[serde(rename = "line")]
187    Line,
188    #[serde(rename = "file")]
189    File,
190}
191
192impl Default for SubjectType {
193    fn default() -> SubjectType {
194        Self::Line
195    }
196}
197