feature: Added ship details and mining fleet pages

This commit is contained in:
Keith Solomon
2026-02-10 06:23:15 -06:00
parent 58353b249a
commit 2424f87185
6 changed files with 1703 additions and 2 deletions

View File

@@ -329,6 +329,51 @@ class SpacetradersApi {
);
}
/**
* Get information about a single waypoint.
*
* @param string $systemSymbol The system symbol.
* @param string $waypointSymbol The waypoint symbol.
*
* @return array<string,mixed>
*/
public function getWaypoint( string $systemSymbol, string $waypointSymbol ): array {
return $this->request(
'GET',
'/systems/' . rawurlencode( $systemSymbol ) . '/waypoints/' . rawurlencode( $waypointSymbol )
);
}
/**
* Get market data for a waypoint with a marketplace.
*
* @param string $systemSymbol The system symbol.
* @param string $waypointSymbol The waypoint symbol.
*
* @return array<string,mixed>
*/
public function getWaypointMarket( string $systemSymbol, string $waypointSymbol ): array {
return $this->request(
'GET',
'/systems/' . rawurlencode( $systemSymbol ) . '/waypoints/' . rawurlencode( $waypointSymbol ) . '/market'
);
}
/**
* Get shipyard data for a waypoint with a shipyard.
*
* @param string $systemSymbol The system symbol.
* @param string $waypointSymbol The waypoint symbol.
*
* @return array<string,mixed>
*/
public function getWaypointShipyard( string $systemSymbol, string $waypointSymbol ): array {
return $this->request(
'GET',
'/systems/' . rawurlencode( $systemSymbol ) . '/waypoints/' . rawurlencode( $waypointSymbol ) . '/shipyard'
);
}
/**
* Navigate a ship to a specific waypoint.
*
@@ -387,6 +432,61 @@ class SpacetradersApi {
);
}
/**
* Create a survey at the ship's current waypoint.
*
* @param string $shipSymbol The symbol of the ship creating the survey.
*
* @return array<string,mixed>
*/
public function surveyWaypoint( string $shipSymbol ): array {
return $this->request(
'POST',
'/my/ships/' . rawurlencode( $shipSymbol ) . '/survey'
);
}
/**
* Siphon resources at the ship's current waypoint.
*
* @param string $shipSymbol The symbol of the ship performing siphon.
*
* @return array<string,mixed>
*/
public function siphonResources( string $shipSymbol ): array {
return $this->request(
'POST',
'/my/ships/' . rawurlencode( $shipSymbol ) . '/siphon'
);
}
/**
* Refuel a ship.
*
* @param string $shipSymbol The symbol of the ship to refuel.
* @param bool $fromCargo Whether to refuel from cargo instead of market.
* @param int|null $units Optional number of fuel units to buy.
*
* @return array<string,mixed>
*/
public function refuelShip( string $shipSymbol, bool $fromCargo = false, ?int $units = null ): array {
$payload = array();
if ($fromCargo ) {
$payload['fromCargo'] = true;
}
if ($units !== null && $units > 0 ) {
$payload['units'] = $units;
}
return $this->request(
'POST',
'/my/ships/' . rawurlencode( $shipSymbol ) . '/refuel',
$payload
);
}
/**
* Purchase cargo for a specific ship at its current waypoint.
*
@@ -427,6 +527,45 @@ class SpacetradersApi {
);
}
/**
* Jettison cargo from a ship.
*
* @param string $shipSymbol The symbol of the ship.
* @param string $tradeSymbol The cargo symbol to jettison.
* @param int $units Number of units to jettison.
*
* @return array<string,mixed>
*/
public function jettisonCargo( string $shipSymbol, string $tradeSymbol, int $units ): array {
return $this->request(
'POST',
'/my/ships/' . rawurlencode( $shipSymbol ) . '/jettison',
array(
'symbol' => $tradeSymbol,
'units' => $units,
)
);
}
/**
* Purchase a new ship from a shipyard.
*
* @param string $shipType The ship type to purchase.
* @param string $waypointSymbol The shipyard waypoint symbol.
*
* @return array<string,mixed>
*/
public function purchaseShip( string $shipType, string $waypointSymbol ): array {
return $this->request(
'POST',
'/my/ships',
array(
'shipType' => $shipType,
'waypointSymbol' => $waypointSymbol,
)
);
}
/**
* Build the full URL for an API endpoint with optional query parameters.
*