openapi_github/models/
release_asset.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/// ReleaseAsset : Data related to a release.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ReleaseAsset {
17    #[serde(rename = "browser_download_url")]
18    pub browser_download_url: String,
19    #[serde(rename = "content_type")]
20    pub content_type: String,
21    #[serde(rename = "created_at")]
22    pub created_at: String,
23    #[serde(rename = "download_count")]
24    pub download_count: i32,
25    #[serde(rename = "id")]
26    pub id: i32,
27    #[serde(rename = "label", deserialize_with = "Option::deserialize")]
28    pub label: Option<String>,
29    /// The file name of the asset.
30    #[serde(rename = "name")]
31    pub name: String,
32    #[serde(rename = "node_id")]
33    pub node_id: String,
34    #[serde(rename = "size")]
35    pub size: i32,
36    /// State of the release asset.
37    #[serde(rename = "state")]
38    pub state: State,
39    #[serde(rename = "updated_at")]
40    pub updated_at: String,
41    #[serde(rename = "uploader", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
42    pub uploader: Option<Option<Box<models::User>>>,
43    #[serde(rename = "url")]
44    pub url: String,
45}
46
47impl ReleaseAsset {
48    /// Data related to a release.
49    pub fn new(browser_download_url: String, content_type: String, created_at: String, download_count: i32, id: i32, label: Option<String>, name: String, node_id: String, size: i32, state: State, updated_at: String, url: String) -> ReleaseAsset {
50        ReleaseAsset {
51            browser_download_url,
52            content_type,
53            created_at,
54            download_count,
55            id,
56            label,
57            name,
58            node_id,
59            size,
60            state,
61            updated_at,
62            uploader: None,
63            url,
64        }
65    }
66}
67/// State of the release asset.
68#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
69pub enum State {
70    #[serde(rename = "uploaded")]
71    Uploaded,
72}
73
74impl Default for State {
75    fn default() -> State {
76        Self::Uploaded
77    }
78}
79