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