Docs: Add documentation for fold command
This commit is contained in:
@@ -64,6 +64,7 @@ This document describes the protocol for client-server communication in our appl
|
||||
- [Example Response](#example-response)
|
||||
- [RAISE command](#raise-command)
|
||||
- [CALL command](#call-command)
|
||||
- [FOLD command](#fold-command)
|
||||
- [BET command](#bet-command)
|
||||
- [SEND_MESSAGE command](#send_message-command)
|
||||
- [Required pre-execution checks](#required-pre-execution-checks)
|
||||
@@ -835,6 +836,222 @@ END
|
||||
END
|
||||
```
|
||||
|
||||
## FOLD command
|
||||
|
||||
The `FOLD` command lets the currently logged-in player leave the current hand (fold) in the ongoing game for their lobby.
|
||||
|
||||
### Required pre-execution checks
|
||||
|
||||
- [`UserLoggedInCheck`](#userloggedincheck)
|
||||
|
||||
### Request Parameters
|
||||
|
||||
| Parameter Name | Type | Optional | Description |
|
||||
| :------------- | :--- | :------: | :---------- |
|
||||
| `GAME_ID` | `int` | yes | Numeric id of the lobby/game to target. If omitted the server resolves the lobby by the requesting session's user. |
|
||||
|
||||
### Implementation notes
|
||||
|
||||
- Parser: `PlayerFoldParser` — accepts optional `GAME_ID`.
|
||||
- Handler: `PlayerFoldHandler` — validates the session, resolves the lobby by id when provided or by session otherwise and forwards to `GameController`.
|
||||
|
||||
### Success Response
|
||||
|
||||
No additional response fields. Server replies with `+OK` on success.
|
||||
|
||||
### Error Response
|
||||
|
||||
| Code | Description |
|
||||
| :--- | :---------- |
|
||||
| `NOT_YOUR_TURN` | The player attempted to fold when not their turn |
|
||||
| `GAME_NOT_STARTED` | No game is running in the lobby |
|
||||
| `NOT_IN_LOBBY` | Requesting user is not a member of the lobby |
|
||||
| `LOBBY_NOT_FOUND` | The specified `GAME_ID` does not exist |
|
||||
|
||||
### Example Request
|
||||
|
||||
```
|
||||
FOLD GAME_ID=1
|
||||
```
|
||||
|
||||
### Example Response (success)
|
||||
|
||||
```
|
||||
+OK
|
||||
END
|
||||
```
|
||||
|
||||
### Example Response (error)
|
||||
|
||||
```
|
||||
-ERR
|
||||
CODE=NOT_YOUR_TURN
|
||||
MSG=It is not your turn
|
||||
END
|
||||
```
|
||||
|
||||
## FOLD command
|
||||
|
||||
The `FOLD` command lets the currently logged-in player leave the current hand (fold) in the ongoing game for their lobby.
|
||||
|
||||
### Required pre-execution checks
|
||||
|
||||
- [`UserLoggedInCheck`](#userloggedincheck)
|
||||
|
||||
### Request Parameters
|
||||
|
||||
| Parameter Name | Type | Optional | Description |
|
||||
| :------------- | :--- | :------: | :---------- |
|
||||
| `GAME_ID` | `int` | yes | Numeric id of the lobby/game to target. If omitted the server resolves the lobby by the requesting session's user. |
|
||||
|
||||
### Implementation notes
|
||||
|
||||
- Parser: `PlayerFoldParser` — accepts optional `GAME_ID`.
|
||||
- Handler: `PlayerFoldHandler` — validates the session, resolves the lobby by id when provided or by session otherwise and forwards to `GameController`.
|
||||
|
||||
### Success Response
|
||||
|
||||
No additional response fields. Server replies with `+OK` on success.
|
||||
|
||||
### Error Response
|
||||
|
||||
| Code | Description |
|
||||
| :--- | :---------- |
|
||||
| `NOT_YOUR_TURN` | The player attempted to fold when not their turn |
|
||||
| `GAME_NOT_STARTED` | No game is running in the lobby |
|
||||
| `NOT_IN_LOBBY` | Requesting user is not a member of the lobby |
|
||||
| `LOBBY_NOT_FOUND` | The specified `GAME_ID` does not exist |
|
||||
|
||||
### Example Request
|
||||
|
||||
```
|
||||
FOLD GAME_ID=1
|
||||
```
|
||||
|
||||
### Example Response (success)
|
||||
|
||||
```
|
||||
+OK
|
||||
END
|
||||
```
|
||||
|
||||
### Example Response (error)
|
||||
|
||||
```
|
||||
-ERR
|
||||
CODE=NOT_YOUR_TURN
|
||||
MSG=It is not your turn
|
||||
END
|
||||
```
|
||||
|
||||
## FOLD command
|
||||
|
||||
The `FOLD` command lets the currently logged-in player leave the current hand (fold) in the ongoing game for their lobby.
|
||||
|
||||
### Required pre-execution checks
|
||||
|
||||
- [`UserLoggedInCheck`](#userloggedincheck)
|
||||
|
||||
### Request Parameters
|
||||
|
||||
| Parameter Name | Type | Optional | Description |
|
||||
| :------------- | :--- | :------: | :---------- |
|
||||
| `GAME_ID` | `int` | yes | Numeric id of the lobby/game to target. If omitted the server resolves the lobby by the requesting session's user. |
|
||||
|
||||
### Implementation notes
|
||||
|
||||
- Parser: `PlayerFoldParser` — accepts optional `GAME_ID`.
|
||||
- Handler: `PlayerFoldHandler` — validates the session, resolves the lobby by id when provided or by session otherwise and forwards to `GameController`.
|
||||
|
||||
### Success Response
|
||||
|
||||
No additional response fields. Server replies with `+OK` on success.
|
||||
|
||||
### Error Response
|
||||
|
||||
| Code | Description |
|
||||
| :--- | :---------- |
|
||||
| `NOT_YOUR_TURN` | The player attempted to fold when not their turn |
|
||||
| `GAME_NOT_STARTED` | No game is running in the lobby |
|
||||
| `NOT_IN_LOBBY` | Requesting user is not a member of the lobby |
|
||||
| `LOBBY_NOT_FOUND` | The specified `GAME_ID` does not exist |
|
||||
|
||||
### Example Request
|
||||
|
||||
```
|
||||
FOLD GAME_ID=1
|
||||
```
|
||||
|
||||
### Example Response (success)
|
||||
|
||||
```
|
||||
+OK
|
||||
END
|
||||
```
|
||||
|
||||
### Example Response (error)
|
||||
|
||||
```
|
||||
-ERR
|
||||
CODE=NOT_YOUR_TURN
|
||||
MSG=It is not your turn
|
||||
END
|
||||
```
|
||||
|
||||
## FOLD command
|
||||
|
||||
The `FOLD` command lets the currently logged-in player leave the current hand (fold) in the ongoing game for their lobby.
|
||||
|
||||
### Required pre-execution checks
|
||||
|
||||
- [`UserLoggedInCheck`](#userloggedincheck)
|
||||
|
||||
### Request Parameters
|
||||
|
||||
| Parameter Name | Type | Optional | Description |
|
||||
| :------------- | :--- | :------: | :---------- |
|
||||
| `GAME_ID` | `int` | yes | Numeric id of the lobby/game to target. If omitted the server resolves the lobby by the requesting session's user. |
|
||||
|
||||
### Implementation notes
|
||||
|
||||
- Parser: `PlayerFoldParser` — accepts optional `GAME_ID`.
|
||||
- Handler: `PlayerFoldHandler` — validates the session, resolves the lobby by id when provided or by session otherwise and forwards to `GameController`.
|
||||
|
||||
### Success Response
|
||||
|
||||
No additional response fields. Server replies with `+OK` on success.
|
||||
|
||||
### Error Response
|
||||
|
||||
| Code | Description |
|
||||
| :--- | :---------- |
|
||||
| `NOT_YOUR_TURN` | The player attempted to fold when not their turn |
|
||||
| `GAME_NOT_STARTED` | No game is running in the lobby |
|
||||
| `NOT_IN_LOBBY` | Requesting user is not a member of the lobby |
|
||||
| `LOBBY_NOT_FOUND` | The specified `GAME_ID` does not exist |
|
||||
|
||||
### Example Request
|
||||
|
||||
```
|
||||
FOLD GAME_ID=1
|
||||
```
|
||||
|
||||
### Example Response (success)
|
||||
|
||||
```
|
||||
+OK
|
||||
END
|
||||
```
|
||||
|
||||
### Example Response (error)
|
||||
|
||||
```
|
||||
-ERR
|
||||
CODE=NOT_YOUR_TURN
|
||||
MSG=It is not your turn
|
||||
END
|
||||
```
|
||||
|
||||
## GET_LOBBY_STATUS command
|
||||
|
||||
The `GET_LOBBY_STATUS` command requests the server to return the current state of a lobby, including the list of players and their ready state.
|
||||
|
||||
Reference in New Issue
Block a user