Skip to main content

conduit_cli/modrinth/
models.rs

1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4#[derive(Debug, Serialize, Deserialize)]
5pub struct SearchResult {
6    pub hits: Vec<ProjectHit>,
7    pub total_hits: i32,
8}
9
10#[derive(Debug, Serialize, Deserialize)]
11pub struct ProjectHit {
12    pub slug: String,
13    pub title: String,
14    pub project_type: String,
15    pub author: String,
16    pub downloads: i32,
17}
18
19#[derive(Debug, Serialize, Deserialize)]
20pub struct Version {
21    pub id: String,
22    pub project_id: String,
23    pub name: String,
24    pub version_number: String,
25    pub files: Vec<ModFile>,
26    pub dependencies: Vec<Dependency>,
27}
28
29#[derive(Debug, Serialize, Deserialize)]
30pub struct Dependency {
31    pub project_id: Option<String>,
32    pub version_id: Option<String>,
33    pub dependency_type: String,
34}
35
36#[derive(Debug, Serialize, Deserialize)]
37pub struct ModFile {
38    pub url: String,
39    pub filename: String,
40    pub size: u64,
41    pub primary: bool,
42    pub hashes: HashMap<String, String>,
43}
44
45#[derive(Debug, Serialize, Deserialize)]
46pub struct Project {
47    pub id: String,
48    pub slug: String,
49    pub title: String,
50    pub description: String,
51    pub project_type: String,
52    pub downloads: i32,
53    pub icon_url: Option<String>,
54}