openapi_github/models/
snapshot.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/// Snapshot : Create a new snapshot of a repository's dependencies.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Snapshot {
17    /// The version of the repository snapshot submission.
18    #[serde(rename = "version")]
19    pub version: i32,
20    #[serde(rename = "job")]
21    pub job: Box<models::SnapshotJob>,
22    /// The commit SHA associated with this dependency snapshot. Maximum length: 40 characters.
23    #[serde(rename = "sha")]
24    pub sha: String,
25    /// The repository branch that triggered this snapshot.
26    #[serde(rename = "ref")]
27    pub r#ref: String,
28    #[serde(rename = "detector")]
29    pub detector: Box<models::SnapshotDetector>,
30    /// User-defined metadata to store domain-specific information limited to 8 keys with scalar values.
31    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
32    pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
33    /// A collection of package manifests, which are a collection of related dependencies declared in a file or representing a logical group of dependencies.
34    #[serde(rename = "manifests", skip_serializing_if = "Option::is_none")]
35    pub manifests: Option<std::collections::HashMap<String, models::Manifest>>,
36    /// The time at which the snapshot was scanned.
37    #[serde(rename = "scanned")]
38    pub scanned: String,
39}
40
41impl Snapshot {
42    /// Create a new snapshot of a repository's dependencies.
43    pub fn new(version: i32, job: models::SnapshotJob, sha: String, r#ref: String, detector: models::SnapshotDetector, scanned: String) -> Snapshot {
44        Snapshot {
45            version,
46            job: Box::new(job),
47            sha,
48            r#ref,
49            detector: Box::new(detector),
50            metadata: None,
51            manifests: None,
52            scanned,
53        }
54    }
55}
56