Open ricksu978 opened 1 year ago
Unassigned myself as this is no longer my responsibility. Here is the doc created initially as a first step: https://www.notion.so/waterball/GAAS-Lobby-Service-Documentation-813ec18abbbf4690ab151a516729b895?pvs=4
Reposting the initial Notion documentation notes for transparency:
PlatformError.kt
GET /games
list all registered games
200
Game
object:{
// game id from the register - mongo object id
"id": "string",
// the human readable name of the game
"name": "string",
// uri - point to external CDN
"img": "string",
// minimum number of players required to start the game
"minPlayers": 0,
// maximum number of players allowed to start the game
"maxPlayers": 0
}
remove 400, and 404 status
Game object
POST /games
{
// English based unique name used for routing game requests to their respective resources
// verify field validation
// required
"uniqueName": "string",
// human readable name
// char length
// required
"displayName": "string",
// English description of the game
// verify field validation
// required
"shortDescription": "string",
// game rule
// required
"rule": "string",
// game image URL
// required
"imageUrl": "string",
// minimum number of players required to start the game
// required
"minPlayers": 0,
// maximum number of players allowed to start the game
// required
"maxPlayers": 0
// cloud hosted frontend absolute URL
// required
"frontEndUrl": "string",
// cloud hosted backend absolute URL
// required
"backEndUrl": "string"
}
200 - OK
400
object
{
"timestamp": "2023-08-18T14:10:17.545Z",
"errorCode": "string",
"message": "string"
}
404 - remove, will not happen
PUT /games/{gameId}
Game object (same as POST) - request body
{
// English based unique name used for routing game requests to their respective resources
// verify field validation
// required
"uniqueName": "string",
// human readable name
// char length
// required
"displayName": "string",
// English description of the game
// verify field validation
// required
"shortDescription": "string",
// game rule
// required
"rule": "string",
// game image URL
// required
"imageUrl": "string",
// minimum number of players required to start the game
// required
"minPlayers": 0,
// maximum number of players allowed to start the game
// required
"maxPlayers": 0
// cloud hosted frontend absolute URL
// required
"frontEndUrl": "string",
// cloud hosted backend absolute URL
// required
"backEndUrl": "string"
}
gameId
is not found in the tableGET /rooms
Query parameters
status
WAITING
PLAYING
page
perPage
Response
{
"rooms": Room[],
"page": PageMetadata,
}
Room
{
// mongodb objectid
"id": "string",
// name of the room, user defined
"name": "string",
// simple game object
"game": {
// game id foreign key - corresponds to the registered game list
"id": "string",
// game's displayName
"name": "string"
},
// the player who created the room
"host": {
// user id foreign key - corresponds to the user table
"id": "string",
// user nickname
"nickname": "string"
},
// room host defined maximum number of players
"maxPlayers": 0,
// room host defined minimum minimum of players
"minPlayers": 0,
// the number of players currently in the room
"currentPlayers": 0,
// is the room locked, ie. ture iff the host makes the room private
"isLocked": true
}
PageMetadata
{
// the total number of rooms matching the status filter
"total": 0,
// the current page corresponding to the requests request
"page": 0,
// the current page of the request
"perPage": 0
}
POST /rooms
request.body
{
// room name
// required
"name": "string",
// corresponding game id in the registered game list
// required
"gameId": "string",
// room host defined password to enter the game
// optional
"password": "string",
// maximum number of players for the room
// required
// validation: the room's maximum number of player cannot be more than the game's allowed maximum number of players
"maxPlayers": 0,
// minimum number of players for the room
// required
// validation: the room's minimum number of player cannot be more than the game's allowed minimum number of players
"minPlayers": 0
}
400 - should correspond to the validation errors
404 - delete this
GET /rooms/{roomId}
roomId
: generated mongo objectIdresponse
{
// mongodb objectid
"id": "string",
// name of the room, user defined
"name": "string",
// simple game object
"game": {
// game id foreign key - corresponds to the registered game list
"id": "string",
// game's displayName
"name": "string"
},
// the player who created the room
"host": {
// user id foreign key - corresponds to the user table
"id": "string",
// user nickname
"nickname": "string"
},
// the players currently in the room
"players": [
{
"id": "string",
"nickname": "string"
}
],
// room host defined maximum number of players
"maxPlayers": 0,
// room host defined minimum minimum of players
"minPlayers": 0,
// the number of players currently in the room
"currentPlayers": 0,
// is the room locked, ie. ture iff the host makes the room private
"isLocked": true
// Status enum: WAITING, PLAYING
"status": "string"
}
DELETE /rooms/{roomId}
roomId
roomId
not foundPOST /rooms/{roomId}/players
roomId
: generated mongo objectId{
// the password set by the room host
// optional
"password": "string"
}
roomId
not foundDELETE /rooms/{roomId}/players/{playerId}
roomId
playerId
DELETE /rooms/{roomId}/players/me
roomId
the request will still succeedroomId
POST /rooms/{roomId}/players/me:cancel
isReady
label that’s not on the swagger doc
getRoomViewModel
roomId
NOT_READY
roomId
not foundPOST /rooms/{roomId}/players/me:ready
roomId
NOT_READY
roomId
not foundGET /users/me
{
// user id - generated mongodb objectid
"id": "string",
// user email
"email": "string",
// user nick name
"nickname": "string"
}
PUT /users
{
// user desired new nickname
// uniqueness constraint
// character length range in [4,16]
// alphanumeric + zh encoding
"nickname": "string"
}
{
"id": "string",
"email": "string",
"nickname": "string"
}
Unassigned myself as this is no longer my responsibility. Here is the doc created initially as a first step: https://www.notion.so/waterball/GAAS-Lobby-Service-Documentation-813ec18abbbf4690ab151a516729b895?pvs=4