openapi_github/models/
package.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/// Package : A software package
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Package {
17    /// Unique identifier of the package.
18    #[serde(rename = "id")]
19    pub id: i32,
20    /// The name of the package.
21    #[serde(rename = "name")]
22    pub name: String,
23    #[serde(rename = "package_type")]
24    pub package_type: PackageType,
25    #[serde(rename = "url")]
26    pub url: String,
27    #[serde(rename = "html_url")]
28    pub html_url: String,
29    /// The number of versions of the package.
30    #[serde(rename = "version_count")]
31    pub version_count: i32,
32    #[serde(rename = "visibility")]
33    pub visibility: Visibility,
34    #[serde(rename = "owner", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub owner: Option<Option<Box<models::NullableSimpleUser>>>,
36    #[serde(rename = "repository", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub repository: Option<Option<Box<models::NullableMinimalRepository>>>,
38    #[serde(rename = "created_at")]
39    pub created_at: String,
40    #[serde(rename = "updated_at")]
41    pub updated_at: String,
42}
43
44impl Package {
45    /// A software package
46    pub fn new(id: i32, name: String, package_type: PackageType, url: String, html_url: String, version_count: i32, visibility: Visibility, created_at: String, updated_at: String) -> Package {
47        Package {
48            id,
49            name,
50            package_type,
51            url,
52            html_url,
53            version_count,
54            visibility,
55            owner: None,
56            repository: None,
57            created_at,
58            updated_at,
59        }
60    }
61}
62/// 
63#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
64pub enum PackageType {
65    #[serde(rename = "npm")]
66    Npm,
67    #[serde(rename = "maven")]
68    Maven,
69    #[serde(rename = "rubygems")]
70    Rubygems,
71    #[serde(rename = "docker")]
72    Docker,
73    #[serde(rename = "nuget")]
74    Nuget,
75    #[serde(rename = "container")]
76    Container,
77}
78
79impl Default for PackageType {
80    fn default() -> PackageType {
81        Self::Npm
82    }
83}
84/// 
85#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
86pub enum Visibility {
87    #[serde(rename = "private")]
88    Private,
89    #[serde(rename = "public")]
90    Public,
91}
92
93impl Default for Visibility {
94    fn default() -> Visibility {
95        Self::Private
96    }
97}
98