pub const READ_CHARACTER_ORDERS: &str = "esi-markets.read_character_orders.v1";
pub const READ_CORPORATION_ORDERS: &str = "esi-markets.read_corporation_orders.v1";
pub const STRUCTURE_MARKETS: &str = "esi-markets.structure_markets.v1";
pub struct MarketsScopes {
pub(super) scopes: Vec<String>,
}
impl Default for MarketsScopes {
fn default() -> Self {
Self::new()
}
}
impl MarketsScopes {
pub fn new() -> Self {
MarketsScopes { scopes: Vec::new() }
}
pub fn all() -> Self {
MarketsScopes::new()
.read_character_orders()
.read_corporation_orders()
.structure_markets()
}
pub fn read_character_orders(mut self) -> Self {
self.scopes.push(READ_CHARACTER_ORDERS.to_string());
self
}
pub fn read_corporation_orders(mut self) -> Self {
self.scopes.push(READ_CORPORATION_ORDERS.to_string());
self
}
pub fn structure_markets(mut self) -> Self {
self.scopes.push(STRUCTURE_MARKETS.to_string());
self
}
}
#[cfg(test)]
mod market_scopes_tests {
use crate::scope::MarketsScopes;
#[test]
fn test_market_scopes_default() {
let markets_scopes = MarketsScopes::default();
assert_eq!(markets_scopes.scopes.len(), 0)
}
}