openapi_github/models/
webhook_commit_comment_created_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/// WebhookCommitCommentCreatedComment : The [commit comment](https://docs.github.com/rest/commits/comments#get-a-commit-comment) resource.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct WebhookCommitCommentCreatedComment {
17    /// How the author is associated with the repository.
18    #[serde(rename = "author_association")]
19    pub author_association: AuthorAssociation,
20    /// The text of the comment.
21    #[serde(rename = "body")]
22    pub body: String,
23    /// The SHA of the commit to which the comment applies.
24    #[serde(rename = "commit_id")]
25    pub commit_id: String,
26    #[serde(rename = "created_at")]
27    pub created_at: String,
28    #[serde(rename = "html_url")]
29    pub html_url: String,
30    /// The ID of the commit comment.
31    #[serde(rename = "id")]
32    pub id: i32,
33    /// The line of the blob to which the comment applies. The last line of the range for a multi-line comment
34    #[serde(rename = "line", deserialize_with = "Option::deserialize")]
35    pub line: Option<i32>,
36    /// The node ID of the commit comment.
37    #[serde(rename = "node_id")]
38    pub node_id: String,
39    /// The relative path of the file to which the comment applies.
40    #[serde(rename = "path", deserialize_with = "Option::deserialize")]
41    pub path: Option<String>,
42    /// The line index in the diff to which the comment applies.
43    #[serde(rename = "position", deserialize_with = "Option::deserialize")]
44    pub position: Option<i32>,
45    #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
46    pub reactions: Option<Box<models::Reactions>>,
47    #[serde(rename = "updated_at")]
48    pub updated_at: String,
49    #[serde(rename = "url")]
50    pub url: String,
51    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
52    pub user: Option<Box<models::User>>,
53}
54
55impl WebhookCommitCommentCreatedComment {
56    /// The [commit comment](https://docs.github.com/rest/commits/comments#get-a-commit-comment) resource.
57    pub fn new(author_association: AuthorAssociation, body: String, commit_id: String, created_at: String, html_url: String, id: i32, line: Option<i32>, node_id: String, path: Option<String>, position: Option<i32>, updated_at: String, url: String, user: Option<models::User>) -> WebhookCommitCommentCreatedComment {
58        WebhookCommitCommentCreatedComment {
59            author_association,
60            body,
61            commit_id,
62            created_at,
63            html_url,
64            id,
65            line,
66            node_id,
67            path,
68            position,
69            reactions: None,
70            updated_at,
71            url,
72            user: user.map(Box::new),
73        }
74    }
75}
76/// How the author is associated with the repository.
77#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
78pub enum AuthorAssociation {
79    #[serde(rename = "COLLABORATOR")]
80    Collaborator,
81    #[serde(rename = "CONTRIBUTOR")]
82    Contributor,
83    #[serde(rename = "FIRST_TIMER")]
84    FirstTimer,
85    #[serde(rename = "FIRST_TIME_CONTRIBUTOR")]
86    FirstTimeContributor,
87    #[serde(rename = "MANNEQUIN")]
88    Mannequin,
89    #[serde(rename = "MEMBER")]
90    Member,
91    #[serde(rename = "NONE")]
92    None,
93    #[serde(rename = "OWNER")]
94    Owner,
95}
96
97impl Default for AuthorAssociation {
98    fn default() -> AuthorAssociation {
99        Self::Collaborator
100    }
101}
102