Skip to content

Commit

Permalink
regenerate client
Browse files Browse the repository at this point in the history
  • Loading branch information
jonchurch committed Sep 23, 2023
1 parent ebba729 commit 0b0b40d
Show file tree
Hide file tree
Showing 12 changed files with 216 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
55 changes: 53 additions & 2 deletions src/apis/FleetApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import type {
SellCargoRequest,
ShipRefine201Response,
ShipRefineRequest,
Survey,
TransferCargo200Response,
TransferCargoRequest,
} from '../models';
Expand Down Expand Up @@ -130,6 +131,8 @@ import {
ShipRefine201ResponseToJSON,
ShipRefineRequestFromJSON,
ShipRefineRequestToJSON,
SurveyFromJSON,
SurveyToJSON,
TransferCargo200ResponseFromJSON,
TransferCargo200ResponseToJSON,
TransferCargoRequestFromJSON,
Expand Down Expand Up @@ -165,6 +168,11 @@ export interface ExtractResourcesOperationRequest {
extractResourcesRequest?: ExtractResourcesRequest;
}

export interface ExtractResourcesWithSurveyRequest {
shipSymbol: string;
survey?: Survey;
}

export interface GetMountsRequest {
shipSymbol: string;
}
Expand Down Expand Up @@ -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<runtime.ApiResponse<ExtractResources201Response>> {
Expand Down Expand Up @@ -542,14 +550,57 @@ 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<ExtractResources201Response> {
const response = await this.extractResourcesRaw({ shipSymbol: shipSymbol, extractResourcesRequest: extractResourcesRequest }, initOverrides);
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<runtime.ApiResponse<ExtractResources201Response>> {
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<ExtractResources201Response> {
const response = await this.extractResourcesWithSurveyRaw({ shipSymbol: shipSymbol, survey: survey }, initOverrides);
return await response.value();
}

/**
* Get the mounts installed on a ship.
* Get Mounts
Expand Down
15 changes: 15 additions & 0 deletions src/models/Ship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -122,6 +128,12 @@ export interface Ship {
* @memberof Ship
*/
engine: ShipEngine;
/**
*
* @type {Cooldown}
* @memberof Ship
*/
cooldown: Cooldown;
/**
* Modules installed in this ship.
* @type {Array<ShipModule>}
Expand Down Expand Up @@ -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;
Expand All @@ -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<any>).map(ShipModuleFromJSON)),
'mounts': ((json['mounts'] as Array<any>).map(ShipMountFromJSON)),
'cargo': ShipCargoFromJSON(json['cargo']),
Expand All @@ -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<any>).map(ShipModuleToJSON)),
'mounts': ((value.mounts as Array<any>).map(ShipMountToJSON)),
'cargo': ShipCargoToJSON(value.cargo),
Expand Down
9 changes: 9 additions & 0 deletions src/models/ShipNavRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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;

Expand All @@ -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'],
};
Expand All @@ -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,
};
Expand Down
9 changes: 9 additions & 0 deletions src/models/Shipyard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export interface Shipyard {
* @memberof Shipyard
*/
ships?: Array<ShipyardShip>;
/**
* 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;
}

/**
Expand All @@ -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;
}
Expand All @@ -89,6 +96,7 @@ export function ShipyardFromJSONTyped(json: any, ignoreDiscriminator: boolean):
'shipTypes': ((json['shipTypes'] as Array<any>).map(ShipyardShipTypesInnerFromJSON)),
'transactions': !exists(json, 'transactions') ? undefined : ((json['transactions'] as Array<any>).map(ShipyardTransactionFromJSON)),
'ships': !exists(json, 'ships') ? undefined : ((json['ships'] as Array<any>).map(ShipyardShipFromJSON)),
'modificationsFee': json['modificationsFee'],
};
}

Expand All @@ -105,6 +113,7 @@ export function ShipyardToJSON(value?: Shipyard | null): any {
'shipTypes': ((value.shipTypes as Array<any>).map(ShipyardShipTypesInnerToJSON)),
'transactions': value.transactions === undefined ? undefined : ((value.transactions as Array<any>).map(ShipyardTransactionToJSON)),
'ships': value.ships === undefined ? undefined : ((value.ships as Array<any>).map(ShipyardShipToJSON)),
'modificationsFee': value.modificationsFee,
};
}

15 changes: 15 additions & 0 deletions src/models/ShipyardShip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ import {
ShipTypeFromJSONTyped,
ShipTypeToJSON,
} from './ShipType';
import type { ShipyardShipCrew } from './ShipyardShipCrew';
import {
ShipyardShipCrewFromJSON,
ShipyardShipCrewFromJSONTyped,
ShipyardShipCrewToJSON,
} from './ShipyardShipCrew';

/**
*
Expand Down Expand Up @@ -110,6 +116,12 @@ export interface ShipyardShip {
* @memberof ShipyardShip
*/
mounts: Array<ShipMount>;
/**
*
* @type {ShipyardShipCrew}
* @memberof ShipyardShip
*/
crew: ShipyardShipCrew;
}

/**
Expand All @@ -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;
}
Expand All @@ -148,6 +161,7 @@ export function ShipyardShipFromJSONTyped(json: any, ignoreDiscriminator: boolea
'engine': ShipEngineFromJSON(json['engine']),
'modules': ((json['modules'] as Array<any>).map(ShipModuleFromJSON)),
'mounts': ((json['mounts'] as Array<any>).map(ShipMountFromJSON)),
'crew': ShipyardShipCrewFromJSON(json['crew']),
};
}

Expand All @@ -169,6 +183,7 @@ export function ShipyardShipToJSON(value?: ShipyardShip | null): any {
'engine': ShipEngineToJSON(value.engine),
'modules': ((value.modules as Array<any>).map(ShipModuleToJSON)),
'mounts': ((value.mounts as Array<any>).map(ShipMountToJSON)),
'crew': ShipyardShipCrewToJSON(value.crew),
};
}

75 changes: 75 additions & 0 deletions src/models/ShipyardShipCrew.ts
Original file line number Diff line number Diff line change
@@ -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,
};
}

2 changes: 1 addition & 1 deletion src/models/Survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<SurveyDeposit>}
* @memberof Survey
*/
Expand Down
4 changes: 2 additions & 2 deletions src/models/System.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 0b0b40d

Please sign in to comment.