/*
* 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};
/// DependabotAlertWithRepository : A Dependabot alert.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DependabotAlertWithRepository {
/// The security alert number.
#[serde(rename = "number")]
pub number: i32,
/// The state of the Dependabot alert.
#[serde(rename = "state")]
pub state: State,
#[serde(rename = "dependency")]
pub dependency: Box<models::DependabotAlertWithRepositoryDependency>,
#[serde(rename = "security_advisory")]
pub security_advisory: Box<models::DependabotAlertSecurityAdvisory>,
#[serde(rename = "security_vulnerability")]
pub security_vulnerability: Box<models::DependabotAlertSecurityVulnerability>,
/// The REST API URL of the alert resource.
#[serde(rename = "url")]
pub url: String,
/// The GitHub URL of the alert resource.
#[serde(rename = "html_url")]
pub html_url: String,
/// The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
#[serde(rename = "created_at")]
pub created_at: String,
/// The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
#[serde(rename = "updated_at")]
pub updated_at: String,
/// The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
#[serde(rename = "dismissed_at", deserialize_with = "Option::deserialize")]
pub dismissed_at: Option<String>,
#[serde(rename = "dismissed_by", deserialize_with = "Option::deserialize")]
pub dismissed_by: Option<Box<models::NullableSimpleUser>>,
/// The reason that the alert was dismissed.
#[serde(rename = "dismissed_reason", deserialize_with = "Option::deserialize")]
pub dismissed_reason: Option<DismissedReason>,
/// An optional comment associated with the alert's dismissal.
#[serde(rename = "dismissed_comment", deserialize_with = "Option::deserialize")]
pub dismissed_comment: Option<String>,
/// The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
#[serde(rename = "fixed_at", deserialize_with = "Option::deserialize")]
pub fixed_at: Option<String>,
/// The time that the alert was auto-dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
#[serde(rename = "auto_dismissed_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub auto_dismissed_at: Option<Option<String>>,
#[serde(rename = "repository")]
pub repository: Box<models::SimpleRepository>,
}
impl DependabotAlertWithRepository {
/// A Dependabot alert.
pub fn new(number: i32, state: State, dependency: models::DependabotAlertWithRepositoryDependency, security_advisory: models::DependabotAlertSecurityAdvisory, security_vulnerability: models::DependabotAlertSecurityVulnerability, url: String, html_url: String, created_at: String, updated_at: String, dismissed_at: Option<String>, dismissed_by: Option<models::NullableSimpleUser>, dismissed_reason: Option<DismissedReason>, dismissed_comment: Option<String>, fixed_at: Option<String>, repository: models::SimpleRepository) -> DependabotAlertWithRepository {
DependabotAlertWithRepository {
number,
state,
dependency: Box::new(dependency),
security_advisory: Box::new(security_advisory),
security_vulnerability: Box::new(security_vulnerability),
url,
html_url,
created_at,
updated_at,
dismissed_at,
dismissed_by: dismissed_by.map(Box::new),
dismissed_reason,
dismissed_comment,
fixed_at,
auto_dismissed_at: None,
repository: Box::new(repository),
}
}
}
/// The state of the Dependabot alert.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum State {
#[serde(rename = "auto_dismissed")]
AutoDismissed,
#[serde(rename = "dismissed")]
Dismissed,
#[serde(rename = "fixed")]
Fixed,
#[serde(rename = "open")]
Open,
}
impl Default for State {
fn default() -> State {
Self::AutoDismissed
}
}
/// The reason that the alert was dismissed.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DismissedReason {
#[serde(rename = "fix_started")]
FixStarted,
#[serde(rename = "inaccurate")]
Inaccurate,
#[serde(rename = "no_bandwidth")]
NoBandwidth,
#[serde(rename = "not_used")]
NotUsed,
#[serde(rename = "tolerable_risk")]
TolerableRisk,
}
impl Default for DismissedReason {
fn default() -> DismissedReason {
Self::FixStarted
}
}