use crate::{
model::{
enums::market::OrderType,
market::{
CharacterMarketOrder, CorporationMarketOrder, MarketItemGroupInformation,
MarketItemPrices, MarketItemRegionStatistics, MarketRegionOrder, StructureMarketOrder,
},
},
scope::MarketsScopes,
Client, Error, ScopeBuilder,
};
pub struct MarketEndpoints<'a> {
client: &'a Client,
}
impl<'a> MarketEndpoints<'a> {
pub(super) fn new(client: &'a Client) -> Self {
Self { client }
}
define_endpoint! {
auth_get list_open_orders_from_a_character(
access_token: &str,
character_id: i64
) -> Result<Vec<CharacterMarketOrder>, Error>
url = "{}/characters/{}/orders";
label = "open market orders";
required_scopes = ScopeBuilder::new().markets(MarketsScopes::new().read_character_orders()).build();
}
define_endpoint! {
auth_get list_historical_orders_by_a_character(
access_token: &str,
character_id: i64;
page: i32
) -> Result<Vec<CharacterMarketOrder>, Error>
url = "{}/characters/{}/orders/history";
label = "historical orders";
required_scopes = ScopeBuilder::new().markets(MarketsScopes::new().read_character_orders()).build();
}
define_endpoint! {
auth_get list_open_orders_from_a_corporation(
access_token: &str,
corporation_id: i64
) -> Result<Vec<CorporationMarketOrder>, Error>
url = "{}/corporations/{}/orders";
label = "open orders";
required_scopes = ScopeBuilder::new().markets(MarketsScopes::new().read_corporation_orders()).build();
}
define_endpoint! {
auth_get list_historical_orders_from_a_corporation(
access_token: &str,
corporation_d: i64;
page: i32
) -> Result<Vec<CorporationMarketOrder>, Error>
url = "{}/corporations/{}/orders/history";
label = "historical orders";
required_scopes = ScopeBuilder::new().markets(MarketsScopes::new().read_corporation_orders()).build();
}
define_endpoint! {
pub_get get_item_groups(
) -> Result<Vec<i64>, Error>
url = "{}/markets/groups";
label = "market groups";
}
define_endpoint! {
pub_get get_item_group_information(
market_group_id: i64
) -> Result<MarketItemGroupInformation, Error>
url = "{}/markets/groups/{}";
label = "market item group information";
}
define_endpoint! {
pub_get list_market_prices(
) -> Result<Vec<MarketItemPrices>, Error>
url = "{}/markets/prices";
label = "market item prices";
}
define_endpoint! {
auth_get list_orders_in_a_structure(
access_token: &str,
structure_id: i64;
page: i32
) -> Result<Vec<StructureMarketOrder>, Error>
url = "{}/markets/structures/{}";
label = "market orders";
required_scopes = ScopeBuilder::new().markets(MarketsScopes::new().structure_markets()).build();
}
define_endpoint! {
pub_get list_historical_market_statistics_in_a_region(
region_id: i64,
type_id: i64
) -> Result<Vec<MarketItemRegionStatistics>, Error>
url = "{}/markets/{}/history?type_id={}";
label = "regional market statistics for item";
}
define_endpoint! {
pub_get list_orders_in_a_region(
region_id: i64;
order_type: OrderType,
page: i32
) -> Result<Vec<MarketRegionOrder>, Error>
url = "{}/markets/{}/orders";
label = "market orders";
}
define_endpoint! {
pub_get list_type_ids_relevant_to_a_market(
region_id: i64;
page: i32
) -> Result<Vec<i64>, Error>
url = "{}/markets/{}/types";
label = "item type IDs with active market orders";
}
}