openapi-github 0.1.0

OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
Documentation
/*
 * 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};

/// Job : Information of a job execution in a workflow run
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Job {
    /// The id of the job.
    #[serde(rename = "id")]
    pub id: i32,
    /// The id of the associated workflow run.
    #[serde(rename = "run_id")]
    pub run_id: i32,
    #[serde(rename = "run_url")]
    pub run_url: String,
    /// Attempt number of the associated workflow run, 1 for first attempt and higher if the workflow was re-run.
    #[serde(rename = "run_attempt", skip_serializing_if = "Option::is_none")]
    pub run_attempt: Option<i32>,
    #[serde(rename = "node_id")]
    pub node_id: String,
    /// The SHA of the commit that is being run.
    #[serde(rename = "head_sha")]
    pub head_sha: String,
    #[serde(rename = "url")]
    pub url: String,
    #[serde(rename = "html_url", deserialize_with = "Option::deserialize")]
    pub html_url: Option<String>,
    /// The phase of the lifecycle that the job is currently in.
    #[serde(rename = "status")]
    pub status: Status,
    /// The outcome of the job.
    #[serde(rename = "conclusion", deserialize_with = "Option::deserialize")]
    pub conclusion: Option<Conclusion>,
    /// The time that the job created, in ISO 8601 format.
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// The time that the job started, in ISO 8601 format.
    #[serde(rename = "started_at")]
    pub started_at: String,
    /// The time that the job finished, in ISO 8601 format.
    #[serde(rename = "completed_at", deserialize_with = "Option::deserialize")]
    pub completed_at: Option<String>,
    /// The name of the job.
    #[serde(rename = "name")]
    pub name: String,
    /// Steps in this job.
    #[serde(rename = "steps", skip_serializing_if = "Option::is_none")]
    pub steps: Option<Vec<models::JobStepsInner>>,
    #[serde(rename = "check_run_url")]
    pub check_run_url: String,
    /// Labels for the workflow job. Specified by the \"runs_on\" attribute in the action's workflow file.
    #[serde(rename = "labels")]
    pub labels: Vec<String>,
    /// The ID of the runner to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.)
    #[serde(rename = "runner_id", deserialize_with = "Option::deserialize")]
    pub runner_id: Option<i32>,
    /// The name of the runner to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.)
    #[serde(rename = "runner_name", deserialize_with = "Option::deserialize")]
    pub runner_name: Option<String>,
    /// The ID of the runner group to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.)
    #[serde(rename = "runner_group_id", deserialize_with = "Option::deserialize")]
    pub runner_group_id: Option<i32>,
    /// The name of the runner group to which this job has been assigned. (If a runner hasn't yet been assigned, this will be null.)
    #[serde(rename = "runner_group_name", deserialize_with = "Option::deserialize")]
    pub runner_group_name: Option<String>,
    /// The name of the workflow.
    #[serde(rename = "workflow_name", deserialize_with = "Option::deserialize")]
    pub workflow_name: Option<String>,
    /// The name of the current branch.
    #[serde(rename = "head_branch", deserialize_with = "Option::deserialize")]
    pub head_branch: Option<String>,
}

impl Job {
    /// Information of a job execution in a workflow run
    pub fn new(id: i32, run_id: i32, run_url: String, node_id: String, head_sha: String, url: String, html_url: Option<String>, status: Status, conclusion: Option<Conclusion>, created_at: String, started_at: String, completed_at: Option<String>, name: String, check_run_url: String, labels: Vec<String>, runner_id: Option<i32>, runner_name: Option<String>, runner_group_id: Option<i32>, runner_group_name: Option<String>, workflow_name: Option<String>, head_branch: Option<String>) -> Job {
        Job {
            id,
            run_id,
            run_url,
            run_attempt: None,
            node_id,
            head_sha,
            url,
            html_url,
            status,
            conclusion,
            created_at,
            started_at,
            completed_at,
            name,
            steps: None,
            check_run_url,
            labels,
            runner_id,
            runner_name,
            runner_group_id,
            runner_group_name,
            workflow_name,
            head_branch,
        }
    }
}
/// The phase of the lifecycle that the job is currently in.
#[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,
    #[serde(rename = "waiting")]
    Waiting,
    #[serde(rename = "requested")]
    Requested,
    #[serde(rename = "pending")]
    Pending,
}

impl Default for Status {
    fn default() -> Status {
        Self::Queued
    }
}
/// The outcome of the job.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Conclusion {
    #[serde(rename = "success")]
    Success,
    #[serde(rename = "failure")]
    Failure,
    #[serde(rename = "neutral")]
    Neutral,
    #[serde(rename = "cancelled")]
    Cancelled,
    #[serde(rename = "skipped")]
    Skipped,
    #[serde(rename = "timed_out")]
    TimedOut,
    #[serde(rename = "action_required")]
    ActionRequired,
}

impl Default for Conclusion {
    fn default() -> Conclusion {
        Self::Success
    }
}