openapi_github/models/
activity.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/// Activity : Activity
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Activity {
17    #[serde(rename = "id")]
18    pub id: i32,
19    #[serde(rename = "node_id")]
20    pub node_id: String,
21    /// The SHA of the commit before the activity.
22    #[serde(rename = "before")]
23    pub before: String,
24    /// The SHA of the commit after the activity.
25    #[serde(rename = "after")]
26    pub after: String,
27    /// The full Git reference, formatted as `refs/heads/<branch name>`.
28    #[serde(rename = "ref")]
29    pub r#ref: String,
30    /// The time when the activity occurred.
31    #[serde(rename = "timestamp")]
32    pub timestamp: String,
33    /// The type of the activity that was performed.
34    #[serde(rename = "activity_type")]
35    pub activity_type: ActivityType,
36    #[serde(rename = "actor", deserialize_with = "Option::deserialize")]
37    pub actor: Option<Box<models::NullableSimpleUser>>,
38}
39
40impl Activity {
41    /// Activity
42    pub fn new(id: i32, node_id: String, before: String, after: String, r#ref: String, timestamp: String, activity_type: ActivityType, actor: Option<models::NullableSimpleUser>) -> Activity {
43        Activity {
44            id,
45            node_id,
46            before,
47            after,
48            r#ref,
49            timestamp,
50            activity_type,
51            actor: actor.map(Box::new),
52        }
53    }
54}
55/// The type of the activity that was performed.
56#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
57pub enum ActivityType {
58    #[serde(rename = "push")]
59    Push,
60    #[serde(rename = "force_push")]
61    ForcePush,
62    #[serde(rename = "branch_deletion")]
63    BranchDeletion,
64    #[serde(rename = "branch_creation")]
65    BranchCreation,
66    #[serde(rename = "pr_merge")]
67    PrMerge,
68    #[serde(rename = "merge_queue_merge")]
69    MergeQueueMerge,
70}
71
72impl Default for ActivityType {
73    fn default() -> ActivityType {
74        Self::Push
75    }
76}
77