openapi_github/models/
dependabot_alert_with_repository.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/// DependabotAlertWithRepository : A Dependabot alert.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DependabotAlertWithRepository {
17    /// The security alert number.
18    #[serde(rename = "number")]
19    pub number: i32,
20    /// The state of the Dependabot alert.
21    #[serde(rename = "state")]
22    pub state: State,
23    #[serde(rename = "dependency")]
24    pub dependency: Box<models::DependabotAlertWithRepositoryDependency>,
25    #[serde(rename = "security_advisory")]
26    pub security_advisory: Box<models::DependabotAlertSecurityAdvisory>,
27    #[serde(rename = "security_vulnerability")]
28    pub security_vulnerability: Box<models::DependabotAlertSecurityVulnerability>,
29    /// The REST API URL of the alert resource.
30    #[serde(rename = "url")]
31    pub url: String,
32    /// The GitHub URL of the alert resource.
33    #[serde(rename = "html_url")]
34    pub html_url: String,
35    /// The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
36    #[serde(rename = "created_at")]
37    pub created_at: String,
38    /// The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
39    #[serde(rename = "updated_at")]
40    pub updated_at: String,
41    /// The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
42    #[serde(rename = "dismissed_at", deserialize_with = "Option::deserialize")]
43    pub dismissed_at: Option<String>,
44    #[serde(rename = "dismissed_by", deserialize_with = "Option::deserialize")]
45    pub dismissed_by: Option<Box<models::NullableSimpleUser>>,
46    /// The reason that the alert was dismissed.
47    #[serde(rename = "dismissed_reason", deserialize_with = "Option::deserialize")]
48    pub dismissed_reason: Option<DismissedReason>,
49    /// An optional comment associated with the alert's dismissal.
50    #[serde(rename = "dismissed_comment", deserialize_with = "Option::deserialize")]
51    pub dismissed_comment: Option<String>,
52    /// The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
53    #[serde(rename = "fixed_at", deserialize_with = "Option::deserialize")]
54    pub fixed_at: Option<String>,
55    /// The time that the alert was auto-dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
56    #[serde(rename = "auto_dismissed_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
57    pub auto_dismissed_at: Option<Option<String>>,
58    #[serde(rename = "repository")]
59    pub repository: Box<models::SimpleRepository>,
60}
61
62impl DependabotAlertWithRepository {
63    /// A Dependabot alert.
64    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 {
65        DependabotAlertWithRepository {
66            number,
67            state,
68            dependency: Box::new(dependency),
69            security_advisory: Box::new(security_advisory),
70            security_vulnerability: Box::new(security_vulnerability),
71            url,
72            html_url,
73            created_at,
74            updated_at,
75            dismissed_at,
76            dismissed_by: dismissed_by.map(Box::new),
77            dismissed_reason,
78            dismissed_comment,
79            fixed_at,
80            auto_dismissed_at: None,
81            repository: Box::new(repository),
82        }
83    }
84}
85/// The state of the Dependabot alert.
86#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
87pub enum State {
88    #[serde(rename = "auto_dismissed")]
89    AutoDismissed,
90    #[serde(rename = "dismissed")]
91    Dismissed,
92    #[serde(rename = "fixed")]
93    Fixed,
94    #[serde(rename = "open")]
95    Open,
96}
97
98impl Default for State {
99    fn default() -> State {
100        Self::AutoDismissed
101    }
102}
103/// The reason that the alert was dismissed.
104#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
105pub enum DismissedReason {
106    #[serde(rename = "fix_started")]
107    FixStarted,
108    #[serde(rename = "inaccurate")]
109    Inaccurate,
110    #[serde(rename = "no_bandwidth")]
111    NoBandwidth,
112    #[serde(rename = "not_used")]
113    NotUsed,
114    #[serde(rename = "tolerable_risk")]
115    TolerableRisk,
116}
117
118impl Default for DismissedReason {
119    fn default() -> DismissedReason {
120        Self::FixStarted
121    }
122}
123