Skip to main content

hypixel/models/skyblock/
auction.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4use crate::models::common::JsonObject;
5
6/// A SkyBlock auction, as returned by `skyblock/auction` and `skyblock/auctions`.
7#[derive(Debug, Clone, Deserialize, Serialize)]
8pub struct SkyBlockAuction {
9    #[serde(rename = "_id", default)]
10    pub id: String,
11    #[serde(default)]
12    pub uuid: String,
13    #[serde(default)]
14    pub auctioneer: String,
15    #[serde(default)]
16    pub profile_id: String,
17    #[serde(default)]
18    pub coop: Vec<String>,
19    #[serde(default)]
20    pub start: i64,
21    #[serde(default)]
22    pub end: i64,
23    #[serde(default)]
24    pub item_name: String,
25    #[serde(default)]
26    pub item_lore: String,
27    #[serde(default)]
28    pub category: String,
29    #[serde(default)]
30    pub tier: String,
31    #[serde(default)]
32    pub starting_bid: i64,
33    /// The auctioned item serialized as a base64+gzip NBT blob.
34    #[serde(default)]
35    pub item_bytes: Value,
36    #[serde(default)]
37    pub claimed: bool,
38    #[serde(default)]
39    pub highest_bid_amount: i64,
40    #[serde(default)]
41    pub bin: bool,
42    #[serde(default)]
43    pub bids: Vec<Value>,
44    #[serde(flatten)]
45    pub extra: JsonObject,
46}
47
48/// One page of the global active-auctions listing from `skyblock/auctions`.
49#[derive(Debug, Clone, Deserialize, Serialize)]
50pub struct AuctionsPage {
51    #[serde(default)]
52    pub page: i64,
53    #[serde(rename = "totalPages", default)]
54    pub total_pages: i64,
55    #[serde(rename = "totalAuctions", default)]
56    pub total_auctions: i64,
57    #[serde(rename = "lastUpdated", default)]
58    pub last_updated: i64,
59    #[serde(default)]
60    pub auctions: Vec<SkyBlockAuction>,
61}
62
63/// A recently completed auction, as returned by `skyblock/auctions_ended`.
64#[derive(Debug, Clone, Deserialize, Serialize)]
65pub struct EndedAuction {
66    #[serde(default)]
67    pub auction_id: String,
68    #[serde(default)]
69    pub seller: String,
70    #[serde(default)]
71    pub seller_profile: String,
72    #[serde(default)]
73    pub buyer: String,
74    #[serde(default)]
75    pub buyer_profile: Option<String>,
76    #[serde(default)]
77    pub timestamp: i64,
78    #[serde(default)]
79    pub price: i64,
80    #[serde(default)]
81    pub bin: bool,
82    /// The sold item serialized as a base64+gzip NBT blob.
83    #[serde(default)]
84    pub item_bytes: String,
85    #[serde(flatten)]
86    pub extra: JsonObject,
87}
88
89#[derive(Debug, Clone, Deserialize)]
90pub(crate) struct AuctionResponse {
91    #[serde(default)]
92    pub auctions: Vec<SkyBlockAuction>,
93}
94
95#[derive(Debug, Clone, Deserialize)]
96pub(crate) struct EndedAuctionsResponse {
97    #[serde(default)]
98    pub auctions: Vec<EndedAuction>,
99}