openapi_github/models/
code_scanning_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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct CodeScanningAlert {
16    /// The security alert number.
17    #[serde(rename = "number")]
18    pub number: i32,
19    /// The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
20    #[serde(rename = "created_at")]
21    pub created_at: String,
22    /// The time that the alert was last updated in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
23    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
24    pub updated_at: Option<String>,
25    /// The REST API URL of the alert resource.
26    #[serde(rename = "url")]
27    pub url: String,
28    /// The GitHub URL of the alert resource.
29    #[serde(rename = "html_url")]
30    pub html_url: String,
31    /// The REST API URL for fetching the list of instances for an alert.
32    #[serde(rename = "instances_url")]
33    pub instances_url: String,
34    #[serde(rename = "state")]
35    pub state: models::CodeScanningAlertState,
36    /// The time that the alert was no longer detected and was considered fixed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
37    #[serde(rename = "fixed_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub fixed_at: Option<Option<String>>,
39    #[serde(rename = "dismissed_by", deserialize_with = "Option::deserialize")]
40    pub dismissed_by: Option<Box<models::NullableSimpleUser>>,
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_reason", deserialize_with = "Option::deserialize")]
45    pub dismissed_reason: Option<models::CodeScanningAlertDismissedReason>,
46    /// The dismissal comment associated with the dismissal of the alert.
47    #[serde(rename = "dismissed_comment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
48    pub dismissed_comment: Option<Option<String>>,
49    #[serde(rename = "rule")]
50    pub rule: Box<models::CodeScanningAlertRule>,
51    #[serde(rename = "tool")]
52    pub tool: Box<models::CodeScanningAnalysisTool>,
53    #[serde(rename = "most_recent_instance")]
54    pub most_recent_instance: Box<models::CodeScanningAlertInstance>,
55}
56
57impl CodeScanningAlert {
58    pub fn new(number: i32, created_at: String, url: String, html_url: String, instances_url: String, state: models::CodeScanningAlertState, dismissed_by: Option<models::NullableSimpleUser>, dismissed_at: Option<String>, dismissed_reason: Option<models::CodeScanningAlertDismissedReason>, rule: models::CodeScanningAlertRule, tool: models::CodeScanningAnalysisTool, most_recent_instance: models::CodeScanningAlertInstance) -> CodeScanningAlert {
59        CodeScanningAlert {
60            number,
61            created_at,
62            updated_at: None,
63            url,
64            html_url,
65            instances_url,
66            state,
67            fixed_at: None,
68            dismissed_by: dismissed_by.map(Box::new),
69            dismissed_at,
70            dismissed_reason,
71            dismissed_comment: None,
72            rule: Box::new(rule),
73            tool: Box::new(tool),
74            most_recent_instance: Box::new(most_recent_instance),
75        }
76    }
77}
78