use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookStatus {
#[serde(rename = "avatar_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub avatar_url: Option<Option<String>>,
#[serde(rename = "branches")]
pub branches: Vec<models::WebhookStatusBranchesInner>,
#[serde(rename = "commit")]
pub commit: Box<models::WebhookStatusCommit>,
#[serde(rename = "context")]
pub context: String,
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "description", deserialize_with = "Option::deserialize")]
pub description: Option<String>,
#[serde(rename = "enterprise", skip_serializing_if = "Option::is_none")]
pub enterprise: Option<Box<models::EnterpriseWebhooks>>,
#[serde(rename = "id")]
pub id: i32,
#[serde(rename = "installation", skip_serializing_if = "Option::is_none")]
pub installation: Option<Box<models::SimpleInstallation>>,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "organization", skip_serializing_if = "Option::is_none")]
pub organization: Option<Box<models::OrganizationSimpleWebhooks>>,
#[serde(rename = "repository")]
pub repository: Box<models::RepositoryWebhooks>,
#[serde(rename = "sender")]
pub sender: Box<models::SimpleUserWebhooks>,
#[serde(rename = "sha")]
pub sha: String,
#[serde(rename = "state")]
pub state: State,
#[serde(rename = "target_url", deserialize_with = "Option::deserialize")]
pub target_url: Option<String>,
#[serde(rename = "updated_at")]
pub updated_at: String,
}
impl WebhookStatus {
pub fn new(branches: Vec<models::WebhookStatusBranchesInner>, commit: models::WebhookStatusCommit, context: String, created_at: String, description: Option<String>, id: i32, name: String, repository: models::RepositoryWebhooks, sender: models::SimpleUserWebhooks, sha: String, state: State, target_url: Option<String>, updated_at: String) -> WebhookStatus {
WebhookStatus {
avatar_url: None,
branches,
commit: Box::new(commit),
context,
created_at,
description,
enterprise: None,
id,
installation: None,
name,
organization: None,
repository: Box::new(repository),
sender: Box::new(sender),
sha,
state,
target_url,
updated_at,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum State {
#[serde(rename = "pending")]
Pending,
#[serde(rename = "success")]
Success,
#[serde(rename = "failure")]
Failure,
#[serde(rename = "error")]
Error,
}
impl Default for State {
fn default() -> State {
Self::Pending
}
}