/// Add a ship to the users inventory by purchasing it
///
/// # Arguments
///
/// * `location_symbol` - A string containing the location you'd like to purchase the ship from
/// * `ship_type` - A string containing the type of ship you'd like to purchase
Add a ship to the users inventory by purchasing it
Add a ship to the users inventory by purchasing it
pub async fn purchase_ship(&self, location_symbol: String, ship_type: String) -> Result<responses::PurchaseShip, SpaceTradersClientError> {
        let purchase_ship_request = requests::PurchaseShipRequest {
            location: location_symbol.clone(),
            ship_type: ship_type.clone(),
        };
        let http_client = self.http_client.lock().await;
        let response = http_client.execute_request(
            "POST",
            "https://api.spacetraders.io/my/ships",
            Some(&serde_json::to_string(&purchase_ship_request).unwrap()),
            Some(&self.token),
        )
            .await?;
        parse_response::<responses::PurchaseShip>(&response.response_text)
    }
pub async fn purchase_ship ( & self , location_symbol : String , ship_type : String ) -> Result < responses :: PurchaseShip , SpaceTradersClientError > { let purchase_ship_request = requests :: PurchaseShipRequest { location : location_symbol . clone ( ) , ship_type : ship_type . clone ( ) , } ; let http_client = self . http_client . lock ( ) . await ; let response = http_client . execute_request ( " " , " " , Some ( & serde_json :: to_string ( & purchase_ship_request ) . unwrap ( ) ) , Some ( & self . token ) , ) . await ? ; parse_response :: < responses :: PurchaseShip > ( & response . response_text ) }
Add a ship to the users inventory by purchasing it
Add a ship to the users inventory by purchasing it
&self
location_symbol
String
ship_type
String