1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Types for the API of buildsrs
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::collections::BTreeSet;

/// Response for crate API
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CratesQuery {
    /// Crate name
    pub name: String,
}

/// Response for crate API
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CratesResponse {
    /// Crates that matched
    pub crates: Vec<String>,
}

/// Response for crate API
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CrateResponse {
    /// Crate name
    pub name: String,
    /// Crate versions
    pub versions: BTreeSet<String>,
}

/// Crate version response
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CrateVersionResponse {
    /// Crate name
    pub name: String,
    /// Version name
    pub version: String,
    /// Yanked status of this crate
    pub yanked: bool,
    /// Digest of this crate
    pub checksum: String,
    /// Artifacts
    pub artifacts: BTreeSet<String>,
}

/// Crate artifact response
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ArtifactResponse {
    /// Name of the crate
    pub name: String,
    /// Version of the crate
    pub version: String,
    /// Size in bytes
    pub size: usize,
}