Skip to content

Commit

Permalink
regenerate client for v2023-05-20
Browse files Browse the repository at this point in the history
  • Loading branch information
jonchurch committed May 20, 2023
1 parent bc0a0df commit 9f1cd12
Show file tree
Hide file tree
Showing 19 changed files with 1,026 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ models/GetMyShips200Response.ts
models/GetShipCooldown200Response.ts
models/GetShipNav200Response.ts
models/GetShipyard200Response.ts
models/GetStatus200Response.ts
models/GetStatus200ResponseAnnouncementsInner.ts
models/GetStatus200ResponseLeaderboards.ts
models/GetStatus200ResponseLeaderboardsMostCreditsInner.ts
models/GetStatus200ResponseLeaderboardsMostSubmittedChartsInner.ts
models/GetStatus200ResponseLinksInner.ts
models/GetStatus200ResponseServerResets.ts
models/GetStatus200ResponseStats.ts
models/GetSystem200Response.ts
models/GetSystemWaypoints200Response.ts
models/GetSystems200Response.ts
Expand All @@ -69,6 +77,8 @@ models/Meta.ts
models/NavigateShip200Response.ts
models/NavigateShip200ResponseData.ts
models/NavigateShipRequest.ts
models/NegotiateContract200Response.ts
models/NegotiateContract200ResponseData.ts
models/OrbitShip200Response.ts
models/OrbitShip200ResponseData.ts
models/PatchShipNavRequest.ts
Expand Down
39 changes: 39 additions & 0 deletions src/apis/DefaultApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@

