Skip to content

Commit

Permalink
Merge pull request #411 from AllieJonsson/fix/account-playing
Browse files Browse the repository at this point in the history
add schema for api/account/playing
  • Loading branch information
ornicar authored Jan 16, 2025
2 parents d66d602 + 390fd8d commit 5b63d6e
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 35 deletions.
15 changes: 1 addition & 14 deletions doc/specs/schemas/GameEventInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,7 @@ properties:
id:
type: string
source:
type: string
enum:
- lobby
- friend
- ai
- api
- tournament
- position
- import
- importlive
- simul
- relay
- pool
- swiss
$ref: './GameSource.yaml'
status:
type: object
properties:
Expand Down
14 changes: 14 additions & 0 deletions doc/specs/schemas/GameSource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
type: string
enum:
- lobby
- friend
- ai
- api
- tournament
- position
- import
- importlive
- simul
- relay
- pool
- swiss
126 changes: 105 additions & 21 deletions doc/specs/tags/games/api-account-playing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ get:
minimum: 1
maximum: 50
responses:
"200":
'200':
description: The ongoing games of the logged in user.
headers:
Access-Control-Allow-Origin:
Expand All @@ -29,23 +29,107 @@ get:
content:
application/json:
schema:
example: {
"nowPlaying": [
{
"gameId": "rCRw1AuO",
"fullId": "rCRw1AuOvonq",
"color": "black",
"fen": "r1bqkbnr/pppp2pp/2n1pp2/8/8/3PP3/PPPB1PPP/RN1QKBNR w KQkq - 2 4",
"hasMoved": true,
"isMyTurn": false,
"lastMove": "b8c6",
"opponent": { "id": "philippe", "rating": 1790, "username": "Philippe" },
"perf": "correspondence",
"rated": false,
"secondsLeft": 1209600,
"source": "friend",
"speed": "correspondence",
"variant": { "key": "standard", "name": "Standard" }
}
]
}
type: object
required:
- nowPlaying
properties:
nowPlaying:
type: array
items:
type: object
required:
- gameId
- fullId
- color
- fen
- hasMoved
- isMyTurn
- lastMove
- opponent
- perf
- rated
- secondsLeft
- source
- speed
- variant
properties:
fullId:
type: string
gameId:
type: string
fen:
type: string
color:
type: string
enum:
- white
- black
lastMove:
type: string
source:
$ref: '../../schemas/GameSource.yaml'
status:
$ref: '../../schemas/GameStatus.yaml'
variant:
$ref: '../../schemas/Variant.yaml'
speed:
$ref: '../../schemas/Speed.yaml'
perf:
$ref: '../../schemas/PerfType.yaml'
rated:
type: boolean
hasMoved:
type: boolean
opponent:
required:
- id
- username
type: object
properties:
id:
type: string
username:
type: string
rating:
type: number
ratingDiff:
type: number
ai:
type: number
isMyTurn:
type: boolean
secondsLeft:
type: number
tournamentId:
type: string
swissId:
type: string
winner:
type: string
enum:
- white
- black
ratingDiff:
type: number
example:
{
'nowPlaying':
[
{
'gameId': 'rCRw1AuO',
'fullId': 'rCRw1AuOvonq',
'color': 'black',
'fen': 'r1bqkbnr/pppp2pp/2n1pp2/8/8/3PP3/PPPB1PPP/RN1QKBNR w KQkq - 2 4',
'hasMoved': true,
'isMyTurn': false,
'lastMove': 'b8c6',
'opponent': { 'id': 'philippe', 'rating': 1790, 'username': 'Philippe' },
'perf': 'correspondence',
'rated': false,
'secondsLeft': 1209600,
'source': 'friend',
'speed': 'correspondence',
'variant': { 'key': 'standard', 'name': 'Standard' },
},
],
}

0 comments on commit 5b63d6e

Please sign in to comment.