use crate::client::StClient;
use crate::client::{ClientError, RequestPriority};
use crate::types;
impl StClient {
pub async fn extract_resources(
&self,
ship_symbol: &str,
) -> Result<types::ExtractResourcesResponse, ClientError> {
self.extract_resources_with_priority(ship_symbol, RequestPriority::Normal)
.await
}
pub async fn extract_resources_with_priority(
&self,
ship_symbol: &str,
priority: RequestPriority,
) -> Result<types::ExtractResourcesResponse, ClientError> {
self.send_mutating("extract_resources", priority, || {
self.inner.extract_resources(ship_symbol)
})
.await
}
pub async fn siphon_resources(
&self,
ship_symbol: &str,
) -> Result<types::SiphonResourcesResponse, ClientError> {
self.siphon_resources_with_priority(ship_symbol, RequestPriority::Normal)
.await
}
pub async fn siphon_resources_with_priority(
&self,
ship_symbol: &str,
priority: RequestPriority,
) -> Result<types::SiphonResourcesResponse, ClientError> {
self.send_mutating("siphon_resources", priority, || {
self.inner.siphon_resources(ship_symbol)
})
.await
}
pub async fn extract_resources_with_survey(
&self,
ship_symbol: &str,
survey: &types::Survey,
) -> Result<types::ExtractResourcesWithSurveyResponse, ClientError> {
self.extract_resources_with_survey_with_priority(
ship_symbol,
survey,
RequestPriority::Normal,
)
.await
}
pub async fn extract_resources_with_survey_with_priority(
&self,
ship_symbol: &str,
survey: &types::Survey,
priority: RequestPriority,
) -> Result<types::ExtractResourcesWithSurveyResponse, ClientError> {
self.send_mutating("extract_resources_with_survey", priority, || {
self.inner
.extract_resources_with_survey(ship_symbol, survey)
})
.await
}
pub async fn create_survey(
&self,
ship_symbol: &str,
) -> Result<types::CreateSurveyResponse, ClientError> {
self.create_survey_with_priority(ship_symbol, RequestPriority::Normal)
.await
}
pub async fn create_survey_with_priority(
&self,
ship_symbol: &str,
priority: RequestPriority,
) -> Result<types::CreateSurveyResponse, ClientError> {
self.send_mutating("create_survey", priority, || {
self.inner.create_survey(ship_symbol)
})
.await
}
pub async fn create_chart(
&self,
ship_symbol: &str,
) -> Result<types::CreateChartResponse, ClientError> {
self.create_chart_with_priority(ship_symbol, RequestPriority::Normal)
.await
}
pub async fn create_chart_with_priority(
&self,
ship_symbol: &str,
priority: RequestPriority,
) -> Result<types::CreateChartResponse, ClientError> {
self.send_mutating("create_chart", priority, || {
self.inner.create_chart(ship_symbol)
})
.await
}
pub async fn ship_refine(
&self,
ship_symbol: &str,
produce: &str,
) -> Result<types::ShipRefine201Response, ClientError> {
self.ship_refine_with_priority(ship_symbol, produce, RequestPriority::Normal)
.await
}
pub async fn ship_refine_with_priority(
&self,
ship_symbol: &str,
produce: &str,
priority: RequestPriority,
) -> Result<types::ShipRefine201Response, ClientError> {
let body = types::ShipRefineBody {
produce: produce
.parse()
.map_err(|e| ClientError::Api(format!("invalid produce type: {e:?}")))?,
};
self.send_mutating("ship_refine", priority, || {
self.inner.ship_refine(ship_symbol, &body)
})
.await
}
}