diff --git a/src/.openapi-generator/FILES b/src/.openapi-generator/FILES index 0013e54..83f963b 100644 --- a/src/.openapi-generator/FILES +++ b/src/.openapi-generator/FILES @@ -139,6 +139,7 @@ models/ShipRole.ts models/ShipType.ts models/Shipyard.ts models/ShipyardShip.ts +models/ShipyardShipCrew.ts models/ShipyardShipTypesInner.ts models/ShipyardTransaction.ts models/Survey.ts diff --git a/src/apis/FleetApi.ts b/src/apis/FleetApi.ts index 456a36a..3272a49 100644 --- a/src/apis/FleetApi.ts +++ b/src/apis/FleetApi.ts @@ -52,6 +52,7 @@ import type { SellCargoRequest, ShipRefine201Response, ShipRefineRequest, + Survey, TransferCargo200Response, TransferCargoRequest, } from '../models'; @@ -130,6 +131,8 @@ import { ShipRefine201ResponseToJSON, ShipRefineRequestFromJSON, ShipRefineRequestToJSON, + SurveyFromJSON, + SurveyToJSON, TransferCargo200ResponseFromJSON, TransferCargo200ResponseToJSON, TransferCargoRequestFromJSON, @@ -165,6 +168,11 @@ export interface ExtractResourcesOperationRequest { extractResourcesRequest?: ExtractResourcesRequest; } +export interface ExtractResourcesWithSurveyRequest { + shipSymbol: string; + survey?: Survey; +} + export interface GetMountsRequest { shipSymbol: string; } @@ -508,7 +516,7 @@ export class FleetApi extends runtime.BaseAPI { } /** - * 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. + * 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. The survey property is now deprecated. See the `extract/survey` endpoint for more details. * Extract Resources */ async extractResourcesRaw(requestParameters: ExtractResourcesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -542,7 +550,7 @@ export class FleetApi extends runtime.BaseAPI { } /** - * 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. + * 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. The survey property is now deprecated. See the `extract/survey` endpoint for more details. * Extract Resources */ async extractResources(shipSymbol: string, extractResourcesRequest?: ExtractResourcesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { @@ -550,6 +558,49 @@ export class FleetApi extends runtime.BaseAPI { return await response.value(); } + /** + * Use a survey when extracting resources from a waypoint. This endpoint requires a survey as the payload, which allows your ship to extract specific yields. Send the full survey object as the payload which will be validated according to the signature. If the signature is invalid, or any properties of the survey are changed, the request will fail. + * Extract Resources with Survey + */ + async extractResourcesWithSurveyRaw(requestParameters: ExtractResourcesWithSurveyRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.shipSymbol === null || requestParameters.shipSymbol === undefined) { + throw new runtime.RequiredError('shipSymbol','Required parameter requestParameters.shipSymbol was null or undefined when calling extractResourcesWithSurvey.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("AgentToken", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/my/ships/{shipSymbol}/extract/survey`.replace(`{${"shipSymbol"}}`, encodeURIComponent(String(requestParameters.shipSymbol))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: SurveyToJSON(requestParameters.survey), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ExtractResources201ResponseFromJSON(jsonValue)); + } + + /** + * Use a survey when extracting resources from a waypoint. This endpoint requires a survey as the payload, which allows your ship to extract specific yields. Send the full survey object as the payload which will be validated according to the signature. If the signature is invalid, or any properties of the survey are changed, the request will fail. + * Extract Resources with Survey + */ + async extractResourcesWithSurvey(shipSymbol: string, survey?: Survey, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.extractResourcesWithSurveyRaw({ shipSymbol: shipSymbol, survey: survey }, initOverrides); + return await response.value(); + } + /** * Get the mounts installed on a ship. * Get Mounts diff --git a/src/models/Ship.ts b/src/models/Ship.ts index 1a7b4ac..6445038 100644 --- a/src/models/Ship.ts +++ b/src/models/Ship.ts @@ -13,6 +13,12 @@ */ import { exists, mapValues } from '../runtime'; +import type { Cooldown } from './Cooldown'; +import { + CooldownFromJSON, + CooldownFromJSONTyped, + CooldownToJSON, +} from './Cooldown'; import type { ShipCargo } from './ShipCargo'; import { ShipCargoFromJSON, @@ -122,6 +128,12 @@ export interface Ship { * @memberof Ship */ engine: ShipEngine; + /** + * + * @type {Cooldown} + * @memberof Ship + */ + cooldown: Cooldown; /** * Modules installed in this ship. * @type {Array} @@ -160,6 +172,7 @@ export function instanceOfShip(value: object): boolean { isInstance = isInstance && "frame" in value; isInstance = isInstance && "reactor" in value; isInstance = isInstance && "engine" in value; + isInstance = isInstance && "cooldown" in value; isInstance = isInstance && "modules" in value; isInstance = isInstance && "mounts" in value; isInstance = isInstance && "cargo" in value; @@ -185,6 +198,7 @@ export function ShipFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ship 'frame': ShipFrameFromJSON(json['frame']), 'reactor': ShipReactorFromJSON(json['reactor']), 'engine': ShipEngineFromJSON(json['engine']), + 'cooldown': CooldownFromJSON(json['cooldown']), 'modules': ((json['modules'] as Array).map(ShipModuleFromJSON)), 'mounts': ((json['mounts'] as Array).map(ShipMountFromJSON)), 'cargo': ShipCargoFromJSON(json['cargo']), @@ -208,6 +222,7 @@ export function ShipToJSON(value?: Ship | null): any { 'frame': ShipFrameToJSON(value.frame), 'reactor': ShipReactorToJSON(value.reactor), 'engine': ShipEngineToJSON(value.engine), + 'cooldown': CooldownToJSON(value.cooldown), 'modules': ((value.modules as Array).map(ShipModuleToJSON)), 'mounts': ((value.mounts as Array).map(ShipMountToJSON)), 'cargo': ShipCargoToJSON(value.cargo), diff --git a/src/models/ShipNavRoute.ts b/src/models/ShipNavRoute.ts index d14ebde..6359fa1 100644 --- a/src/models/ShipNavRoute.ts +++ b/src/models/ShipNavRoute.ts @@ -38,6 +38,12 @@ export interface ShipNavRoute { * @memberof ShipNavRoute */ departure: ShipNavRouteWaypoint; + /** + * + * @type {ShipNavRouteWaypoint} + * @memberof ShipNavRoute + */ + origin: ShipNavRouteWaypoint; /** * The date time of the ship's departure. * @type {string} @@ -59,6 +65,7 @@ export function instanceOfShipNavRoute(value: object): boolean { let isInstance = true; isInstance = isInstance && "destination" in value; isInstance = isInstance && "departure" in value; + isInstance = isInstance && "origin" in value; isInstance = isInstance && "departureTime" in value; isInstance = isInstance && "arrival" in value; @@ -77,6 +84,7 @@ export function ShipNavRouteFromJSONTyped(json: any, ignoreDiscriminator: boolea 'destination': ShipNavRouteWaypointFromJSON(json['destination']), 'departure': ShipNavRouteWaypointFromJSON(json['departure']), + 'origin': ShipNavRouteWaypointFromJSON(json['origin']), 'departureTime': json['departureTime'], 'arrival': json['arrival'], }; @@ -93,6 +101,7 @@ export function ShipNavRouteToJSON(value?: ShipNavRoute | null): any { 'destination': ShipNavRouteWaypointToJSON(value.destination), 'departure': ShipNavRouteWaypointToJSON(value.departure), + 'origin': ShipNavRouteWaypointToJSON(value.origin), 'departureTime': value.departureTime, 'arrival': value.arrival, }; diff --git a/src/models/Shipyard.ts b/src/models/Shipyard.ts index 9dbf0da..11eb1a1 100644 --- a/src/models/Shipyard.ts +++ b/src/models/Shipyard.ts @@ -62,6 +62,12 @@ export interface Shipyard { * @memberof Shipyard */ ships?: Array; + /** + * The fee to modify a ship at this shipyard. This includes installing or removing modules and mounts on a ship. In the case of mounts, the fee is a flat rate per mount. In the case of modules, the fee is per slot the module occupies. + * @type {number} + * @memberof Shipyard + */ + modificationsFee: number; } /** @@ -71,6 +77,7 @@ export function instanceOfShipyard(value: object): boolean { let isInstance = true; isInstance = isInstance && "symbol" in value; isInstance = isInstance && "shipTypes" in value; + isInstance = isInstance && "modificationsFee" in value; return isInstance; } @@ -89,6 +96,7 @@ export function ShipyardFromJSONTyped(json: any, ignoreDiscriminator: boolean): 'shipTypes': ((json['shipTypes'] as Array).map(ShipyardShipTypesInnerFromJSON)), 'transactions': !exists(json, 'transactions') ? undefined : ((json['transactions'] as Array).map(ShipyardTransactionFromJSON)), 'ships': !exists(json, 'ships') ? undefined : ((json['ships'] as Array).map(ShipyardShipFromJSON)), + 'modificationsFee': json['modificationsFee'], }; } @@ -105,6 +113,7 @@ export function ShipyardToJSON(value?: Shipyard | null): any { 'shipTypes': ((value.shipTypes as Array).map(ShipyardShipTypesInnerToJSON)), 'transactions': value.transactions === undefined ? undefined : ((value.transactions as Array).map(ShipyardTransactionToJSON)), 'ships': value.ships === undefined ? undefined : ((value.ships as Array).map(ShipyardShipToJSON)), + 'modificationsFee': value.modificationsFee, }; } diff --git a/src/models/ShipyardShip.ts b/src/models/ShipyardShip.ts index e920e2d..d539e3b 100644 --- a/src/models/ShipyardShip.ts +++ b/src/models/ShipyardShip.ts @@ -49,6 +49,12 @@ import { ShipTypeFromJSONTyped, ShipTypeToJSON, } from './ShipType'; +import type { ShipyardShipCrew } from './ShipyardShipCrew'; +import { + ShipyardShipCrewFromJSON, + ShipyardShipCrewFromJSONTyped, + ShipyardShipCrewToJSON, +} from './ShipyardShipCrew'; /** * @@ -110,6 +116,12 @@ export interface ShipyardShip { * @memberof ShipyardShip */ mounts: Array; + /** + * + * @type {ShipyardShipCrew} + * @memberof ShipyardShip + */ + crew: ShipyardShipCrew; } /** @@ -125,6 +137,7 @@ export function instanceOfShipyardShip(value: object): boolean { isInstance = isInstance && "engine" in value; isInstance = isInstance && "modules" in value; isInstance = isInstance && "mounts" in value; + isInstance = isInstance && "crew" in value; return isInstance; } @@ -148,6 +161,7 @@ export function ShipyardShipFromJSONTyped(json: any, ignoreDiscriminator: boolea 'engine': ShipEngineFromJSON(json['engine']), 'modules': ((json['modules'] as Array).map(ShipModuleFromJSON)), 'mounts': ((json['mounts'] as Array).map(ShipMountFromJSON)), + 'crew': ShipyardShipCrewFromJSON(json['crew']), }; } @@ -169,6 +183,7 @@ export function ShipyardShipToJSON(value?: ShipyardShip | null): any { 'engine': ShipEngineToJSON(value.engine), 'modules': ((value.modules as Array).map(ShipModuleToJSON)), 'mounts': ((value.mounts as Array).map(ShipMountToJSON)), + 'crew': ShipyardShipCrewToJSON(value.crew), }; } diff --git a/src/models/ShipyardShipCrew.ts b/src/models/ShipyardShipCrew.ts new file mode 100644 index 0000000..ea7e3fc --- /dev/null +++ b/src/models/ShipyardShipCrew.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * SpaceTraders API + * SpaceTraders is an open-universe game and learning platform that offers a set of HTTP endpoints to control a fleet of ships and explore a multiplayer universe. The API is documented using [OpenAPI](https://github.com/SpaceTradersAPI/api-docs). You can send your first request right here in your browser to check the status of the game server. ```json http { \"method\": \"GET\", \"url\": \"https://api.spacetraders.io/v2\", } ``` Unlike a traditional game, SpaceTraders does not have a first-party client or app to play the game. Instead, you can use the API to build your own client, write a script to automate your ships, or try an app built by the community. We have a [Discord channel](https://discord.com/invite/jh6zurdWk5) where you can share your projects, ask questions, and get help from other players. + * + * The version of the OpenAPI document: 2.0.0 + * Contact: joel@spacetraders.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface ShipyardShipCrew + */ +export interface ShipyardShipCrew { + /** + * + * @type {number} + * @memberof ShipyardShipCrew + */ + required: number; + /** + * + * @type {number} + * @memberof ShipyardShipCrew + */ + capacity: number; +} + +/** + * Check if a given object implements the ShipyardShipCrew interface. + */ +export function instanceOfShipyardShipCrew(value: object): boolean { + let isInstance = true; + isInstance = isInstance && "required" in value; + isInstance = isInstance && "capacity" in value; + + return isInstance; +} + +export function ShipyardShipCrewFromJSON(json: any): ShipyardShipCrew { + return ShipyardShipCrewFromJSONTyped(json, false); +} + +export function ShipyardShipCrewFromJSONTyped(json: any, ignoreDiscriminator: boolean): ShipyardShipCrew { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'required': json['required'], + 'capacity': json['capacity'], + }; +} + +export function ShipyardShipCrewToJSON(value?: ShipyardShipCrew | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'required': value.required, + 'capacity': value.capacity, + }; +} + diff --git a/src/models/Survey.ts b/src/models/Survey.ts index 8c03ba0..8685d8d 100644 --- a/src/models/Survey.ts +++ b/src/models/Survey.ts @@ -39,7 +39,7 @@ export interface Survey { */ symbol: string; /** - * A list of deposits that can be found at this location. + * A list of deposits that can be found at this location. A ship will extract one of these deposits when using this survey in an extraction request. If multiple deposits of the same type are present, the chance of extracting that deposit is increased. * @type {Array} * @memberof Survey */ diff --git a/src/models/System.ts b/src/models/System.ts index e238713..185f766 100644 --- a/src/models/System.ts +++ b/src/models/System.ts @@ -57,13 +57,13 @@ export interface System { */ type: SystemType; /** - * Position in the universe in the x axis. + * Relative position of the system in the sector in the x axis. * @type {number} * @memberof System */ x: number; /** - * Position in the universe in the y axis. + * Relative position of the system in the sector in the y axis. * @type {number} * @memberof System */ diff --git a/src/models/SystemWaypoint.ts b/src/models/SystemWaypoint.ts index 884f574..aee68df 100644 --- a/src/models/SystemWaypoint.ts +++ b/src/models/SystemWaypoint.ts @@ -13,6 +13,12 @@ */ import { exists, mapValues } from '../runtime'; +import type { WaypointOrbital } from './WaypointOrbital'; +import { + WaypointOrbitalFromJSON, + WaypointOrbitalFromJSONTyped, + WaypointOrbitalToJSON, +} from './WaypointOrbital'; import type { WaypointType } from './WaypointType'; import { WaypointTypeFromJSON, @@ -39,17 +45,29 @@ export interface SystemWaypoint { */ type: WaypointType; /** - * Position in the universe in the x axis. + * Relative position of the waypoint on the system's x axis. This is not an absolute position in the universe. * @type {number} * @memberof SystemWaypoint */ x: number; /** - * Position in the universe in the y axis. + * Relative position of the waypoint on the system's y axis. This is not an absolute position in the universe. * @type {number} * @memberof SystemWaypoint */ y: number; + /** + * Waypoints that orbit this waypoint. + * @type {Array} + * @memberof SystemWaypoint + */ + orbitals: Array; + /** + * The symbol of the parent waypoint, if this waypoint is in orbit around another waypoint. Otherwise this value is undefined. + * @type {string} + * @memberof SystemWaypoint + */ + orbits?: string; } /** @@ -61,6 +79,7 @@ export function instanceOfSystemWaypoint(value: object): boolean { isInstance = isInstance && "type" in value; isInstance = isInstance && "x" in value; isInstance = isInstance && "y" in value; + isInstance = isInstance && "orbitals" in value; return isInstance; } @@ -79,6 +98,8 @@ export function SystemWaypointFromJSONTyped(json: any, ignoreDiscriminator: bool 'type': WaypointTypeFromJSON(json['type']), 'x': json['x'], 'y': json['y'], + 'orbitals': ((json['orbitals'] as Array).map(WaypointOrbitalFromJSON)), + 'orbits': !exists(json, 'orbits') ? undefined : json['orbits'], }; } @@ -95,6 +116,8 @@ export function SystemWaypointToJSON(value?: SystemWaypoint | null): any { 'type': WaypointTypeToJSON(value.type), 'x': value.x, 'y': value.y, + 'orbitals': ((value.orbitals as Array).map(WaypointOrbitalToJSON)), + 'orbits': value.orbits, }; } diff --git a/src/models/Waypoint.ts b/src/models/Waypoint.ts index 639a6e7..2d789e9 100644 --- a/src/models/Waypoint.ts +++ b/src/models/Waypoint.ts @@ -69,13 +69,13 @@ export interface Waypoint { */ systemSymbol: string; /** - * Position in the universe in the x axis. + * Relative position of the waypoint on the system's x axis. This is not an absolute position in the universe. * @type {number} * @memberof Waypoint */ x: number; /** - * Position in the universe in the Y axis. + * Relative position of the waypoint on the system's y axis. This is not an absolute position in the universe. * @type {number} * @memberof Waypoint */ @@ -86,6 +86,12 @@ export interface Waypoint { * @memberof Waypoint */ orbitals: Array; + /** + * The symbol of the parent waypoint, if this waypoint is in orbit around another waypoint. Otherwise this value is undefined. + * @type {string} + * @memberof Waypoint + */ + orbits?: string; /** * * @type {WaypointFaction} @@ -138,6 +144,7 @@ export function WaypointFromJSONTyped(json: any, ignoreDiscriminator: boolean): 'x': json['x'], 'y': json['y'], 'orbitals': ((json['orbitals'] as Array).map(WaypointOrbitalFromJSON)), + 'orbits': !exists(json, 'orbits') ? undefined : json['orbits'], 'faction': !exists(json, 'faction') ? undefined : WaypointFactionFromJSON(json['faction']), 'traits': ((json['traits'] as Array).map(WaypointTraitFromJSON)), 'chart': !exists(json, 'chart') ? undefined : ChartFromJSON(json['chart']), @@ -159,6 +166,7 @@ export function WaypointToJSON(value?: Waypoint | null): any { 'x': value.x, 'y': value.y, 'orbitals': ((value.orbitals as Array).map(WaypointOrbitalToJSON)), + 'orbits': value.orbits, 'faction': WaypointFactionToJSON(value.faction), 'traits': ((value.traits as Array).map(WaypointTraitToJSON)), 'chart': ChartToJSON(value.chart), diff --git a/src/models/index.ts b/src/models/index.ts index cb18329..8f9e868 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -133,6 +133,7 @@ export * from './ShipRole'; export * from './ShipType'; export * from './Shipyard'; export * from './ShipyardShip'; +export * from './ShipyardShipCrew'; export * from './ShipyardShipTypesInner'; export * from './ShipyardTransaction'; export * from './Survey';