rove/pkg/rove/rove.swagger.json

440 lines
11 KiB
JSON

{
"swagger": "2.0",
"info": {
"title": "Rove",
"description": "Rove is an asychronous nomadic game about exploring a planet as part of a loose community",
"version": "version not set"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/command": {
"post": {
"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": "Rove_Command",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/roveCommandResponse"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/gatewayruntimeError"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/roveCommandRequest"
}
}
],
"tags": [
"Rove"
]
}
},
"/radar": {
"post": {
"summary": "Get radar information",
"description": "Gets the radar output for the given rover",
"operationId": "Rove_Radar",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/roveRadarResponse"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/gatewayruntimeError"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/roveRadarRequest"
}
}
],
"tags": [
"Rove"
]
}
},
"/register": {
"post": {
"summary": "Register an account",
"description": "Tries to register an account with the given name",
"operationId": "Rove_Register",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/roveRegisterResponse"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/gatewayruntimeError"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/roveRegisterRequest"
}
}
],
"tags": [
"Rove"
]
}
},
"/server-status": {
"get": {
"summary": "Server status",
"description": "Responds with various details about the current server status",
"operationId": "Rove_ServerStatus",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/roveServerStatusResponse"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/gatewayruntimeError"
}
}
},
"tags": [
"Rove"
]
}
},
"/status": {
"post": {
"summary": "Get rover information",
"description": "Gets information for the account's rover",
"operationId": "Rove_Status",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/roveStatusResponse"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/gatewayruntimeError"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/roveStatusRequest"
}
}
],
"tags": [
"Rove"
]
}
}
},
"definitions": {
"gatewayruntimeError": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
},
"protobufAny": {
"type": "object",
"properties": {
"type_url": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"roveAccount": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"secret": {
"type": "string"
}
}
},
"roveCommand": {
"type": "object",
"properties": {
"command": {
"type": "string",
"title": "The command to execute\n\"move\" - Move the rover in a direction, requires bearing\n\"stash\" - Stashes item at current location in rover inventory\n\"repair\" - Repairs the rover using an inventory object\n\"recharge\" - Waits a tick to add more charge to the rover\n\"broadcast\" - Broadcasts a message to nearby rovers"
},
"bearing": {
"type": "string",
"title": "A bearing, example: NE"
},
"message": {
"type": "string",
"format": "byte",
"title": "A simple message, must be composed of printable ASCII glyphs (32-126)\nmaximum of three characters"
}
}
},
"roveCommandRequest": {
"type": "object",
"properties": {
"account": {
"$ref": "#/definitions/roveAccount",
"title": "The account to execute these commands"
},
"commands": {
"type": "array",
"items": {
"$ref": "#/definitions/roveCommand"
},
"title": "The set of desired commands"
}
}
},
"roveCommandResponse": {
"type": "object",
"title": "Empty placeholder"
},
"roveLog": {
"type": "object",
"properties": {
"time": {
"type": "string",
"title": "The unix timestamp of the log"
},
"text": {
"type": "string",
"title": "The text of the log"
}
}
},
"roveRadarRequest": {
"type": "object",
"properties": {
"account": {
"$ref": "#/definitions/roveAccount",
"title": "The account for this request"
}
}
},
"roveRadarResponse": {
"type": "object",
"properties": {
"range": {
"type": "integer",
"format": "int32",
"title": "The range in tiles from the rover of the radar data"
},
"tiles": {
"type": "string",
"format": "byte",
"title": "A 1D array representing range*2 + 1 squared set of tiles, origin bottom left and in row-\u003ecolumn order"
},
"objects": {
"type": "string",
"format": "byte",
"title": "A similar array to the tile array, but containing objects"
}
}
},
"roveRegisterRequest": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "The desired account name"
}
}
},
"roveRegisterResponse": {
"type": "object",
"properties": {
"account": {
"$ref": "#/definitions/roveAccount",
"title": "The registered account information"
}
},
"title": "Empty placeholder"
},
"roveServerStatusResponse": {
"type": "object",
"properties": {
"version": {
"type": "string",
"title": "The version of the server in v{major}.{minor}-{delta}-{sha} form"
},
"ready": {
"type": "boolean",
"format": "boolean",
"title": "Whether the server is ready to accept requests"
},
"tickRate": {
"type": "integer",
"format": "int32",
"title": "The tick rate of the server in minutes (how many minutes per tick)"
},
"currentTick": {
"type": "integer",
"format": "int32",
"title": "The current tick of the server"
},
"next_tick": {
"type": "string",
"title": "The time the next tick will occur"
}
}
},
"roveStatusRequest": {
"type": "object",
"properties": {
"account": {
"$ref": "#/definitions/roveAccount",
"title": "The account for this request"
}
}
},
"roveStatusResponse": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "The name of the rover"
},
"position": {
"$ref": "#/definitions/roveVector",
"title": "Position of the rover in world coordinates"
},
"range": {
"type": "integer",
"format": "int32",
"title": "The range of this rover's radar and broadcasting"
},
"inventory": {
"type": "string",
"format": "byte",
"title": "The items in the rover inventory"
},
"capacity": {
"type": "integer",
"format": "int32",
"title": "The capacity of the inventory"
},
"integrity": {
"type": "integer",
"format": "int32",
"title": "The current health of the rover"
},
"maximumIntegrity": {
"type": "integer",
"format": "int32",
"title": "The maximum health of the rover"
},
"charge": {
"type": "integer",
"format": "int32",
"title": "The energy stored in the rover"
},
"maximumCharge": {
"type": "integer",
"format": "int32",
"title": "The max energy the rover can store"
},
"incomingCommands": {
"type": "array",
"items": {
"$ref": "#/definitions/roveCommand"
},
"title": "The set of currently incoming commands for this tick"
},
"queuedCommands": {
"type": "array",
"items": {
"$ref": "#/definitions/roveCommand"
},
"title": "The set of currently queued commands"
},
"logs": {
"type": "array",
"items": {
"$ref": "#/definitions/roveLog"
},
"title": "The most recent logs"
}
}
},
"roveVector": {
"type": "object",
"properties": {
"x": {
"type": "integer",
"format": "int32"
},
"y": {
"type": "integer",
"format": "int32"
}
}
}
}
}