conduit_cli/core/api/modrinth/
models.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Serialize, Deserialize)]
4pub struct ProjectResponse {
5 pub id: String,
6 pub slug: String,
7 pub title: String,
8 pub description: String,
9 pub categories: Vec<String>,
10 pub client_side: String,
11 pub server_side: String,
12 pub body: String,
13 pub status: String,
14 pub requested_status: Option<String>,
15 pub additional_categories: Vec<String>,
16 pub issues_url: Option<String>,
17 pub source_url: Option<String>,
18 pub wiki_url: Option<String>,
19 pub discord_url: Option<String>,
20 pub donation_urls: Vec<DonationUrl>,
21 pub project_type: String,
22 pub downloads: u64,
23 pub icon_url: Option<String>,
24 pub thread_id: String,
25 pub monetization_status: String,
26 pub team: String,
27 pub body_url: Option<String>,
28 pub moderator_message: Option<String>,
29 pub published: String,
30 pub updated: String,
31 pub approved: Option<String>,
32 pub queued: Option<String>,
33 pub followers: u64,
34 pub license: License,
35 pub versions: Vec<String>,
36 pub game_versions: Vec<String>,
37 pub loaders: Vec<String>,
38 pub gallery: Vec<GalleryImage>,
39}
40
41#[derive(Debug, Serialize, Deserialize)]
42pub struct DonationUrl {
43 pub id: String,
44 pub platform: String,
45 pub url: String,
46}
47
48#[derive(Debug, Serialize, Deserialize)]
49pub struct License {
50 pub id: String,
51 pub name: String,
52 pub url: Option<String>,
53}
54
55#[derive(Debug, Serialize, Deserialize)]
56pub struct GalleryImage {
57 pub url: String,
58 pub featured: bool,
59 pub title: Option<String>,
60 pub description: Option<String>,
61 pub created: String,
62 pub ordering: i32,
63}
64
65#[derive(Debug, Serialize, Deserialize)]
66pub struct VersionResponse {
67 pub id: String,
68 pub project_id: String,
69 pub author_id: String,
70 pub featured: bool,
71 pub name: String,
72 pub version_number: String,
73 pub changelog: Option<String>,
74 pub changelog_url: Option<String>,
75 pub date_published: String,
76 pub downloads: u64,
77 pub version_type: String,
78 pub status: String,
79 pub requested_status: Option<String>,
80 pub files: Vec<VersionFile>,
81 pub dependencies: Vec<Dependency>,
82 pub game_versions: Vec<String>,
83 pub loaders: Vec<String>,
84}
85
86#[derive(Debug, Serialize, Deserialize)]
87pub struct VersionFile {
88 pub hashes: FileHashes,
89 pub url: String,
90 pub filename: String,
91 pub primary: bool,
92 pub size: u64,
93 pub file_type: Option<String>,
94}
95
96#[derive(Debug, Serialize, Deserialize)]
97pub struct FileHashes {
98 pub sha1: String,
99 pub sha512: String,
100}
101
102#[derive(Debug, Serialize, Deserialize)]
103pub struct Dependency {
104 pub version_id: Option<String>,
105 pub project_id: Option<String>,
106 pub file_name: Option<String>,
107 pub dependency_type: String,
108}
109
110#[derive(Debug, Serialize, Deserialize)]
111pub struct SearchResponse {
112 pub hits: Vec<SearchHit>,
113 pub offset: u32,
114 pub limit: u32,
115 pub total_hits: u32,
116}
117
118#[derive(Debug, Serialize, Deserialize)]
119pub struct SearchHit {
120 pub project_id: String,
121 pub project_type: String,
122 pub slug: String,
123 pub author: String,
124 pub title: String,
125 pub description: String,
126 pub categories: Vec<String>,
127 pub display_categories: Vec<String>,
128 pub versions: Vec<String>,
129 pub downloads: u64,
130 pub follows: u64,
131 pub icon_url: Option<String>,
132 pub thread_id: String,
133 pub monetization_status: String,
134 pub license: String,
135 pub client_side: String,
136 pub server_side: String,
137 pub date_created: String,
138 pub date_modified: String,
139 pub latest_version: Option<String>,
140 pub gallery: Vec<String>,
141 pub featured_gallery: Option<String>,
142}