mod data;
mod global;
use std::num::NonZeroU64;
use crate::client::StClient;
use crate::client::{ClientError, RequestPriority};
use crate::types;
impl StClient {
pub async fn get_systems(
&self,
limit: Option<NonZeroU64>,
page: Option<NonZeroU64>,
) -> Result<types::GetSystemsResponse, ClientError> {
self.get_systems_with_priority(limit, page, RequestPriority::Normal)
.await
}
pub async fn get_systems_with_priority(
&self,
limit: Option<NonZeroU64>,
page: Option<NonZeroU64>,
priority: RequestPriority,
) -> Result<types::GetSystemsResponse, ClientError> {
self.send("get_systems", priority, || {
self.inner.get_systems(limit, page)
})
.await
}
pub async fn get_system(
&self,
system_symbol: &str,
) -> Result<types::GetSystemResponse, ClientError> {
self.get_system_with_priority(system_symbol, RequestPriority::Normal)
.await
}
pub async fn get_system_with_priority(
&self,
system_symbol: &str,
priority: RequestPriority,
) -> Result<types::GetSystemResponse, ClientError> {
self.send("get_system", priority, || {
self.inner.get_system(system_symbol)
})
.await
}
pub async fn get_system_waypoints(
&self,
system_symbol: &str,
limit: Option<NonZeroU64>,
page: Option<NonZeroU64>,
traits: Option<&types::GetSystemWaypointsTraits>,
type_: Option<types::WaypointType>,
) -> Result<types::GetSystemWaypointsResponse, ClientError> {
self.get_system_waypoints_with_priority(
system_symbol,
limit,
page,
traits,
type_,
RequestPriority::Normal,
)
.await
}
pub async fn get_system_waypoints_with_priority(
&self,
system_symbol: &str,
limit: Option<NonZeroU64>,
page: Option<NonZeroU64>,
traits: Option<&types::GetSystemWaypointsTraits>,
type_: Option<types::WaypointType>,
priority: RequestPriority,
) -> Result<types::GetSystemWaypointsResponse, ClientError> {
self.send("get_system_waypoints", priority, || {
self.inner
.get_system_waypoints(system_symbol, limit, page, traits, type_)
})
.await
}
pub async fn get_waypoint(
&self,
system_symbol: &str,
waypoint_symbol: &str,
) -> Result<types::GetWaypointResponse, ClientError> {
self.get_waypoint_with_priority(system_symbol, waypoint_symbol, RequestPriority::Normal)
.await
}
pub async fn get_waypoint_with_priority(
&self,
system_symbol: &str,
waypoint_symbol: &str,
priority: RequestPriority,
) -> Result<types::GetWaypointResponse, ClientError> {
self.send("get_waypoint", priority, || {
self.inner.get_waypoint(system_symbol, waypoint_symbol)
})
.await
}
pub async fn get_market(
&self,
system_symbol: &str,
waypoint_symbol: &str,
) -> Result<types::GetMarketResponse, ClientError> {
self.get_market_with_priority(system_symbol, waypoint_symbol, RequestPriority::Normal)
.await
}
pub async fn get_market_with_priority(
&self,
system_symbol: &str,
waypoint_symbol: &str,
priority: RequestPriority,
) -> Result<types::GetMarketResponse, ClientError> {
self.send("get_market", priority, || {
self.inner.get_market(system_symbol, waypoint_symbol)
})
.await
}
pub async fn get_shipyard(
&self,
system_symbol: &str,
waypoint_symbol: &str,
) -> Result<types::GetShipyardResponse, ClientError> {
self.get_shipyard_with_priority(system_symbol, waypoint_symbol, RequestPriority::Normal)
.await
}
pub async fn get_shipyard_with_priority(
&self,
system_symbol: &str,
waypoint_symbol: &str,
priority: RequestPriority,
) -> Result<types::GetShipyardResponse, ClientError> {
self.send("get_shipyard", priority, || {
self.inner.get_shipyard(system_symbol, waypoint_symbol)
})
.await
}
pub async fn get_jump_gate(
&self,
system_symbol: &str,
waypoint_symbol: &str,
) -> Result<types::GetJumpGateResponse, ClientError> {
self.get_jump_gate_with_priority(system_symbol, waypoint_symbol, RequestPriority::Normal)
.await
}
pub async fn get_jump_gate_with_priority(
&self,
system_symbol: &str,
waypoint_symbol: &str,
priority: RequestPriority,
) -> Result<types::GetJumpGateResponse, ClientError> {
self.send("get_jump_gate", priority, || {
self.inner.get_jump_gate(system_symbol, waypoint_symbol)
})
.await
}
pub async fn get_construction(
&self,
system_symbol: &str,
waypoint_symbol: &str,
) -> Result<types::GetConstructionResponse, ClientError> {
self.get_construction_with_priority(system_symbol, waypoint_symbol, RequestPriority::Normal)
.await
}
pub async fn get_construction_with_priority(
&self,
system_symbol: &str,
waypoint_symbol: &str,
priority: RequestPriority,
) -> Result<types::GetConstructionResponse, ClientError> {
self.send("get_construction", priority, || {
self.inner.get_construction(system_symbol, waypoint_symbol)
})
.await
}
pub async fn supply_construction(
&self,
system_symbol: &str,
waypoint_symbol: &str,
ship_symbol: &str,
trade_symbol: types::TradeSymbol,
units: NonZeroU64,
) -> Result<types::SupplyConstructionResponse, ClientError> {
self.supply_construction_with_priority(
system_symbol,
waypoint_symbol,
ship_symbol,
trade_symbol,
units,
RequestPriority::Normal,
)
.await
}
pub async fn supply_construction_with_priority(
&self,
system_symbol: &str,
waypoint_symbol: &str,
ship_symbol: &str,
trade_symbol: types::TradeSymbol,
units: NonZeroU64,
priority: RequestPriority,
) -> Result<types::SupplyConstructionResponse, ClientError> {
let body = types::SupplyConstructionBody {
ship_symbol: ship_symbol.to_string(),
trade_symbol,
units,
};
self.send_mutating("supply_construction", priority, || {
self.inner
.supply_construction(system_symbol, waypoint_symbol, &body)
})
.await
}
}