//!
//!
//! Generated by: <https://openapi-generator.tech>
//!
//! Version of specification: `2.0.0`
use reqwest::StatusCode;
use super::{configuration, Error};
use crate::apis::ResponseContent;
/// Enum for successes of method [`create_chart`].
#[derive(Debug, Clone)]
pub enum CreateChartSuccess {
/// Response for status code 201.
Status201(crate::models::CreateChart201Response),
}
impl CreateChartSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`create_ship_ship_scan`].
#[derive(Debug, Clone)]
pub enum CreateShipShipScanSuccess {
/// Response for status code 201.
Status201(crate::models::CreateShipShipScan201Response),
}
impl CreateShipShipScanSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`create_ship_system_scan`].
#[derive(Debug, Clone)]
pub enum CreateShipSystemScanSuccess {
/// Response for status code 201.
Status201(crate::models::CreateShipSystemScan201Response),
}
impl CreateShipSystemScanSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`create_ship_waypoint_scan`].
#[derive(Debug, Clone)]
pub enum CreateShipWaypointScanSuccess {
/// Response for status code 201.
Status201(crate::models::CreateShipWaypointScan201Response),
}
impl CreateShipWaypointScanSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`create_survey`].
#[derive(Debug, Clone)]
pub enum CreateSurveySuccess {
/// Response for status code 201.
Status201(crate::models::CreateSurvey201Response),
}
impl CreateSurveySuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`dock_ship`].
#[derive(Debug, Clone)]
pub enum DockShipSuccess {
/// Response for status code 200.
Status200(crate::models::DockShip200Response),
}
impl DockShipSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`extract_resources`].
#[derive(Debug, Clone)]
pub enum ExtractResourcesSuccess {
/// Response for status code 201.
Status201(crate::models::ExtractResources201Response),
}
impl ExtractResourcesSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`get_mounts`].
#[derive(Debug, Clone)]
pub enum GetMountsSuccess {
/// Response for status code 200.
Status200(crate::models::GetMounts200Response),
}
impl GetMountsSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`get_my_ship`].
#[derive(Debug, Clone)]
pub enum GetMyShipSuccess {
/// Response for status code 200.
Status200(crate::models::GetMyShip200Response),
}
impl GetMyShipSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`get_my_ship_cargo`].
#[derive(Debug, Clone)]
pub enum GetMyShipCargoSuccess {
/// Response for status code 200.
Status200(crate::models::GetMyShipCargo200Response),
}
impl GetMyShipCargoSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`get_my_ships`].
#[derive(Debug, Clone)]
pub enum GetMyShipsSuccess {
/// Response for status code 200.
Status200(crate::models::GetMyShips200Response),
}
impl GetMyShipsSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`get_ship_cooldown`].
#[derive(Debug, Clone)]
pub enum GetShipCooldownSuccess {
/// Response for status code 200.
Status200(crate::models::GetShipCooldown200Response),
/// Response for status code 204.
Status204,
}
impl GetShipCooldownSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
204 => Some(Ok(Self::Status204)),
_ => None,
}
}
}
/// Enum for successes of method [`get_ship_nav`].
#[derive(Debug, Clone)]
pub enum GetShipNavSuccess {
/// Response for status code 200.
Status200(crate::models::GetShipNav200Response),
}
impl GetShipNavSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`install_mount`].
#[derive(Debug, Clone)]
pub enum InstallMountSuccess {
/// Response for status code 201.
Status201(crate::models::InstallMount201Response),
}
impl InstallMountSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`jettison`].
#[derive(Debug, Clone)]
pub enum JettisonSuccess {
/// Response for status code 200.
Status200(crate::models::Jettison200Response),
}
impl JettisonSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`jump_ship`].
#[derive(Debug, Clone)]
pub enum JumpShipSuccess {
/// Response for status code 200.
Status200(crate::models::JumpShip200Response),
}
impl JumpShipSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`navigate_ship`].
#[derive(Debug, Clone)]
pub enum NavigateShipSuccess {
/// Response for status code 200.
Status200(crate::models::NavigateShip200Response),
}
impl NavigateShipSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`negotiate_contract`].
#[derive(Debug, Clone)]
pub enum NegotiateContractSuccess {
/// Response for status code 201.
Status201(crate::models::NegotiateContract200Response),
}
impl NegotiateContractSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`orbit_ship`].
#[derive(Debug, Clone)]
pub enum OrbitShipSuccess {
/// Response for status code 200.
Status200(crate::models::OrbitShip200Response),
}
impl OrbitShipSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`patch_ship_nav`].
#[derive(Debug, Clone)]
pub enum PatchShipNavSuccess {
/// Response for status code 200.
Status200(crate::models::GetShipNav200Response),
}
impl PatchShipNavSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`purchase_cargo`].
#[derive(Debug, Clone)]
pub enum PurchaseCargoSuccess {
/// Response for status code 201.
Status201(crate::models::PurchaseCargo201Response),
}
impl PurchaseCargoSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`purchase_ship`].
#[derive(Debug, Clone)]
pub enum PurchaseShipSuccess {
/// Response for status code 201.
Status201(crate::models::PurchaseShip201Response),
}
impl PurchaseShipSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`refuel_ship`].
#[derive(Debug, Clone)]
pub enum RefuelShipSuccess {
/// Response for status code 200.
Status200(crate::models::RefuelShip200Response),
}
impl RefuelShipSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`remove_mount`].
#[derive(Debug, Clone)]
pub enum RemoveMountSuccess {
/// Response for status code 201.
Status201(crate::models::RemoveMount201Response),
}
impl RemoveMountSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`sell_cargo`].
#[derive(Debug, Clone)]
pub enum SellCargoSuccess {
/// Response for status code 201.
Status201(crate::models::SellCargo201Response),
}
impl SellCargoSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`ship_refine`].
#[derive(Debug, Clone)]
pub enum ShipRefineSuccess {
/// Response for status code 201.
Status201(crate::models::ShipRefine201Response),
}
impl ShipRefineSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
201 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status201(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`transfer_cargo`].
#[derive(Debug, Clone)]
pub enum TransferCargoSuccess {
/// Response for status code 200.
Status200(crate::models::TransferCargo200Response),
}
impl TransferCargoSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for successes of method [`warp_ship`].
#[derive(Debug, Clone)]
pub enum WarpShipSuccess {
/// Response for status code 200.
Status200(crate::models::NavigateShip200Response),
}
impl WarpShipSuccess {
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
200 => Some(match serde_json::from_str(body) {
Ok(data) => Ok(Self::Status200(data)),
Err(err) => Err(err),
}),
_ => None,
}
}
}
/// Enum for known errors of method [`create_chart`].
#[derive(Debug, Clone)]
pub enum CreateChartError {}
impl CreateChartError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`create_ship_ship_scan`].
#[derive(Debug, Clone)]
pub enum CreateShipShipScanError {}
impl CreateShipShipScanError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`create_ship_system_scan`].
#[derive(Debug, Clone)]
pub enum CreateShipSystemScanError {}
impl CreateShipSystemScanError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`create_ship_waypoint_scan`].
#[derive(Debug, Clone)]
pub enum CreateShipWaypointScanError {}
impl CreateShipWaypointScanError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`create_survey`].
#[derive(Debug, Clone)]
pub enum CreateSurveyError {}
impl CreateSurveyError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`dock_ship`].
#[derive(Debug, Clone)]
pub enum DockShipError {}
impl DockShipError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`extract_resources`].
#[derive(Debug, Clone)]
pub enum ExtractResourcesError {}
impl ExtractResourcesError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`get_mounts`].
#[derive(Debug, Clone)]
pub enum GetMountsError {}
impl GetMountsError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`get_my_ship`].
#[derive(Debug, Clone)]
pub enum GetMyShipError {}
impl GetMyShipError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`get_my_ship_cargo`].
#[derive(Debug, Clone)]
pub enum GetMyShipCargoError {}
impl GetMyShipCargoError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`get_my_ships`].
#[derive(Debug, Clone)]
pub enum GetMyShipsError {}
impl GetMyShipsError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`get_ship_cooldown`].
#[derive(Debug, Clone)]
pub enum GetShipCooldownError {}
impl GetShipCooldownError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`get_ship_nav`].
#[derive(Debug, Clone)]
pub enum GetShipNavError {}
impl GetShipNavError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`install_mount`].
#[derive(Debug, Clone)]
pub enum InstallMountError {}
impl InstallMountError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`jettison`].
#[derive(Debug, Clone)]
pub enum JettisonError {}
impl JettisonError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`jump_ship`].
#[derive(Debug, Clone)]
pub enum JumpShipError {}
impl JumpShipError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`navigate_ship`].
#[derive(Debug, Clone)]
pub enum NavigateShipError {}
impl NavigateShipError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`negotiate_contract`].
#[derive(Debug, Clone)]
pub enum NegotiateContractError {}
impl NegotiateContractError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`orbit_ship`].
#[derive(Debug, Clone)]
pub enum OrbitShipError {}
impl OrbitShipError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`patch_ship_nav`].
#[derive(Debug, Clone)]
pub enum PatchShipNavError {}
impl PatchShipNavError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`purchase_cargo`].
#[derive(Debug, Clone)]
pub enum PurchaseCargoError {}
impl PurchaseCargoError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`purchase_ship`].
#[derive(Debug, Clone)]
pub enum PurchaseShipError {}
impl PurchaseShipError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`refuel_ship`].
#[derive(Debug, Clone)]
pub enum RefuelShipError {}
impl RefuelShipError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`remove_mount`].
#[derive(Debug, Clone)]
pub enum RemoveMountError {}
impl RemoveMountError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`sell_cargo`].
#[derive(Debug, Clone)]
pub enum SellCargoError {}
impl SellCargoError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`ship_refine`].
#[derive(Debug, Clone)]
pub enum ShipRefineError {}
impl ShipRefineError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`transfer_cargo`].
#[derive(Debug, Clone)]
pub enum TransferCargoError {}
impl TransferCargoError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Enum for known errors of method [`warp_ship`].
#[derive(Debug, Clone)]
pub enum WarpShipError {}
impl WarpShipError {
#[allow(unused_variables, clippy::match_single_binding)]
fn from_body(status: StatusCode, body: &str) -> Option<serde_json::Result<Self>> {
// Attempt to deserialize the response for the given status code.
match status.as_u16() {
_ => None,
}
}
}
/// Command a ship to chart the waypoint at its current location. Most waypoints in the universe are uncharted by default. These waypoints have their traits hidden until they have been charted by a ship. Charting a waypoint will record your agent as the one who created the chart, and all other agents would also be able to see the waypoint's traits.
pub async fn create_chart(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<CreateChartSuccess>, Error<CreateChartError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/chart",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match CreateChartSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match CreateChartError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Scan for nearby ships, retrieving information for all ships in range. Requires a ship to have the `Sensor Array` mount installed to use. The ship will enter a cooldown after using this function, during which it cannot execute certain actions.
pub async fn create_ship_ship_scan(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<CreateShipShipScanSuccess>, Error<CreateShipShipScanError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/scan/ships",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match CreateShipShipScanSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match CreateShipShipScanError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Scan for nearby systems, retrieving information on the systems' distance from the ship and their waypoints. Requires a ship to have the `Sensor Array` mount installed to use. The ship will enter a cooldown after using this function, during which it cannot execute certain actions.
pub async fn create_ship_system_scan(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<CreateShipSystemScanSuccess>, Error<CreateShipSystemScanError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/scan/systems",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match CreateShipSystemScanSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match CreateShipSystemScanError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Scan for nearby waypoints, retrieving detailed information on each waypoint in range. Scanning uncharted waypoints will allow you to ignore their uncharted state and will list the waypoints' traits. Requires a ship to have the `Sensor Array` mount installed to use. The ship will enter a cooldown after using this function, during which it cannot execute certain actions.
pub async fn create_ship_waypoint_scan(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<CreateShipWaypointScanSuccess>, Error<CreateShipWaypointScanError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/scan/waypoints",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match CreateShipWaypointScanSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match CreateShipWaypointScanError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Create surveys on a waypoint that can be extracted such as asteroid fields. A survey focuses on specific types of deposits from the extracted location. When ships extract using this survey, they are guaranteed to procure a high amount of one of the goods in the survey. In order to use a survey, send the entire survey details in the body of the extract request. Each survey may have multiple deposits, and if a symbol shows up more than once, that indicates a higher chance of extracting that resource. Your ship will enter a cooldown after surveying in which it is unable to perform certain actions. Surveys will eventually expire after a period of time or will be exhausted after being extracted several times based on the survey's size. Multiple ships can use the same survey for extraction. A ship must have the `Surveyor` mount installed in order to use this function.
pub async fn create_survey(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<CreateSurveySuccess>, Error<CreateSurveyError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/survey",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match CreateSurveySuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match CreateSurveyError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Attempt to dock your ship at its current location. Docking will only succeed if your ship is capable of docking at the time of the request. Docked ships can access elements in their current location, such as the market or a shipyard, but cannot do actions that require the ship to be above surface such as navigating or extracting. The endpoint is idempotent - successive calls will succeed even if the ship is already docked.
pub async fn dock_ship(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<DockShipSuccess>, Error<DockShipError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/dock",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match DockShipSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match DockShipError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Extract resources from a waypoint that can be extracted, such as asteroid fields, into your ship. Send an optional survey as the payload to target specific yields. The ship must be in orbit to be able to extract and must have mining equipments installed that can extract goods, such as the `Gas Siphon` mount for gas-based goods or `Mining Laser` mount for ore-based goods.
pub async fn extract_resources(
configuration: &configuration::Configuration,
ship_symbol: &str,
extract_resources_request: Option<crate::models::ExtractResourcesRequest>,
) -> Result<ResponseContent<ExtractResourcesSuccess>, Error<ExtractResourcesError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/extract",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&extract_resources_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match ExtractResourcesSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match ExtractResourcesError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Get the mounts installed on a ship.
pub async fn get_mounts(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<GetMountsSuccess>, Error<GetMountsError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/mounts",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::GET, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match GetMountsSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match GetMountsError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Retrieve the details of a ship under your agent's ownership.
pub async fn get_my_ship(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<GetMyShipSuccess>, Error<GetMyShipError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::GET, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match GetMyShipSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match GetMyShipError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Retrieve the cargo of a ship under your agent's ownership.
pub async fn get_my_ship_cargo(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<GetMyShipCargoSuccess>, Error<GetMyShipCargoError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/cargo",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::GET, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match GetMyShipCargoSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match GetMyShipCargoError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Return a paginated list of all of ships under your agent's ownership.
pub async fn get_my_ships(
configuration: &configuration::Configuration,
page: Option<u32>,
limit: Option<u32>,
) -> Result<ResponseContent<GetMyShipsSuccess>, Error<GetMyShipsError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!("{}/my/ships", configuration.base_path);
let mut req_builder = client.request(reqwest::Method::GET, &uri_str);
// === Add queries to request ===
if let Some(s) = &page {
req_builder = req_builder.query(&[("page", &s.to_string())]);
}
// === Add queries to request ===
if let Some(s) = &limit {
req_builder = req_builder.query(&[("limit", &s.to_string())]);
}
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match GetMyShipsSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match GetMyShipsError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Retrieve the details of your ship's reactor cooldown. Some actions such as activating your jump drive, scanning, or extracting resources taxes your reactor and results in a cooldown. Your ship cannot perform additional actions until your cooldown has expired. The duration of your cooldown is relative to the power consumption of the related modules or mounts for the action taken. Response returns a 204 status code (no-content) when the ship has no cooldown.
pub async fn get_ship_cooldown(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<GetShipCooldownSuccess>, Error<GetShipCooldownError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/cooldown",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::GET, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match GetShipCooldownSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match GetShipCooldownError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Get the current nav status of a ship.
pub async fn get_ship_nav(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<GetShipNavSuccess>, Error<GetShipNavError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/nav",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::GET, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match GetShipNavSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match GetShipNavError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Install a mount on a ship. In order to install a mount, the ship must be docked and located in a waypoint that has a `Shipyard` trait. The ship also must have the mount to install in its cargo hold. An installation fee will be deduced by the Shipyard for installing the mount on the ship.
pub async fn install_mount(
configuration: &configuration::Configuration,
ship_symbol: &str,
install_mount_request: Option<crate::models::InstallMountRequest>,
) -> Result<ResponseContent<InstallMountSuccess>, Error<InstallMountError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/mounts/install",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&install_mount_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match InstallMountSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match InstallMountError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Jettison cargo from your ship's cargo hold.
pub async fn jettison(
configuration: &configuration::Configuration,
ship_symbol: &str,
jettison_request: Option<crate::models::JettisonRequest>,
) -> Result<ResponseContent<JettisonSuccess>, Error<JettisonError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/jettison",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&jettison_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match JettisonSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match JettisonError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Jump your ship instantly to a target system. The ship must be in orbit to use this function. When used while in orbit of a Jump Gate waypoint, any ship can use this command, jumping to the target system's Jump Gate waypoint. When used elsewhere, jumping requires the ship to have a `Jump Drive` module installed and consumes a unit of antimatter from the ship's cargo. The command will fail if there is no antimatter to consume. When jumping via the `Jump Drive` module, the ship ends up at its largest source of energy in the system, such as a gas planet or a jump gate.
pub async fn jump_ship(
configuration: &configuration::Configuration,
ship_symbol: &str,
jump_ship_request: Option<crate::models::JumpShipRequest>,
) -> Result<ResponseContent<JumpShipSuccess>, Error<JumpShipError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/jump",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&jump_ship_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match JumpShipSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match JumpShipError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Navigate to a target destination. The ship must be in orbit to use this function. The destination waypoint must be within the same system as the ship's current location. Navigating will consume the necessary fuel from the ship's manifest based on the distance to the target waypoint. The returned response will detail the route information including the expected time of arrival. Most ship actions are unavailable until the ship has arrived at it's destination. To travel between systems, see the ship's Warp or Jump actions.
pub async fn navigate_ship(
configuration: &configuration::Configuration,
ship_symbol: &str,
navigate_ship_request: Option<crate::models::NavigateShipRequest>,
) -> Result<ResponseContent<NavigateShipSuccess>, Error<NavigateShipError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/navigate",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&navigate_ship_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match NavigateShipSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match NavigateShipError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Negotiate a new contract with the HQ. In order to negotiate a new contract, an agent must not have ongoing or offered contracts over the allowed maximum amount. Currently the maximum contracts an agent can have at a time is 1. Once a contract is negotiated, it is added to the list of contracts offered to the agent, which the agent can then accept. The ship must be present at a faction's HQ waypoint to negotiate a contract with that faction.
pub async fn negotiate_contract(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<NegotiateContractSuccess>, Error<NegotiateContractError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/negotiate/contract",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match NegotiateContractSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match NegotiateContractError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Attempt to move your ship into orbit at its current location. The request will only succeed if your ship is capable of moving into orbit at the time of the request. Orbiting ships are able to do actions that require the ship to be above surface such as navigating or extracting, but cannot access elements in their current waypoint, such as the market or a shipyard. The endpoint is idempotent - successive calls will succeed even if the ship is already in orbit.
pub async fn orbit_ship(
configuration: &configuration::Configuration,
ship_symbol: &str,
) -> Result<ResponseContent<OrbitShipSuccess>, Error<OrbitShipError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/orbit",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match OrbitShipSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match OrbitShipError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Update the nav configuration of a ship. Currently only supports configuring the Flight Mode of the ship, which affects its speed and fuel consumption.
pub async fn patch_ship_nav(
configuration: &configuration::Configuration,
ship_symbol: &str,
patch_ship_nav_request: Option<crate::models::PatchShipNavRequest>,
) -> Result<ResponseContent<PatchShipNavSuccess>, Error<PatchShipNavError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/nav",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::PATCH, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&patch_ship_nav_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match PatchShipNavSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match PatchShipNavError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Purchase cargo from a market. The ship must be docked in a waypoint that has `Marketplace` trait, and the market must be selling a good to be able to purchase it. The maximum amount of units of a good that can be purchased in each transaction are denoted by the `tradeVolume` value of the good, which can be viewed by using the Get Market action. Purchased goods are added to the ship's cargo hold.
pub async fn purchase_cargo(
configuration: &configuration::Configuration,
ship_symbol: &str,
purchase_cargo_request: Option<crate::models::PurchaseCargoRequest>,
) -> Result<ResponseContent<PurchaseCargoSuccess>, Error<PurchaseCargoError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/purchase",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&purchase_cargo_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match PurchaseCargoSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match PurchaseCargoError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Purchase a ship from a Shipyard. In order to use this function, a ship under your agent's ownership must be in a waypoint that has the `Shipyard` trait, and the Shipyard must sell the type of the desired ship. Shipyards typically offer ship types, which are predefined templates of ships that have dedicated roles. A template comes with a preset of an engine, a reactor, and a frame. It may also include a few modules and mounts.
pub async fn purchase_ship(
configuration: &configuration::Configuration,
purchase_ship_request: Option<crate::models::PurchaseShipRequest>,
) -> Result<ResponseContent<PurchaseShipSuccess>, Error<PurchaseShipError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!("{}/my/ships", configuration.base_path);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&purchase_ship_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match PurchaseShipSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match PurchaseShipError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Refuel your ship by buying fuel from the local market. Requires the ship to be docked in a waypoint that has the `Marketplace` trait, and the market must be selling fuel in order to refuel. Each fuel bought from the market replenishes 100 units in your ship's fuel. Ships will always be refuel to their frame's maximum fuel capacity when using this action.
pub async fn refuel_ship(
configuration: &configuration::Configuration,
ship_symbol: &str,
refuel_ship_request: Option<crate::models::RefuelShipRequest>,
) -> Result<ResponseContent<RefuelShipSuccess>, Error<RefuelShipError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/refuel",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&refuel_ship_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match RefuelShipSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match RefuelShipError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Remove a mount from a ship. The ship must be docked in a waypoint that has the `Shipyard` trait, and must have the desired mount that it wish to remove installed. A removal fee will be deduced from the agent by the Shipyard.
pub async fn remove_mount(
configuration: &configuration::Configuration,
ship_symbol: &str,
remove_mount_request: Option<crate::models::RemoveMountRequest>,
) -> Result<ResponseContent<RemoveMountSuccess>, Error<RemoveMountError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/mounts/remove",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&remove_mount_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match RemoveMountSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match RemoveMountError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Sell cargo in your ship to a market that trades this cargo. The ship must be docked in a waypoint that has the `Marketplace` trait in order to use this function.
pub async fn sell_cargo(
configuration: &configuration::Configuration,
ship_symbol: &str,
sell_cargo_request: Option<crate::models::SellCargoRequest>,
) -> Result<ResponseContent<SellCargoSuccess>, Error<SellCargoError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/sell",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&sell_cargo_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match SellCargoSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match SellCargoError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Attempt to refine the raw materials on your ship. The request will only succeed if your ship is capable of refining at the time of the request. In order to be able to refine, a ship must have goods that can be refined and have installed a `Refinery` module that can refine it. When refining, 30 basic goods will be converted into 10 processed goods.
pub async fn ship_refine(
configuration: &configuration::Configuration,
ship_symbol: &str,
ship_refine_request: Option<crate::models::ShipRefineRequest>,
) -> Result<ResponseContent<ShipRefineSuccess>, Error<ShipRefineError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/refine",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&ship_refine_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match ShipRefineSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match ShipRefineError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Transfer cargo between ships. The receiving ship must be in the same waypoint as the transferring ship, and it must able to hold the additional cargo after the transfer is complete. Both ships also must be in the same state, either both are docked or both are orbiting. The response body's cargo shows the cargo of the transferring ship after the transfer is complete.
pub async fn transfer_cargo(
configuration: &configuration::Configuration,
ship_symbol: &str,
transfer_cargo_request: Option<crate::models::TransferCargoRequest>,
) -> Result<ResponseContent<TransferCargoSuccess>, Error<TransferCargoError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/transfer",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&transfer_cargo_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match TransferCargoSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match TransferCargoError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}
/// Warp your ship to a target destination in another system. The ship must be in orbit to use this function and must have the `Warp Drive` module installed. Warping will consume the necessary fuel from the ship's manifest. The returned response will detail the route information including the expected time of arrival. Most ship actions are unavailable until the ship has arrived at its destination.
pub async fn warp_ship(
configuration: &configuration::Configuration,
ship_symbol: &str,
navigate_ship_request: Option<crate::models::NavigateShipRequest>,
) -> Result<ResponseContent<WarpShipSuccess>, Error<WarpShipError>> {
let client = &configuration.client;
// Create the request from a path.
// Make sure to url encode any user given text.
let uri_str = format!(
"{}/my/ships/{shipSymbol}/warp",
configuration.base_path,
shipSymbol = crate::apis::urlencode(ship_symbol)
);
let mut req_builder = client.request(reqwest::Method::POST, &uri_str);
// === Add headers to request ===
// Set the user agent string if given.
if let Some(user_agent) = &configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
// === Add auth to request ===
if let Some(token) = &configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
// === Add body to request ===
req_builder = req_builder.json(&navigate_ship_request);
// === Request is built.
// Execute the request.
let req = req_builder.build()?;
let resp = client.execute(req).await?;
// Get the response.
let status = resp.status();
let response_body = resp.text().await?;
if !status.is_client_error() && !status.is_server_error() {
// Try to parse the OK response.
match WarpShipSuccess::from_body(status, &response_body) {
Some(Ok(content)) => Ok(ResponseContent {
status,
response_body,
content,
}),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: false,
response_body,
}),
}
} else {
// Try to parse the Err response.
match WarpShipError::from_body(status, &response_body) {
Some(Ok(content)) => Err(Error::ResponseError(ResponseContent {
status,
response_body,
content,
})),
Some(Err(err)) => Err(err.into()),
None => Err(Error::UnknownResponse {
status,
is_error: true,
response_body,
}),
}
}
}