gitbundle_sdk/models/
release_model.rs1use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ReleaseModel {
17 #[serde(
18 rename = "assets",
19 default,
20 with = "::serde_with::rust::double_option",
21 skip_serializing_if = "Option::is_none"
22 )]
23 pub assets: Option<Option<Vec<String>>>,
24 #[serde(
25 rename = "contributors",
26 default,
27 with = "::serde_with::rust::double_option",
28 skip_serializing_if = "Option::is_none"
29 )]
30 pub contributors: Option<Option<Vec<models::Contributor>>>,
31 #[serde(rename = "created")]
32 pub created: i64,
33 #[serde(rename = "created_by")]
34 pub created_by: i64,
35 #[serde(
36 rename = "deleted",
37 default,
38 with = "::serde_with::rust::double_option",
39 skip_serializing_if = "Option::is_none"
40 )]
41 pub deleted: Option<Option<i64>>,
42 #[serde(rename = "description")]
43 pub description: String,
44 #[serde(rename = "id")]
45 pub id: i64,
46 #[serde(rename = "is_draft")]
47 pub is_draft: bool,
48 #[serde(
49 rename = "is_latest",
50 default,
51 with = "::serde_with::rust::double_option",
52 skip_serializing_if = "Option::is_none"
53 )]
54 pub is_latest: Option<Option<bool>>,
55 #[serde(rename = "is_prerelease")]
56 pub is_prerelease: bool,
57 #[serde(rename = "num_commits")]
58 pub num_commits: i64,
59 #[serde(
60 rename = "origin_author",
61 default,
62 with = "::serde_with::rust::double_option",
63 skip_serializing_if = "Option::is_none"
64 )]
65 pub origin_author: Option<Option<String>>,
66 #[serde(
67 rename = "origin_author_id",
68 default,
69 with = "::serde_with::rust::double_option",
70 skip_serializing_if = "Option::is_none"
71 )]
72 pub origin_author_id: Option<Option<i64>>,
73 #[serde(rename = "repo_id")]
74 pub repo_id: i64,
75 #[serde(rename = "sha1")]
76 pub sha1: String,
77 #[serde(rename = "tag_name")]
78 pub tag_name: String,
79 #[serde(rename = "title")]
80 pub title: String,
81 #[serde(rename = "updated")]
82 pub updated: i64,
83 #[serde(rename = "version")]
84 pub version: i64,
85}
86
87impl ReleaseModel {
88 pub fn new(
89 created: i64,
90 created_by: i64,
91 description: String,
92 id: i64,
93 is_draft: bool,
94 is_prerelease: bool,
95 num_commits: i64,
96 repo_id: i64,
97 sha1: String,
98 tag_name: String,
99 title: String,
100 updated: i64,
101 version: i64,
102 ) -> ReleaseModel {
103 ReleaseModel {
104 assets: None,
105 contributors: None,
106 created,
107 created_by,
108 deleted: None,
109 description,
110 id,
111 is_draft,
112 is_latest: None,
113 is_prerelease,
114 num_commits,
115 origin_author: None,
116 origin_author_id: None,
117 repo_id,
118 sha1,
119 tag_name,
120 title,
121 updated,
122 version,
123 }
124 }
125}