warframe/market/models/
item.rs1use serde::Deserialize;
2
3use super::i18n::I18N;
4
5#[derive(Debug, Deserialize, PartialEq, Clone)]
6#[serde(rename_all = "camelCase")]
7#[allow(clippy::struct_excessive_bools)]
8pub struct Item {
9 pub id: String,
10 pub tags: Vec<String>,
11 pub slug: String,
12 pub game_ref: String,
13 pub tradable: bool,
14
15 pub set_root: Option<bool>,
16 #[serde(default)]
17 pub set_parts: Vec<String>,
18 pub quantity_in_set: Option<i64>,
19
20 pub rarity: Option<String>,
21 pub max_rank: Option<u8>,
22 pub max_charges: Option<u8>,
23 pub bulk_tradable: Option<bool>,
24 #[serde(default)]
25 pub subtypes: Vec<String>,
26
27 pub max_amber_stars: Option<u8>,
28 pub max_cyan_stars: Option<u8>,
29 pub base_endo: Option<u16>,
30 pub endo_multiplier: Option<f32>,
31
32 pub ducats: Option<u16>,
33 pub req_mastery_rank: Option<u8>,
34 pub vaulted: Option<bool>,
35 pub trading_tax: Option<i64>,
36
37 pub i18n: I18N<ItemI18N>,
38}
39
40#[derive(Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
41#[serde(rename_all = "camelCase")]
42pub struct ItemI18N {
43 pub name: String,
44 pub description: Option<String>,
45 pub wiki_link: Option<String>,
46 pub icon: String,
47 pub thumb: String,
48 pub sub_icon: Option<String>,
49}
50
51#[cfg(test)]
52mod test {
53
54 use super::Item;
55 use crate::market::models::ResponseBase;
56
57 #[rstest::rstest]
58 fn test_item(
59 #[files("src/market/models/fixtures/item.json")]
60 #[mode = str]
61 json: &str,
62 ) -> Result<(), serde_json::Error> {
63 serde_json::from_str::<ResponseBase<Item>>(json)?;
64
65 Ok(())
66 }
67}