kjspkg_api/models/ver.rs
1use chrono::NaiveDateTime;
2
3/// A struct representing the fields required to create a new package version.
4#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
5pub struct NewPackageVersion {
6 /// The display name of this version.
7 pub name: String,
8
9 /// This version's version number.
10 pub version_number: String,
11
12 /// An optional markdown-formatted changelog.
13 pub changelog: Option<String>,
14
15 /// A list of KubeJS versions this version works on.
16 /// Note that this is currently not used anywhere.
17 pub kubejs: Vec<String>,
18
19 /// A list of loaders this version works on.
20 pub loaders: Vec<String>,
21
22 /// A list of Minecraft versions this version works on.
23 pub minecraft: Vec<String>,
24}
25
26/// A struct representing the fields that can be updated in a package version.
27#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
28pub struct PackageVersionUpdate {
29 /// The display name of this version.
30 pub name: Option<String>,
31
32 /// This version's version number.
33 pub version_number: Option<String>,
34
35 /// An optional markdown-formatted changelog.
36 pub changelog: Option<String>,
37
38 /// A list of KubeJS versions this version works on.
39 /// Note that this is currently not used anywhere.
40 pub kubejs: Option<Vec<String>>,
41
42 /// A list of loaders this version works on.
43 pub loaders: Option<Vec<String>>,
44
45 /// A list of Minecraft versions this version works on.
46 pub minecraft: Option<Vec<String>>,
47}
48
49/// A struct representing a package version.
50#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
51pub struct PackageVersion {
52 /// The version's numerical ID.
53 pub id: i32,
54
55 /// The ID of the package this version belongs to.
56 pub package: i32,
57
58 /// The display name of this version.
59 pub name: String,
60
61 /// This version's version number.
62 pub version_number: String,
63
64 /// An optional markdown-formatted changelog.
65 pub changelog: Option<String>,
66
67 /// A list of KubeJS versions this version works on.
68 /// Note that this is currently not used anywhere.
69 pub kubejs: Vec<String>,
70
71 /// A list of loaders this version works on.
72 pub loaders: Vec<String>,
73
74 /// A list of Minecraft versions this version works on.
75 pub minecraft: Vec<String>,
76
77 /// The number of downloads this version has.
78 pub downloads: i32,
79
80 /// The date/time when this version was created.
81 pub created_at: NaiveDateTime,
82
83 /// The date/time when this version was last updated.
84 pub updated_at: NaiveDateTime,
85}