artifact-keeper-client 1.2.1

Rust client for the Artifact Keeper REST API
Documentation
/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// CveTrends : CVE trends summary.  #1446: the security-tests `cve-history` suite probes the trends body for any of `total`, `count`, `critical`, or `high` to confirm the response carries aggregate counts (PR #1385 fixed `cve-history` but the trends shape was not aligned). The original field set (`total_cves`, `critical_count`, ...) is retained for openapi consumers; the bare `total`/`critical`/`high`/`medium`/`low` aliases are added alongside so both shape contracts are satisfied without breaking existing clients. `#[serde(default)]` keeps deserialization working when the alias fields are absent (older payloads, tests that build the struct via field init).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CveTrends {
    #[serde(rename = "acknowledged_cves")]
    pub acknowledged_cves: i64,
    #[serde(rename = "avg_days_to_fix", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub avg_days_to_fix: Option<Option<f64>>,
    /// Alias of `critical_count` (#1446).
    #[serde(rename = "critical", skip_serializing_if = "Option::is_none")]
    pub critical: Option<i64>,
    #[serde(rename = "critical_count")]
    pub critical_count: i64,
    #[serde(rename = "fixed_cves")]
    pub fixed_cves: i64,
    /// Alias of `high_count` (#1446).
    #[serde(rename = "high", skip_serializing_if = "Option::is_none")]
    pub high: Option<i64>,
    #[serde(rename = "high_count")]
    pub high_count: i64,
    /// Alias of `low_count` (#1446).
    #[serde(rename = "low", skip_serializing_if = "Option::is_none")]
    pub low: Option<i64>,
    #[serde(rename = "low_count")]
    pub low_count: i64,
    /// Alias of `medium_count` (#1446).
    #[serde(rename = "medium", skip_serializing_if = "Option::is_none")]
    pub medium: Option<i64>,
    #[serde(rename = "medium_count")]
    pub medium_count: i64,
    #[serde(rename = "open_cves")]
    pub open_cves: i64,
    #[serde(rename = "timeline")]
    pub timeline: Vec<models::CveTimelineEntry>,
    /// Alias of `total_cves` (#1446).
    #[serde(rename = "total", skip_serializing_if = "Option::is_none")]
    pub total: Option<i64>,
    #[serde(rename = "total_cves")]
    pub total_cves: i64,
}

impl CveTrends {
    /// CVE trends summary.  #1446: the security-tests `cve-history` suite probes the trends body for any of `total`, `count`, `critical`, or `high` to confirm the response carries aggregate counts (PR #1385 fixed `cve-history` but the trends shape was not aligned). The original field set (`total_cves`, `critical_count`, ...) is retained for openapi consumers; the bare `total`/`critical`/`high`/`medium`/`low` aliases are added alongside so both shape contracts are satisfied without breaking existing clients. `#[serde(default)]` keeps deserialization working when the alias fields are absent (older payloads, tests that build the struct via field init).
    pub fn new(acknowledged_cves: i64, critical_count: i64, fixed_cves: i64, high_count: i64, low_count: i64, medium_count: i64, open_cves: i64, timeline: Vec<models::CveTimelineEntry>, total_cves: i64) -> CveTrends {
        CveTrends {
            acknowledged_cves,
            avg_days_to_fix: None,
            critical: None,
            critical_count,
            fixed_cves,
            high: None,
            high_count,
            low: None,
            low_count,
            medium: None,
            medium_count,
            open_cves,
            timeline,
            total: None,
            total_cves,
        }
    }
}