import * as runtime from '../runtime';
import type {
GetStatus200Response,
Register201Response,
RegisterRequest,
} from '../models';
import {
GetStatus200ResponseFromJSON,
GetStatus200ResponseToJSON,
Register201ResponseFromJSON,
Register201ResponseToJSON,
RegisterRequestFromJSON,
Expand All @@ -34,6 +37,42 @@ export interface RegisterOperationRequest {
*/
export class DefaultApi extends runtime.BaseAPI {

/**
* Return the status of the game server.
* Get Status
*/
async getStatusRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetStatus200Response>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

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: `/`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => GetStatus200ResponseFromJSON(jsonValue));
}

/**
* Return the status of the game server.
* Get Status
*/
async getStatus(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetStatus200Response> {
const response = await this.getStatusRaw(initOverrides);
return await response.value();
}

/**
* Creates a new agent and ties it to a temporary Account. The agent symbol is a 3-14 character string that will represent your agent. This symbol will prefix the symbol of every ship you own. Agent symbols will be cast to all uppercase characters. A new agent will be granted an authorization token, a contract with their starting faction, a command ship with a jump drive, and one hundred thousand credits. > #### Keep your token safe and secure > > Save your token during the alpha phase. There is no way to regenerate this token without starting a new agent. In the future you will be able to generate and manage your tokens from the SpaceTraders website. You can accept your contract using the `/my/contracts/{contractId}/accept` endpoint. You will want to navigate your command ship to a nearby asteroid field and execute the `/my/ships/{shipSymbol}/extract` endpoint to mine various types of ores and minerals. Return to the contract destination and execute the `/my/ships/{shipSymbol}/deliver` endpoint to deposit goods into the contract. When your contract is fulfilled, you can call `/my/contracts/{contractId}/fulfill` to retrieve payment.
* Register New Agent
Expand Down
51 changes: 51 additions & 0 deletions src/apis/FleetApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import type {
JumpShipRequest,
NavigateShip200Response,
NavigateShipRequest,
NegotiateContract200Response,
OrbitShip200Response,
PatchShipNavRequest,
PurchaseCargo201Response,
Expand Down Expand Up @@ -87,6 +88,8 @@ import {
NavigateShip200ResponseToJSON,
NavigateShipRequestFromJSON,
NavigateShipRequestToJSON,
NegotiateContract200ResponseFromJSON,
NegotiateContract200ResponseToJSON,
OrbitShip200ResponseFromJSON,
OrbitShip200ResponseToJSON,
PatchShipNavRequestFromJSON,
Expand Down Expand Up @@ -180,6 +183,11 @@ export interface NavigateShipOperationRequest {
navigateShipRequest?: NavigateShipRequest;
}

export interface NegotiateContractRequest {
shipSymbol: string;
body?: any | null;
}

export interface OrbitShipRequest {
shipSymbol: string;
}
Expand Down Expand Up @@ -843,6 +851,49 @@ export class FleetApi extends runtime.BaseAPI {
return await response.value();
}

/**
*
* Negotiate Contract
*/
async negotiateContractRaw(requestParameters: NegotiateContractRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NegotiateContract200Response>> {
if (requestParameters.shipSymbol === null || requestParameters.shipSymbol === undefined) {
throw new runtime.RequiredError('shipSymbol','Required parameter requestParameters.shipSymbol was null or undefined when calling negotiateContract.');
}

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}/negotiate/contract`.replace(`{${"shipSymbol"}}`, encodeURIComponent(String(requestParameters.shipSymbol))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: requestParameters.body as any,
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => NegotiateContract200ResponseFromJSON(jsonValue));
}

/**
*
* Negotiate Contract
*/
async negotiateContract(shipSymbol: string, body?: any | null, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NegotiateContract200Response> {
const response = await this.negotiateContractRaw({ shipSymbol: shipSymbol, body: body }, initOverrides);
return await response.value();
}

/**
* Attempt to move your ship into orbit at it\'s current location. The request will only succeed if your ship is capable of moving into orbit at the time of the request. The endpoint is idempotent - successive calls will succeed even if the ship is already in orbit.
* Orbit Ship
Expand Down
9 changes: 9 additions & 0 deletions src/models/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export interface Agent {
* @memberof Agent
*/
credits: number;
/**
* The faction the agent started with.
* @type {string}
* @memberof Agent
*/
startingFaction: string;
}

/**
Expand All @@ -54,6 +60,7 @@ export function instanceOfAgent(value: object): boolean {
isInstance = isInstance && "symbol" in value;
isInstance = isInstance && "headquarters" in value;
isInstance = isInstance && "credits" in value;
isInstance = isInstance && "startingFaction" in value;

return isInstance;
}
Expand All @@ -72,6 +79,7 @@ export function AgentFromJSONTyped(json: any, ignoreDiscriminator: boolean): Age
'symbol': json['symbol'],
'headquarters': json['headquarters'],
'credits': json['credits'],
'startingFaction': json['startingFaction'],
};
}

Expand All @@ -88,6 +96,7 @@ export function AgentToJSON(value?: Agent | null): any {
'symbol': value.symbol,
'headquarters': value.headquarters,
'credits': value.credits,
'startingFaction': value.startingFaction,
};
}

11 changes: 10 additions & 1 deletion src/models/Contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,18 @@ export interface Contract {
*/
fulfilled: boolean;
/**
* The time at which the contract expires
* Deprecated in favor of deadlineToAccept
* @type {string}
* @memberof Contract
* @deprecated
*/
expiration: string;
/**
* The time at which the contract is no longer available to be accepted
* @type {string}
* @memberof Contract
*/
deadlineToAccept?: string;
}


Expand Down Expand Up @@ -115,6 +122,7 @@ export function ContractFromJSONTyped(json: any, ignoreDiscriminator: boolean):
'accepted': json['accepted'],
'fulfilled': json['fulfilled'],
'expiration': json['expiration'],
'deadlineToAccept': !exists(json, 'deadlineToAccept') ? undefined : json['deadlineToAccept'],
};
}

Expand All @@ -134,6 +142,7 @@ export function ContractToJSON(value?: Contract | null): any {
'accepted': value.accepted,
'fulfilled': value.fulfilled,
'expiration': value.expiration,
'deadlineToAccept': value.deadlineToAccept,
};
}

5 changes: 2 additions & 3 deletions src/models/Cooldown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface Cooldown {
* @type {string}
* @memberof Cooldown
*/
expiration: string;
expiration?: string;
}

/**
Expand All @@ -53,7 +53,6 @@ export function instanceOfCooldown(value: object): boolean {
isInstance = isInstance && "shipSymbol" in value;
isInstance = isInstance && "totalSeconds" in value;
isInstance = isInstance && "remainingSeconds" in value;
isInstance = isInstance && "expiration" in value;

return isInstance;
}
Expand All @@ -71,7 +70,7 @@ export function CooldownFromJSONTyped(json: any, ignoreDiscriminator: boolean):
'shipSymbol': json['shipSymbol'],
'totalSeconds': json['totalSeconds'],
'remainingSeconds': json['remainingSeconds'],
'expiration': json['expiration'],
'expiration': !exists(json, 'expiration') ? undefined : json['expiration'],
};
}

Expand Down
9 changes: 9 additions & 0 deletions src/models/Faction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ export interface Faction {
* @memberof Faction
*/
traits: Array<FactionTrait>;
/**
* Whether or not the faction is currently recruiting new agents.
* @type {boolean}
* @memberof Faction
*/
isRecruiting: boolean;
}

/**
Expand All @@ -68,6 +74,7 @@ export function instanceOfFaction(value: object): boolean {
isInstance = isInstance && "description" in value;
isInstance = isInstance && "headquarters" in value;
isInstance = isInstance && "traits" in value;
isInstance = isInstance && "isRecruiting" in value;

return isInstance;
}
Expand All @@ -87,6 +94,7 @@ export function FactionFromJSONTyped(json: any, ignoreDiscriminator: boolean): F
'description': json['description'],
'headquarters': json['headquarters'],
'traits': ((json['traits'] as Array<any>).map(FactionTraitFromJSON)),
'isRecruiting': json['isRecruiting'],
};
}

Expand All @@ -104,6 +112,7 @@ export function FactionToJSON(value?: Faction | null): any {
'description': value.description,
'headquarters': value.headquarters,
'traits': ((value.traits as Array<any>).map(FactionTraitToJSON)),
'isRecruiting': value.isRecruiting,
};
}

0 comments on commit 9f1cd12

Please sign in to comment.