openapi_github/models/
reaction.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/// Reaction : Reactions to conversations provide a way to help people express their feelings more simply and effectively.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Reaction {
17    #[serde(rename = "id")]
18    pub id: i32,
19    #[serde(rename = "node_id")]
20    pub node_id: String,
21    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
22    pub user: Option<Box<models::NullableSimpleUser>>,
23    /// The reaction to use
24    #[serde(rename = "content")]
25    pub content: Content,
26    #[serde(rename = "created_at")]
27    pub created_at: String,
28}
29
30impl Reaction {
31    /// Reactions to conversations provide a way to help people express their feelings more simply and effectively.
32    pub fn new(id: i32, node_id: String, user: Option<models::NullableSimpleUser>, content: Content, created_at: String) -> Reaction {
33        Reaction {
34            id,
35            node_id,
36            user: user.map(Box::new),
37            content,
38            created_at,
39        }
40    }
41}
42/// The reaction to use
43#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
44pub enum Content {
45    #[serde(rename = "+1")]
46    Plus1,
47    #[serde(rename = "-1")]
48    Variant1,
49    #[serde(rename = "laugh")]
50    Laugh,
51    #[serde(rename = "confused")]
52    Confused,
53    #[serde(rename = "heart")]
54    Heart,
55    #[serde(rename = "hooray")]
56    Hooray,
57    #[serde(rename = "rocket")]
58    Rocket,
59    #[serde(rename = "eyes")]
60    Eyes,
61}
62
63impl Default for Content {
64    fn default() -> Content {
65        Self::Plus1
66    }
67}
68