openapi_github/models/
pulls_create_review_comment_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 PullsCreateReviewCommentRequest {
16    /// The text of the review comment.
17    #[serde(rename = "body")]
18    pub body: String,
19    /// The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the `position`.
20    #[serde(rename = "commit_id")]
21    pub commit_id: String,
22    /// The relative path to the file that necessitates a comment.
23    #[serde(rename = "path")]
24    pub path: String,
25    /// **This parameter is deprecated. Use `line` instead**. The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. The position value equals the number of lines down from the first \"@@\" hunk header in the file you want to add a comment. The line just below the \"@@\" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file.
26    #[serde(rename = "position", skip_serializing_if = "Option::is_none")]
27    pub position: Option<i32>,
28    /// In a split diff view, the side of the diff that the pull request's changes appear on. Can be `LEFT` or `RIGHT`. Use `LEFT` for deletions that appear in red. Use `RIGHT` for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see \"[Diff view options](https://docs.github.com/articles/about-comparing-branches-in-pull-requests#diff-view-options)\" in the GitHub Help documentation.
29    #[serde(rename = "side", skip_serializing_if = "Option::is_none")]
30    pub side: Option<Side>,
31    /// **Required unless using `subject_type:file`**. The line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to.
32    #[serde(rename = "line", skip_serializing_if = "Option::is_none")]
33    pub line: Option<i32>,
34    /// **Required when using multi-line comments unless using `in_reply_to`**. The `start_line` is the first line in the pull request diff that your multi-line comment applies to. To learn more about multi-line comments, see \"[Commenting on a pull request](https://docs.github.com/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)\" in the GitHub Help documentation.
35    #[serde(rename = "start_line", skip_serializing_if = "Option::is_none")]
36    pub start_line: Option<i32>,
37    /// **Required when using multi-line comments unless using `in_reply_to`**. The `start_side` is the starting side of the diff that the comment applies to. Can be `LEFT` or `RIGHT`. To learn more about multi-line comments, see \"[Commenting on a pull request](https://docs.github.com/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)\" in the GitHub Help documentation. See `side` in this table for additional context.
38    #[serde(rename = "start_side", skip_serializing_if = "Option::is_none")]
39    pub start_side: Option<StartSide>,
40    /// The ID of the review comment to reply to. To find the ID of a review comment with [\"List review comments on a pull request\"](#list-review-comments-on-a-pull-request). When specified, all parameters other than `body` in the request body are ignored.
41    #[serde(rename = "in_reply_to", skip_serializing_if = "Option::is_none")]
42    pub in_reply_to: Option<i32>,
43    /// The level at which the comment is targeted.
44    #[serde(rename = "subject_type", skip_serializing_if = "Option::is_none")]
45    pub subject_type: Option<SubjectType>,
46}
47
48impl PullsCreateReviewCommentRequest {
49    pub fn new(body: String, commit_id: String, path: String) -> PullsCreateReviewCommentRequest {
50        PullsCreateReviewCommentRequest {
51            body,
52            commit_id,
53            path,
54            position: None,
55            side: None,
56            line: None,
57            start_line: None,
58            start_side: None,
59            in_reply_to: None,
60            subject_type: None,
61        }
62    }
63}
64/// In a split diff view, the side of the diff that the pull request's changes appear on. Can be `LEFT` or `RIGHT`. Use `LEFT` for deletions that appear in red. Use `RIGHT` for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see \"[Diff view options](https://docs.github.com/articles/about-comparing-branches-in-pull-requests#diff-view-options)\" in the GitHub Help documentation.
65#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
66pub enum Side {
67    #[serde(rename = "LEFT")]
68    Left,
69    #[serde(rename = "RIGHT")]
70    Right,
71}
72
73impl Default for Side {
74    fn default() -> Side {
75        Self::Left
76    }
77}
78/// **Required when using multi-line comments unless using `in_reply_to`**. The `start_side` is the starting side of the diff that the comment applies to. Can be `LEFT` or `RIGHT`. To learn more about multi-line comments, see \"[Commenting on a pull request](https://docs.github.com/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)\" in the GitHub Help documentation. See `side` in this table for additional context.
79#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
80pub enum StartSide {
81    #[serde(rename = "LEFT")]
82    Left,
83    #[serde(rename = "RIGHT")]
84    Right,
85    #[serde(rename = "side")]
86    Side,
87}
88
89impl Default for StartSide {
90    fn default() -> StartSide {
91        Self::Left
92    }
93}
94/// The level at which the comment is targeted.
95#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
96pub enum SubjectType {
97    #[serde(rename = "line")]
98    Line,
99    #[serde(rename = "file")]
100    File,
101}
102
103impl Default for SubjectType {
104    fn default() -> SubjectType {
105        Self::Line
106    }
107}
108