/*
* GitHub's official OpenAPI spec + Octokit extension
*
* OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
*
* The version of the OpenAPI document: 16.6.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ChecksCreateRequest {
/// The name of the check. For example, \"code-coverage\".
#[serde(rename = "name")]
pub name: String,
/// The SHA of the commit.
#[serde(rename = "head_sha")]
pub head_sha: String,
/// 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.
#[serde(rename = "details_url", skip_serializing_if = "Option::is_none")]
pub details_url: Option<String>,
/// A reference for the run on the integrator's system.
#[serde(rename = "external_id", skip_serializing_if = "Option::is_none")]
pub external_id: Option<String>,
/// The current status.
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<Status>,
/// 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`.
#[serde(rename = "started_at", skip_serializing_if = "Option::is_none")]
pub started_at: Option<String>,
/// **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.
#[serde(rename = "conclusion", skip_serializing_if = "Option::is_none")]
pub conclusion: Option<Conclusion>,
/// 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`.
#[serde(rename = "completed_at", skip_serializing_if = "Option::is_none")]
pub completed_at: Option<String>,
#[serde(rename = "output", skip_serializing_if = "Option::is_none")]
pub output: Option<Box<models::ChecksCreateRequestOutput>>,
/// 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).\"
#[serde(rename = "actions", skip_serializing_if = "Option::is_none")]
pub actions: Option<Vec<models::ChecksCreateRequestActionsInner>>,
}
impl ChecksCreateRequest {
pub fn new(name: String, head_sha: String) -> ChecksCreateRequest {
ChecksCreateRequest {
name,
head_sha,
details_url: None,
external_id: None,
status: None,
started_at: None,
conclusion: None,
completed_at: None,
output: None,
actions: None,
}
}
}
/// The current status.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "queued")]
Queued,
#[serde(rename = "in_progress")]
InProgress,
#[serde(rename = "completed")]
Completed,
}
impl Default for Status {
fn default() -> Status {
Self::Queued
}
}
/// **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.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Conclusion {
#[serde(rename = "action_required")]
ActionRequired,
#[serde(rename = "cancelled")]
Cancelled,
#[serde(rename = "failure")]
Failure,
#[serde(rename = "neutral")]
Neutral,
#[serde(rename = "success")]
Success,
#[serde(rename = "skipped")]
Skipped,
#[serde(rename = "stale")]
Stale,
#[serde(rename = "timed_out")]
TimedOut,
}
impl Default for Conclusion {
fn default() -> Conclusion {
Self::ActionRequired
}
}