rove/swagger.yml

247 lines
6.4 KiB
YAML
Raw Normal View History

2020-06-12 17:22:55 +01:00
swagger: "2.0"
info:
description: "Rove is an asychronous nomadic game about exploring a planet as part of a loose community"
version: "0.1"
title: "Rove Server"
2020-06-12 19:05:50 +01:00
host: "api.rove-game.com:8080"
2020-06-12 17:22:55 +01:00
basePath: "/"
tags:
- name: "server"
description: "Interactions with the server itself"
- name: "accounts"
description: "Access to accounts"
- name: "rove"
description: "Operations for the game"
schemes:
- "http"
consumes:
- application/json
produces:
- application/json
paths:
/status:
get:
tags:
- "server"
summary: "Server status"
description: "Responds with various details about the current server status"
operationId: "Status"
responses:
"200":
description: "Server is active"
schema:
$ref: '#/definitions/status'
/register:
post:
tags:
- "accounts"
summary: "Register an account"
description: "Tries to register an account with the given name"
operationId: "Register"
parameters:
- in: body
name: name
schema:
$ref: '#/definitions/register-data'
responses:
"200":
description: "Successfully created account"
"400":
description: "Bad request, typically due to duplicate name"
2020-06-12 17:22:55 +01:00
schema:
$ref: '#/definitions/error'
"500":
description: "Server encountered error, please report this as a bug"
schema:
$ref: '#/definitions/error'
2020-06-12 17:22:55 +01:00
/{account}/commands:
post:
tags:
- rove
summary: Send commands to rover
description: "Sending commands to this endpoint will queue them to be executed during the following ticks, in the order sent"
operationId: "Commands"
parameters:
- in: path
name: account
required: true
type: string
- in: body
name: commands
schema:
$ref: '#/definitions/commands-data'
responses:
"200":
description: "Successfully queued commands"
"400":
2020-06-12 19:12:24 +01:00
description: "Bad request, typically due to unknown command parameters"
schema:
$ref: '#/definitions/error'
"500":
description: "Server encountered error, please report this as a bug"
2020-06-12 17:22:55 +01:00
schema:
$ref: '#/definitions/error'
2020-06-12 17:22:55 +01:00
/{account}/radar:
get:
tags:
- rove
summary: Get radar information
description: "Gets the radar output for the given rover"
operationId: "Radar"
parameters:
- in: path
name: account
required: true
type: string
responses:
"200":
description: "Successfully returned rover radar"
2020-06-12 17:22:55 +01:00
schema:
$ref: '#/definitions/radar-response'
"400":
2020-06-12 19:12:24 +01:00
description: "Bad request, typically due to unknown account"
schema:
$ref: '#/definitions/error'
"500":
description: "Server encountered error, please report this as a bug"
schema:
$ref: '#/definitions/error'
2020-06-12 17:22:55 +01:00
/{account}/rover:
get:
tags:
- rove
summary: Get rover information
description: "Gets information for the account's rover"
operationId: "Rover"
parameters:
- in: path
name: account
required: true
type: string
responses:
"200":
description: "Successfully returned rover information"
2020-06-12 17:22:55 +01:00
schema:
$ref: '#/definitions/rover-response'
"400":
2020-06-12 19:12:24 +01:00
description: "Bad request, typically due to unknown account"
schema:
$ref: '#/definitions/error'
"500":
description: "Server encountered error, please report this as a bug"
schema:
$ref: '#/definitions/error'
2020-06-12 17:22:55 +01:00
definitions:
status:
properties:
ready:
2020-06-12 19:34:14 +01:00
description: Whether the server is ready to accept requests
2020-06-12 17:22:55 +01:00
type: boolean
example: true
version:
2020-06-12 19:34:14 +01:00
description: The version of the server in v{major}.{minor}-{delta}-{sha} form
2020-06-12 17:22:55 +01:00
type: string
example: "v0.12-1-g7d1a2d7"
tick:
2020-06-12 19:34:14 +01:00
description: The tick rate of the server in minutes (how many minutes per tick)
2020-06-12 17:22:55 +01:00
type: integer
example: 5
nexttick:
2020-06-12 19:34:14 +01:00
description: The time the next tick will occur
2020-06-12 17:22:55 +01:00
type: string
example: "15:30:00"
error:
properties:
error:
2020-06-12 19:34:14 +01:00
description: An explanation for the HTTP error returned
type: string
example: "account not found"
2020-06-12 17:22:55 +01:00
register-data:
properties:
name:
2020-06-12 19:34:14 +01:00
description: The account name
2020-06-12 17:22:55 +01:00
type: string
example: "myname"
required:
- name
command:
properties:
command:
2020-06-12 19:17:39 +01:00
description: "The command to execute, currently only accepts move, which requires a bearing and a duration."
2020-06-12 17:22:55 +01:00
type: string
example: move
bearing:
type: string
example: NE
duration:
type: integer
example: 5
commands-data:
properties:
commands:
2020-06-12 19:34:14 +01:00
description: A set of commands to exectute in the order given
2020-06-12 17:22:55 +01:00
type: array
items:
type: object
properties:
schema:
$ref: '#/definitions/command'
radar-response:
properties:
range:
2020-06-12 19:34:14 +01:00
description: The range in tiles from the rover of the radar data
2020-06-12 17:22:55 +01:00
type: integer
example: 5
tiles:
2020-06-12 19:34:14 +01:00
description: A 1D array representing range*2 + 1 squared set of tiles, origin bottom left and in row->column order
2020-06-12 17:22:55 +01:00
type: array
items:
type: integer
vector:
properties:
'x':
type: integer
example: 1
'y':
type: integer
example: 2
rover-attributes:
properties:
speed:
2020-06-12 19:34:14 +01:00
description: The speed the rover can move per tick
2020-06-12 17:22:55 +01:00
type: integer
example: 1
range:
2020-06-12 19:34:14 +01:00
description: The range of this rover's radar
2020-06-12 17:22:55 +01:00
type: integer
example: 5
name:
2020-06-12 19:34:14 +01:00
description: The name of the rover
2020-06-12 17:22:55 +01:00
type: string
example: rover-one
position:
2020-06-12 19:34:14 +01:00
description: Position of the rover in world coordinates
2020-06-12 17:22:55 +01:00
type: object
properties:
schema:
$ref: '#/definitions/vector'
rover-response:
properties:
attributes:
2020-06-12 19:34:14 +01:00
description: The attributes of the given rover
2020-06-12 17:22:55 +01:00
type: object
2020-06-12 19:50:52 +01:00
$ref: '#/definitions/rover-attributes'