openapi_github/models/
check_run.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/// CheckRun : A check performed on the code of a given code change
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CheckRun {
17    /// The id of the check.
18    #[serde(rename = "id")]
19    pub id: i32,
20    /// The SHA of the commit that is being checked.
21    #[serde(rename = "head_sha")]
22    pub head_sha: String,
23    #[serde(rename = "node_id")]
24    pub node_id: String,
25    #[serde(rename = "external_id", deserialize_with = "Option::deserialize")]
26    pub external_id: Option<String>,
27    #[serde(rename = "url")]
28    pub url: String,
29    #[serde(rename = "html_url", deserialize_with = "Option::deserialize")]
30    pub html_url: Option<String>,
31    #[serde(rename = "details_url", deserialize_with = "Option::deserialize")]
32    pub details_url: Option<String>,
33    /// The phase of the lifecycle that the check is currently in. Statuses of waiting, requested, and pending are reserved for GitHub Actions check runs.
34    #[serde(rename = "status")]
35    pub status: Status,
36    #[serde(rename = "conclusion", deserialize_with = "Option::deserialize")]
37    pub conclusion: Option<Conclusion>,
38    #[serde(rename = "started_at", deserialize_with = "Option::deserialize")]
39    pub started_at: Option<String>,
40    #[serde(rename = "completed_at", deserialize_with = "Option::deserialize")]
41    pub completed_at: Option<String>,
42    #[serde(rename = "output")]
43    pub output: Box<models::CheckRunOutput>,
44    /// The name of the check.
45    #[serde(rename = "name")]
46    pub name: String,
47    #[serde(rename = "check_suite", deserialize_with = "Option::deserialize")]
48    pub check_suite: Option<Box<models::CheckRunCheckSuite>>,
49    #[serde(rename = "app", deserialize_with = "Option::deserialize")]
50    pub app: Option<Box<models::NullableIntegration>>,
51    /// Pull requests that are open with a `head_sha` or `head_branch` that matches the check. The returned pull requests do not necessarily indicate pull requests that triggered the check.
52    #[serde(rename = "pull_requests")]
53    pub pull_requests: Vec<models::PullRequestMinimal>,
54    #[serde(rename = "deployment", skip_serializing_if = "Option::is_none")]
55    pub deployment: Option<Box<models::DeploymentSimple>>,
56}
57
58impl CheckRun {
59    /// A check performed on the code of a given code change
60    pub fn new(id: i32, head_sha: String, node_id: String, external_id: Option<String>, url: String, html_url: Option<String>, details_url: Option<String>, status: Status, conclusion: Option<Conclusion>, started_at: Option<String>, completed_at: Option<String>, output: models::CheckRunOutput, name: String, check_suite: Option<models::CheckRunCheckSuite>, app: Option<models::NullableIntegration>, pull_requests: Vec<models::PullRequestMinimal>) -> CheckRun {
61        CheckRun {
62            id,
63            head_sha,
64            node_id,
65            external_id,
66            url,
67            html_url,
68            details_url,
69            status,
70            conclusion,
71            started_at,
72            completed_at,
73            output: Box::new(output),
74            name,
75            check_suite: check_suite.map(Box::new),
76            app: app.map(Box::new),
77            pull_requests,
78            deployment: None,
79        }
80    }
81}
82/// The phase of the lifecycle that the check is currently in. Statuses of waiting, requested, and pending are reserved for GitHub Actions check runs.
83#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
84pub enum Status {
85    #[serde(rename = "queued")]
86    Queued,
87    #[serde(rename = "in_progress")]
88    InProgress,
89    #[serde(rename = "completed")]
90    Completed,
91    #[serde(rename = "waiting")]
92    Waiting,
93    #[serde(rename = "requested")]
94    Requested,
95    #[serde(rename = "pending")]
96    Pending,
97}
98
99impl Default for Status {
100    fn default() -> Status {
101        Self::Queued
102    }
103}
104/// 
105#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
106pub enum Conclusion {
107    #[serde(rename = "success")]
108    Success,
109    #[serde(rename = "failure")]
110    Failure,
111    #[serde(rename = "neutral")]
112    Neutral,
113    #[serde(rename = "cancelled")]
114    Cancelled,
115    #[serde(rename = "skipped")]
116    Skipped,
117    #[serde(rename = "timed_out")]
118    TimedOut,
119    #[serde(rename = "action_required")]
120    ActionRequired,
121}
122
123impl Default for Conclusion {
124    fn default() -> Conclusion {
125        Self::Success
126    }
127}
128