openapi_github/models/
webhook_code_scanning_alert_fixed_alert.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/// WebhookCodeScanningAlertFixedAlert : The code scanning alert involved in the event.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct WebhookCodeScanningAlertFixedAlert {
17    /// The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ.`
18    #[serde(rename = "created_at")]
19    pub created_at: String,
20    /// The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
21    #[serde(rename = "dismissed_at", deserialize_with = "Option::deserialize")]
22    pub dismissed_at: Option<String>,
23    #[serde(rename = "dismissed_by", deserialize_with = "Option::deserialize")]
24    pub dismissed_by: Option<Box<models::User>>,
25    /// The reason for dismissing or closing the alert.
26    #[serde(rename = "dismissed_reason", deserialize_with = "Option::deserialize")]
27    pub dismissed_reason: Option<DismissedReason>,
28    /// The GitHub URL of the alert resource.
29    #[serde(rename = "html_url")]
30    pub html_url: String,
31    #[serde(rename = "instances_url", skip_serializing_if = "Option::is_none")]
32    pub instances_url: Option<String>,
33    #[serde(rename = "most_recent_instance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub most_recent_instance: Option<Option<Box<models::AlertInstance>>>,
35    /// The code scanning alert number.
36    #[serde(rename = "number")]
37    pub number: i32,
38    #[serde(rename = "rule")]
39    pub rule: Box<models::WebhookCodeScanningAlertClosedByUserAlertRule>,
40    /// State of a code scanning alert.
41    #[serde(rename = "state")]
42    pub state: State,
43    #[serde(rename = "tool")]
44    pub tool: Box<models::WebhookCodeScanningAlertClosedByUserAlertTool>,
45    #[serde(rename = "url")]
46    pub url: String,
47}
48
49impl WebhookCodeScanningAlertFixedAlert {
50    /// The code scanning alert involved in the event.
51    pub fn new(created_at: String, dismissed_at: Option<String>, dismissed_by: Option<models::User>, dismissed_reason: Option<DismissedReason>, html_url: String, number: i32, rule: models::WebhookCodeScanningAlertClosedByUserAlertRule, state: State, tool: models::WebhookCodeScanningAlertClosedByUserAlertTool, url: String) -> WebhookCodeScanningAlertFixedAlert {
52        WebhookCodeScanningAlertFixedAlert {
53            created_at,
54            dismissed_at,
55            dismissed_by: dismissed_by.map(Box::new),
56            dismissed_reason,
57            html_url,
58            instances_url: None,
59            most_recent_instance: None,
60            number,
61            rule: Box::new(rule),
62            state,
63            tool: Box::new(tool),
64            url,
65        }
66    }
67}
68/// The reason for dismissing or closing the alert.
69#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
70pub enum DismissedReason {
71    #[serde(rename = "false positive")]
72    FalsePositive,
73    #[serde(rename = "won't fix")]
74    WonQuoteTFix,
75    #[serde(rename = "used in tests")]
76    UsedInTests,
77}
78
79impl Default for DismissedReason {
80    fn default() -> DismissedReason {
81        Self::FalsePositive
82    }
83}
84/// State of a code scanning alert.
85#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
86pub enum State {
87    #[serde(rename = "fixed")]
88    Fixed,
89}
90
91impl Default for State {
92    fn default() -> State {
93        Self::Fixed
94    }
95}
96