- status=400, msg="invalid-params"
- status=400, msg="duplicated-requests"
- description: get user info
- method: GET
- response:
if not joined:
{
"account_id": 123124125,
"language": "en",
"joined": "false"
}
if already joined:
{
"account_id": 123124125,
"language": "en",
"joined": "true",
"room_id": 123
}
- description: logout game
- method: POST
- response:
{}
- description: register new user (no password)
- method: POST
- payload:
{
"username": "admin"
}
Response:
{
"token": "123dfsg3423"
}
- description: get global chat
- method: GET
- response:
[
{
"user": "admin",
"message": "New message",
"time": 123124,
"online": true
}
]
- description: get list of all cards
- method : GET
- response:
[
{
"id": 1,
"text": "Abc has ___ XYZ",
"color": "black",
"gaps": 1
},
{
"id": 2,
"text": "____: Hours of fun. Easy to use. Perfect for ____!",
"color": "black",
"gaps": 2
},
{
"id": 3,
"text": "A Japanese toaster you can fuck.",
"color": "white"
}
]
- Note: White cards don't have any gaps
- description: Get all rooms
- method : GET
- response:
[
{
"id": 1,
"name": "Room 1",
"host": "player1",
"total": 10,
"current": 3,
"guest": 10,
"status": 'Not started',
}
]
- Note:
- status: Playing/Not started
- description: Create a new room
- method: POST
- payload:
{
"name": "Room-1",
"size": "5"
}
Response
{ "_id": "2342fdsw"}
- Exception:
- duplicated-room-name
- description: Join a room
- method: POST
- payload:
{
"operation": "join_room",
"room_id": 1,
}
Response:
{
"joined": true,
"room_id": 1,
"collection_cards": [1, 2, 3, 4, 5, 6, 7],
"display_cards": [
{
"id": 9,
"vote": 0
},
{
"id": 10,
"vote": 0
}
],
"mode": 1
}
- Exceptions:
- already-joined
- wrong-password
- Note: - Open room has no password -> password is an empty string - mode: 0 -> spectate, 1 -> active player
- description: Spectate a room
- method: POST
- payload:
{
"operation": "spectate_room",
"room_id": 1,
}
Response:
{
"joined": true,
"room_id": 1,
"mode": 0
}
- Exceptions:
- already-joined
- wrong-password
- Note: - Open room has no password -> password is an empty string - mode: 0 -> spectate, 1 -> active player
- description: Quit a room
- method: POST
- payload:
{
"operation": "quit_room",
"room_id": 1,
}
Response:
{
"joined": false
}
- Exceptions:
- not-joined
- description: get chat for game room
- method: GET
- response:
[
{
"user": "admin",
"message": "New message",
"time": 123124,
"online": true
}
]
- Note:
- exception: not-joined
- description: Get leaderboard
- method: GET
- response:
[
{
"name": "player1",
"score": 1234,
"is_host": 0
}
]
- Note:
- is_host: 0 -> normal players, 1 -> room host
- description: confirm deal cards
- method : POST
- payload:
{
"deal_cards": [1, 2],
}
- response:
{
"collection_cards": [3,4,5,6,7],
"display_cards": [
{
"id": 9,
"vote": 0
},
{
"id": 10,
"vote": 0
},
{
"id": 1,
"vote": 0
},
{
"id": 2,
"vote": 0
}
],
},
- Exception:
- not-joined
- cards-not-exist
- already-dealt
- description: vote for a card
- method: PUT
- payload:
{
"operation": "vote_card",
"card_id": 9,
}
- response:
{
"display_cards": [
{
"id": 9,
"vote": 1
},
{
"id": 10,
"vote": 0
}
]
}
- Exception:
- not-joined
- already-voted
- description: proceed to the next round
- method: GET
- response:
{
"display_cards": [],
"collection_cards": [1, 2, 3, 4, 5, 6, 7],
"leaderboard": [
{
"name": "player1",
"score": 1234,
"is_host": 0
}
]
}
- Exception:
- not-joined
- already-voted
- description: get result of the current round
- method: GET
- response:
{
"winner": {
"name": "admin",
"score": 10000
},
"leaderboard": [
{
"name": "player1",
"score": 1234,
"is_host": 0
}
]
}
- Exception:
- not-joined