openapi_github/models/
review_comment.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/// ReviewComment : Legacy Review Comment
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ReviewComment {
17    #[serde(rename = "url")]
18    pub url: String,
19    #[serde(rename = "pull_request_review_id", deserialize_with = "Option::deserialize")]
20    pub pull_request_review_id: Option<i32>,
21    #[serde(rename = "id")]
22    pub id: i32,
23    #[serde(rename = "node_id")]
24    pub node_id: String,
25    #[serde(rename = "diff_hunk")]
26    pub diff_hunk: String,
27    #[serde(rename = "path")]
28    pub path: String,
29    #[serde(rename = "position", deserialize_with = "Option::deserialize")]
30    pub position: Option<i32>,
31    #[serde(rename = "original_position")]
32    pub original_position: i32,
33    #[serde(rename = "commit_id")]
34    pub commit_id: String,
35    #[serde(rename = "original_commit_id")]
36    pub original_commit_id: String,
37    #[serde(rename = "in_reply_to_id", skip_serializing_if = "Option::is_none")]
38    pub in_reply_to_id: Option<i32>,
39    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
40    pub user: Option<Box<models::NullableSimpleUser>>,
41    #[serde(rename = "body")]
42    pub body: String,
43    #[serde(rename = "created_at")]
44    pub created_at: String,
45    #[serde(rename = "updated_at")]
46    pub updated_at: String,
47    #[serde(rename = "html_url")]
48    pub html_url: String,
49    #[serde(rename = "pull_request_url")]
50    pub pull_request_url: String,
51    #[serde(rename = "author_association")]
52    pub author_association: models::AuthorAssociation,
53    #[serde(rename = "_links")]
54    pub _links: Box<models::ReviewCommentLinks>,
55    #[serde(rename = "body_text", skip_serializing_if = "Option::is_none")]
56    pub body_text: Option<String>,
57    #[serde(rename = "body_html", skip_serializing_if = "Option::is_none")]
58    pub body_html: Option<String>,
59    #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
60    pub reactions: Option<Box<models::ReactionRollup>>,
61    /// The side of the first line of the range for a multi-line comment.
62    #[serde(rename = "side", skip_serializing_if = "Option::is_none")]
63    pub side: Option<Side>,
64    /// The side of the first line of the range for a multi-line comment.
65    #[serde(rename = "start_side", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
66    pub start_side: Option<Option<StartSide>>,
67    /// The line of the blob to which the comment applies. The last line of the range for a multi-line comment
68    #[serde(rename = "line", skip_serializing_if = "Option::is_none")]
69    pub line: Option<i32>,
70    /// The original line of the blob to which the comment applies. The last line of the range for a multi-line comment
71    #[serde(rename = "original_line", skip_serializing_if = "Option::is_none")]
72    pub original_line: Option<i32>,
73    /// The first line of the range for a multi-line comment.
74    #[serde(rename = "start_line", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
75    pub start_line: Option<Option<i32>>,
76    /// The original first line of the range for a multi-line comment.
77    #[serde(rename = "original_start_line", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
78    pub original_start_line: Option<Option<i32>>,
79}
80
81impl ReviewComment {
82    /// Legacy Review Comment
83    pub fn new(url: String, pull_request_review_id: Option<i32>, id: i32, node_id: String, diff_hunk: String, path: String, position: Option<i32>, original_position: i32, commit_id: String, original_commit_id: String, user: Option<models::NullableSimpleUser>, body: String, created_at: String, updated_at: String, html_url: String, pull_request_url: String, author_association: models::AuthorAssociation, _links: models::ReviewCommentLinks) -> ReviewComment {
84        ReviewComment {
85            url,
86            pull_request_review_id,
87            id,
88            node_id,
89            diff_hunk,
90            path,
91            position,
92            original_position,
93            commit_id,
94            original_commit_id,
95            in_reply_to_id: None,
96            user: user.map(Box::new),
97            body,
98            created_at,
99            updated_at,
100            html_url,
101            pull_request_url,
102            author_association,
103            _links: Box::new(_links),
104            body_text: None,
105            body_html: None,
106            reactions: None,
107            side: None,
108            start_side: None,
109            line: None,
110            original_line: None,
111            start_line: None,
112            original_start_line: None,
113        }
114    }
115}
116/// The side of the first line of the range for a multi-line comment.
117#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
118pub enum Side {
119    #[serde(rename = "LEFT")]
120    Left,
121    #[serde(rename = "RIGHT")]
122    Right,
123}
124
125impl Default for Side {
126    fn default() -> Side {
127        Self::Left
128    }
129}
130/// The side of the first line of the range for a multi-line comment.
131#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
132pub enum StartSide {
133    #[serde(rename = "LEFT")]
134    Left,
135    #[serde(rename = "RIGHT")]
136    Right,
137}
138
139impl Default for StartSide {
140    fn default() -> StartSide {
141        Self::Left
142    }
143}
144