gw2lib_model/tradingpost/
commerce.rs1use serde::{Deserialize, Serialize};
2
3use crate::{items::ItemId, BulkEndpoint, Endpoint, EndpointWithId};
4
5#[derive(Clone, Debug, Serialize, Deserialize)]
6#[cfg_attr(test, serde(deny_unknown_fields))]
7pub struct ListingDetails {
8 pub listings: u64,
9 pub unit_price: u64,
10 pub quantity: u64,
11}
12
13#[derive(Clone, Debug, Serialize, Deserialize)]
14#[cfg_attr(test, serde(deny_unknown_fields))]
15pub struct Listings {
16 pub id: ItemId,
17 pub buys: Vec<ListingDetails>,
18 pub sells: Vec<ListingDetails>,
19}
20
21impl EndpointWithId for Listings {
22 type IdType = ItemId;
23}
24impl Endpoint for Listings {
25 const AUTHENTICATED: bool = false;
26 const LOCALE: bool = false;
27 const URL: &'static str = "v2/commerce/listings";
28 const VERSION: &'static str = "2021-01-11T00:00:00.000Z";
29}
30
31impl BulkEndpoint for Listings {
32 const ALL: bool = false;
33
34 fn id(&self) -> &Self::IdType {
35 &self.id
36 }
37}
38
39#[derive(Clone, Debug, Serialize, Deserialize)]
40#[cfg_attr(test, serde(deny_unknown_fields))]
41pub struct PriceDetails {
42 pub unit_price: u64,
43 pub quantity: u64,
44}
45
46#[derive(Clone, Debug, Serialize, Deserialize)]
47#[cfg_attr(test, serde(deny_unknown_fields))]
48pub struct Prices {
49 pub id: ItemId,
50 pub whitelisted: bool,
51 pub buys: PriceDetails,
52 pub sells: PriceDetails,
53}
54
55impl EndpointWithId for Prices {
56 type IdType = ItemId;
57}
58impl Endpoint for Prices {
59 const AUTHENTICATED: bool = false;
60 const LOCALE: bool = false;
61 const URL: &'static str = "v2/commerce/prices";
62 const VERSION: &'static str = "2021-01-11T00:00:00.000Z";
63}
64
65impl BulkEndpoint for Prices {
66 const ALL: bool = false;
67
68 fn id(&self) -> &Self::IdType {
69 &self.id
70 }
71}