Skip to main content

esi_openapi/groups/
market.rs

1#![allow(unused)]
2
3use crate::prelude::*;
4
5#[derive(Debug, Deserialize, Serialize, Clone)]
6#[allow(missing_docs)]
7pub struct HistoryItem {
8    pub average: f64,
9    pub date: String,
10    pub highest: f64,
11    pub lowest: f64,
12    pub order_count: i64,
13    pub volume: i64,
14}
15
16#[derive(Debug, Deserialize)]
17#[allow(missing_docs)]
18pub struct MarketOrder {
19    pub duration: i32,
20    pub is_buy_order: bool,
21    pub issued: String,
22    pub location_id: i64,
23    pub min_volume: i32,
24    pub order_id: i64,
25    pub price: f64,
26    pub range: String,
27    pub system_id: i32,
28    pub type_id: i32,
29    pub volume_remain: i32,
30    pub volume_total: i32,
31}
32
33#[derive(Debug, Deserialize, Serialize, Clone)]
34#[allow(missing_docs)]
35pub struct PriceItem {
36    pub adjusted_price: Option<f64>,
37    pub average_price: Option<f64>,
38    pub type_id: i32,
39}
40
41#[derive(Debug, Deserialize, Serialize, Clone)]
42#[allow(missing_docs)]
43pub struct CharacterOrder {
44    pub duration: i32,
45    pub escrow: Option<f64>,
46    pub is_buy_order: Option<bool>,
47    pub is_corporation: bool,
48    pub issued: String,
49    pub location_id: i64,
50    pub min_volume: Option<i32>,
51    pub order_id: i64,
52    pub price: f64,
53    pub range: String,
54    pub region_id: i32,
55    pub type_id: i32,
56    pub volume_remain: i32,
57    pub volume_total: i32,
58}
59
60/// Endpoints for Market
61pub struct MarketGroup<'a> {
62    pub(crate) esi: &'a Esi,
63}
64
65impl MarketGroup<'_> {
66    api_get!(
67        /// Get a list of historical market statistics for the specified type in a region
68        get_region_history,
69        "GetMarketsRegionIdHistory",
70        RequestType::Public,
71        Vec<HistoryItem>,
72        (region_id: i32) => "{region_id}";
73        (type_id: i32) => "type_id"
74    );
75
76    api_get!(
77        /// Get a list of orders in a region
78        get_region_orders,
79        "GetMarketsRegionIdOrders",
80        RequestType::Public,
81        Vec<MarketOrder>,
82        (region_id: i32) => "{region_id}";
83        Optional(order_type: String) => "order_type",
84        Optional(page: i32) => "page",
85        Optional(type_id: i32) => "type_id"
86    );
87
88    api_get!(
89        /// Get a list of average and adjusted prices
90        get_market_prices,
91        "GetMarketsPrices",
92        RequestType::Public,
93        Vec<PriceItem>,
94    );
95
96    api_get!(
97        /// List open market orders placed by a character
98        get_character_orders,
99        "GetCharactersCharacterIdOrders",
100        RequestType::Authenticated,
101        Vec<CharacterOrder>,
102        (character_id: i32) => "{character_id}"
103    );
104}