openapi_github/models/checks_create_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 ChecksCreateRequest {
16 /// The name of the check. For example, \"code-coverage\".
17 #[serde(rename = "name")]
18 pub name: String,
19 /// The SHA of the commit.
20 #[serde(rename = "head_sha")]
21 pub head_sha: String,
22 /// The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used.
23 #[serde(rename = "details_url", skip_serializing_if = "Option::is_none")]
24 pub details_url: Option<String>,
25 /// A reference for the run on the integrator's system.
26 #[serde(rename = "external_id", skip_serializing_if = "Option::is_none")]
27 pub external_id: Option<String>,
28 /// The current status.
29 #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
30 pub status: Option<Status>,
31 /// The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
32 #[serde(rename = "started_at", skip_serializing_if = "Option::is_none")]
33 pub started_at: Option<String>,
34 /// **Required if you provide `completed_at` or a `status` of `completed`**. The final conclusion of the check. **Note:** Providing `conclusion` will automatically set the `status` parameter to `completed`. You cannot change a check run conclusion to `stale`, only GitHub can set this.
35 #[serde(rename = "conclusion", skip_serializing_if = "Option::is_none")]
36 pub conclusion: Option<Conclusion>,
37 /// The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
38 #[serde(rename = "completed_at", skip_serializing_if = "Option::is_none")]
39 pub completed_at: Option<String>,
40 #[serde(rename = "output", skip_serializing_if = "Option::is_none")]
41 pub output: Option<Box<models::ChecksCreateRequestOutput>>,
42 /// Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the [`check_run.requested_action` webhook](https://docs.github.com/webhooks/event-payloads/#check_run) to your app. Each action includes a `label`, `identifier` and `description`. A maximum of three actions are accepted. To learn more about check runs and requested actions, see \"[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions).\"
43 #[serde(rename = "actions", skip_serializing_if = "Option::is_none")]
44 pub actions: Option<Vec<models::ChecksCreateRequestActionsInner>>,
45}
46
47impl ChecksCreateRequest {
48 pub fn new(name: String, head_sha: String) -> ChecksCreateRequest {
49 ChecksCreateRequest {
50 name,
51 head_sha,
52 details_url: None,
53 external_id: None,
54 status: None,
55 started_at: None,
56 conclusion: None,
57 completed_at: None,
58 output: None,
59 actions: None,
60 }
61 }
62}
63/// The current status.
64#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
65pub enum Status {
66 #[serde(rename = "queued")]
67 Queued,
68 #[serde(rename = "in_progress")]
69 InProgress,
70 #[serde(rename = "completed")]
71 Completed,
72}
73
74impl Default for Status {
75 fn default() -> Status {
76 Self::Queued
77 }
78}
79/// **Required if you provide `completed_at` or a `status` of `completed`**. The final conclusion of the check. **Note:** Providing `conclusion` will automatically set the `status` parameter to `completed`. You cannot change a check run conclusion to `stale`, only GitHub can set this.
80#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
81pub enum Conclusion {
82 #[serde(rename = "action_required")]
83 ActionRequired,
84 #[serde(rename = "cancelled")]
85 Cancelled,
86 #[serde(rename = "failure")]
87 Failure,
88 #[serde(rename = "neutral")]
89 Neutral,
90 #[serde(rename = "success")]
91 Success,
92 #[serde(rename = "skipped")]
93 Skipped,
94 #[serde(rename = "stale")]
95 Stale,
96 #[serde(rename = "timed_out")]
97 TimedOut,
98}
99
100impl Default for Conclusion {
101 fn default() -> Conclusion {
102 Self::ActionRequired
103 }
104}
105