Modified 2 files

This commit is contained in:
SpaceAdmiral 2022-03-10 17:33:09 -08:00
parent 825fb1fc3d
commit e5fe235fa6
2 changed files with 142 additions and 27 deletions

View File

@ -95,7 +95,7 @@ properties:
cargo: cargo:
type: array type: array
uniqueItems: true uniqueItems: true
minItems: 1 minItems: 0
items: items:
type: object type: object
properties: properties:

View File

@ -7,6 +7,7 @@ info:
name: Joel Brubaker name: Joel Brubaker
email: joel@spacetraders.io email: joel@spacetraders.io
license: license:
identifier: 'https://choosealicense.com/no-permission/'
name: 'No' name: 'No'
description: |- description: |-
SpaceTraders is a unique multiplayer game built on a free Web API. You control a fleets of ships that can explore the universe, mine asteroids, automate trade routes, meet new factions, and discover hidden technology. SpaceTraders is a unique multiplayer game built on a free Web API. You control a fleets of ships that can explore the universe, mine asteroids, automate trade routes, meet new factions, and discover hidden technology.
@ -27,11 +28,12 @@ servers:
paths: paths:
/agents: /agents:
post: post:
summary: Register as a new agent summary: Register a new agent
tags: [] tags:
- agents
responses: responses:
'201': '201':
description: Created description: OK
content: content:
application/json: application/json:
schema: schema:
@ -111,7 +113,22 @@ paths:
- tradeSymbol: string - tradeSymbol: string
units: 0 units: 0
operationId: post-agents operationId: post-agents
description: Creates a new agent and ties it to a temporary account. description: |-
Creates a new agent and ties it to a temporary Account. Use `COMMERCE_REPUBLIC` as your starting faction if you don't know any other factions to choose from.
The agent symbol is a 4-8 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 waypoint, and execute the `/my/ships/{shipSymbol}/accept` 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.
requestBody: requestBody:
content: content:
application/json: application/json:
@ -120,12 +137,21 @@ paths:
properties: properties:
symbol: symbol:
type: string type: string
description: How other agents will see your ships and information.
minLength: 4
maxLength: 8
example: BADGER
faction: faction:
type: string type: string
default: COMMERCE_REPUBLIC
description: The faction you choose determines your headquarters.
description: ''
/my/agent: /my/agent:
get: get:
summary: Get your agent details summary: Get your agent details
tags: [] tags:
- agents
- my
responses: responses:
'200': '200':
description: OK description: OK
@ -146,11 +172,15 @@ paths:
credits: 0 credits: 0
operationId: get-my-agent operationId: get-my-agent
security: security:
- Agent Token: [] - AgentToken: []
description: Fetch your agent's details.
'/my/ships/{shipSymbol}/chart': '/my/ships/{shipSymbol}/chart':
post: post:
summary: Submit a system or waypoint chart summary: Submit a system or waypoint chart
tags: [] tags:
- my
- ships
- chart
responses: responses:
'201': '201':
description: Created description: Created
@ -175,6 +205,8 @@ paths:
- X1-ZZ-7-EE - X1-ZZ-7-EE
operationId: 'post-my-ships-:shipSymbol-chart' operationId: 'post-my-ships-:shipSymbol-chart'
description: Chart a new system or waypoint. description: Chart a new system or waypoint.
security:
- AgentToken: []
parameters: parameters:
- schema: - schema:
type: string type: string
@ -192,7 +224,11 @@ paths:
description: The symbol of the ship description: The symbol of the ship
post: post:
summary: Deliver goods on a contract summary: Deliver goods on a contract
tags: [] tags:
- contracts
- my
- ships
- deliver
responses: responses:
'201': '201':
description: Created description: Created
@ -214,6 +250,8 @@ paths:
required: required:
- data - data
operationId: post-my-ships-shipSymbol-deliver operationId: post-my-ships-shipSymbol-deliver
security:
- AgentToken: []
'/my/ships/{shipSymbol}/dock': '/my/ships/{shipSymbol}/dock':
parameters: parameters:
- schema: - schema:
@ -224,7 +262,10 @@ paths:
description: The symbol of the ship description: The symbol of the ship
post: post:
summary: Dock your ship summary: Dock your ship
tags: [] tags:
- my
- ships
- dock
responses: responses:
'201': '201':
description: Created description: Created
@ -253,6 +294,8 @@ paths:
data: data:
status: DOCKED status: DOCKED
operationId: post-my-ships-shipSymbol-dock operationId: post-my-ships-shipSymbol-dock
security:
- AgentToken: []
'/my/ships/{shipSymbol}/orbit': '/my/ships/{shipSymbol}/orbit':
parameters: parameters:
- schema: - schema:
@ -263,7 +306,10 @@ paths:
description: The symbol of the ship description: The symbol of the ship
post: post:
summary: Transition your ship into orbit summary: Transition your ship into orbit
tags: [] tags:
- my
- ships
- orbit
responses: responses:
'201': '201':
description: Created description: Created
@ -290,6 +336,9 @@ paths:
data: data:
status: ORBIT status: ORBIT
operationId: post-my-ships-shipSymbol-orbit operationId: post-my-ships-shipSymbol-orbit
security:
- AgentToken: []
description: Transition your ship from docked into orbit. Ships are placed into orbit by default when arriving at a destination. Consecutive calls to this endpoint will continue to return a 200 response status.
'/my/ships/{shipSymbol}/jettison': '/my/ships/{shipSymbol}/jettison':
parameters: parameters:
- schema: - schema:
@ -299,7 +348,10 @@ paths:
required: true required: true
post: post:
summary: Jettison cargo from your ship summary: Jettison cargo from your ship
tags: [] tags:
- my
- ships
- jettison
responses: responses:
'201': '201':
description: Created description: Created
@ -335,6 +387,8 @@ paths:
units: 95 units: 95
operationId: post-my-ships-shipSymbol-jettison operationId: post-my-ships-shipSymbol-jettison
description: Jettison cargo from your ship's cargo hold. description: Jettison cargo from your ship's cargo hold.
security:
- AgentToken: []
'/my/ships/{shipSymbol}/extract': '/my/ships/{shipSymbol}/extract':
parameters: parameters:
- schema: - schema:
@ -342,9 +396,15 @@ paths:
name: shipSymbol name: shipSymbol
in: path in: path
required: true required: true
description: The ship symbol
post: post:
summary: Extract resources from a waypoint summary: Extract resources from a waypoint
tags: [] tags:
- extract
- mining
- my
- ships
- survey
responses: responses:
'201': '201':
description: Created description: Created
@ -406,6 +466,8 @@ paths:
survey: survey:
$ref: ../models/Survey.yaml $ref: ../models/Survey.yaml
description: Extract resources from the waypoint into your ship. Send a survey as the payload to target specific yields. description: Extract resources from the waypoint into your ship. Send a survey as the payload to target specific yields.
security:
- AgentToken: []
'/my/ships/{shipSymbol}/jump': '/my/ships/{shipSymbol}/jump':
parameters: parameters:
- schema: - schema:
@ -415,7 +477,11 @@ paths:
required: true required: true
post: post:
summary: Jump to a new system summary: Jump to a new system
tags: [] tags:
- jump
- my
- ships
- navigation
responses: responses:
'201': '201':
description: Created description: Created
@ -456,6 +522,8 @@ paths:
destination: 0b1802ba-da4d-4308-aefb-1e5065f98a53 destination: 0b1802ba-da4d-4308-aefb-1e5065f98a53
cooldown: 43200 cooldown: 43200
operationId: post-my-ships-shipSymbol-jump operationId: post-my-ships-shipSymbol-jump
security:
- AgentToken: []
'/my/ships/{shipSymbol}/purchase': '/my/ships/{shipSymbol}/purchase':
parameters: parameters:
- schema: - schema:
@ -465,7 +533,12 @@ paths:
required: true required: true
post: post:
summary: Purchase cargo for your ship summary: Purchase cargo for your ship
tags: [] tags:
- markets
- my
- purchase
- ships
- trade
responses: responses:
'201': '201':
description: Created description: Created
@ -511,6 +584,8 @@ paths:
credits: -843 credits: -843
units: 1 units: 1
operationId: post-my-ships-shipSymbol-purchase operationId: post-my-ships-shipSymbol-purchase
security:
- AgentToken: []
'/my/ships/{shipSymbol}/refuel': '/my/ships/{shipSymbol}/refuel':
parameters: parameters:
- schema: - schema:
@ -520,7 +595,10 @@ paths:
required: true required: true
post: post:
summary: Refuel your ship summary: Refuel your ship
tags: [] tags:
- my
- ships
- refuel
responses: responses:
'201': '201':
description: Created description: Created
@ -554,6 +632,8 @@ paths:
credits: -1920 credits: -1920
fuel: 800 fuel: 800
operationId: post-my-ships-shipSymbol-refuel operationId: post-my-ships-shipSymbol-refuel
security:
- AgentToken: []
'/my/ships/{shipSymbol}/scan': '/my/ships/{shipSymbol}/scan':
parameters: parameters:
- schema: - schema:
@ -563,7 +643,10 @@ paths:
required: true required: true
post: post:
summary: Scan approaching or departing ships from your location summary: Scan approaching or departing ships from your location
tags: [] tags:
- my
- ships
- scan
responses: responses:
'201': '201':
description: Created description: Created
@ -794,6 +877,8 @@ paths:
expiration: '2022-03-08T05:19:19.726Z' expiration: '2022-03-08T05:19:19.726Z'
cooldown: 60 cooldown: 60
operationId: post-my-ships-shipSymbol-scan operationId: post-my-ships-shipSymbol-scan
security:
- AgentToken: []
description: Scan approaching or departing ships. description: Scan approaching or departing ships.
requestBody: requestBody:
content: content:
@ -822,7 +907,12 @@ paths:
required: true required: true
post: post:
summary: Sell cargo from your ship summary: Sell cargo from your ship
tags: [] tags:
- markets
- my
- sell
- ships
- trade
responses: responses:
'200': '200':
description: OK description: OK
@ -869,6 +959,8 @@ paths:
units: -1 units: -1
operationId: post-my-ships-shipSymbol-sell operationId: post-my-ships-shipSymbol-sell
description: Sell cargo from your ship's hold to the local market. description: Sell cargo from your ship's hold to the local market.
security:
- AgentToken: []
'/my/ships/{shipSymbol}': '/my/ships/{shipSymbol}':
parameters: parameters:
- schema: - schema:
@ -878,7 +970,9 @@ paths:
required: true required: true
get: get:
summary: View the details of your ship summary: View the details of your ship
tags: [] tags:
- my
- ships
responses: responses:
'200': '200':
description: OK description: OK
@ -919,16 +1013,14 @@ paths:
- data - data
operationId: get-my-ships-shipSymbol operationId: get-my-ships-shipSymbol
description: Retrieve the details of your ship. description: Retrieve the details of your ship.
security:
- AgentToken: []
/my/ships: /my/ships:
parameters:
- schema:
type: string
name: shipSymbol
in: path
required: true
get: get:
summary: View a list of all your ships summary: View a list of all your ships
tags: [] tags:
- my
- ships
responses: responses:
'200': '200':
description: OK description: OK
@ -1230,10 +1322,33 @@ paths:
limit: 20 limit: 20
operationId: get-my-ships operationId: get-my-ships
description: Retrieve all of your ships. description: Retrieve all of your ships.
security:
- AgentToken: []
tags:
- name: my
- name: ships
- name: markets
- name: trade
- name: sell
- name: purchase
- name: navigation
- name: agents
- name: dock
- name: orbit
- name: jettison
- name: jump
- name: refuel
- name: scan
- name: contracts
- name: chart
- name: extract
- name: mining
- name: deliver
- name: survey
components: components:
schemas: {} schemas: {}
securitySchemes: securitySchemes:
Agent Token: AgentToken:
type: http type: http
scheme: bearer scheme: bearer
description: When you register a new agent you will be granted a private bearer token which grants authorization to use the API. description: When you register a new agent you will be granted a private bearer token which grants authorization to use the API.