Ozai/openapi.yaml

220 lines
5.1 KiB
YAML
Raw Permalink Normal View History

2024-01-28 00:57:40 +01:00
openapi: 3.0.0
2024-01-27 23:06:56 +01:00
info:
title: PVV Ozai
description: PVV Ozai
version: 1.0.0
servers:
- url: https://ozai.pvv.ntnu.no
paths:
2024-01-28 00:57:40 +01:00
/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:
$ref: '#/components/schemas/NewGameOptionsNew'
2024-01-28 00:57:40 +01:00
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GameResponse'
'400':
description: Invalid input
2024-01-28 00:57:40 +01:00
/game/{gameId}:
2024-01-27 23:06:56 +01:00
get:
summary: see the game
description: retunrs the game state.
2024-01-27 23:06:56 +01:00
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 game that needs to be updated
2024-01-27 23:06:56 +01:00
required: true
schema:
type: integer
format: int64
2024-01-28 00:57:40 +01:00
- name: playerName
in: header
description: name of player/bot
required: true
2024-01-27 23:06:56 +01:00
schema:
type: string
2024-01-28 00:57:40 +01:00
- name: move
2024-01-27 23:06:56 +01:00
in: query
2024-01-28 00:57:40 +01:00
description: Mov
2024-01-27 23:06:56 +01:00
schema:
2024-01-28 00:57:40 +01:00
$ref: '#/components/schemas/Move'
2024-01-27 23:06:56 +01:00
responses:
'400':
description: Invalid input
components:
schemas:
GameState:
type: object
properties:
2024-01-28 00:57:40 +01:00
playerNames:
type: array
items:
type: string
currentPlayerName:
type: string
currentPlayerId:
2024-01-27 23:06:56 +01:00
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:
2024-01-28 00:57:40 +01:00
description: internal playerid (is this player 1 or 2)
2024-01-27 23:06:56 +01:00
type: integer
format: int32
market:
type: boolean
factory:
type: integer
format: int32
color:
$ref: '#/components/schemas/Color'
patternLine:
type: integer
format: int32
PlayerName:
type: string
NewGameOptionsNew:
type: object
properties:
player_names:
type: array
items:
$ref: '#/components/schemas/PlayerName'
2024-01-28 00:57:40 +01:00
GameResponse:
type: object
properties:
gameId:
type: integer