Ozai/openapi.yaml

212 lines
4.9 KiB
YAML

openapi: 3.0.0
info:
title: PVV Ozai
description: PVV Ozai
version: 1.0.0
servers:
- url: https://ozai.pvv.ntnu.no
paths:
/game:
post:
summary: Create a game
description: Creates a game
operationId: createGame
parameters:
- name: playerNames
in: query
description: Unique list of players to join the game. (Length of 2-4)
required: true
schema:
type: array
items:
type: string
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GameResponse'
'400':
description: Invalid input
/game/{gameId}:
get:
summary: Find pet by ID
description: Returns a single pet
operationId: getGameById
parameters:
- name: gameId
in: path
description: ID of game
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GameState'
application/xml:
schema:
$ref: '#/components/schemas/GameState'
'400':
description: Invalid ID supplied
'404':
description: Game not found
put:
summary: Submit move
description: ''
operationId: submitMove
parameters:
- name: gameId
in: path
description: ID of pet that needs to be updated
required: true
schema:
type: integer
format: int64
- name: playerName
in: header
description: name of player/bot
required: true
schema:
type: string
- name: move
in: query
description: Mov
schema:
$ref: '#/components/schemas/Move'
responses:
'400':
description: Invalid input
components:
schemas:
GameState:
type: object
properties:
playerNames:
type: array
items:
type: string
currentPlayerName:
type: string
currentPlayerId:
type: integer
format: int32
bag:
$ref: '#/components/schemas/TileSet'
lid:
$ref: '#/components/schemas/TileSet'
factories:
type: array
items:
$ref: '#/components/schemas/TileSet'
market:
$ref: '#/components/schemas/TileSetWithStart'
players:
type: array
items:
$ref: '#/components/schemas/Player'
TileSet:
type: object
properties:
blue:
type: integer
format: int32
yellow:
type: integer
format: int32
red:
type: integer
format: int32
black:
type: integer
format: int32
white:
type: integer
format: int32
TileSetWithStart:
type: object
properties:
start:
type: integer
format: int32
blue:
type: integer
format: int32
yellow:
type: integer
format: int32
red:
type: integer
format: int32
black:
type: integer
format: int32
white:
type: integer
format: int32
Player:
type: object
properties:
points:
type: integer
format: int32
patternLines:
type: array
items:
$ref: '#/components/schemas/PatternLine'
wall:
$ref: '#/components/schemas/Wall'
floor:
$ref: '#/components/schemas/TileSetWithStart'
PatternLine:
type: object
properties:
color:
$ref: '#/components/schemas/Color'
number:
type: integer
format: int32
Color:
enum: ["blue", "yellow", "red", "black", "white"]
Wall:
type: object
properties:
blue:
type: boolean
yellow:
type: boolean
red:
type: boolean
black:
type: boolean
white:
type: boolean
Move:
type: object
properties:
player:
description: internal playerid (is this player 1 or 2)
type: integer
format: int32
market:
type: boolean
factory:
type: integer
format: int32
color:
$ref: '#/components/schemas/Color'
patternLine:
type: integer
format: int32
GameResponse:
type: object
properties:
gameId:
type: integer