GameRoomController - xEdziu/RPG-Handy-Helper GitHub Wiki
This page documents the GameRoomController
, responsible for managing game room creation, history tracking, and retrieving active room information.
Base Path: /api/v1/authorized/gameRoom
Package: dev.goral.rpghandyhelper.chat
All endpoints require a valid XSRF token in headers:
headers: {
"X-XSRF-TOKEN": "<csrfToken>"
}
HTTP Method | Path | Description |
---|---|---|
POST | /create |
Create a new game room (GameMaster only) |
GET | /gameIdForRoomId/{roomId} |
Retrieve game ID for a given room ID |
GET | /history |
Retrieve game room history |
GET | /active |
Retrieve currently active rooms for a specific game |
-
gameId (Long): ID of the game. Required in
/create
and/active
.
-
roomId (String): ID of the room. Used in
/gameIdForRoomId/{roomId}
.
- message (String): Operation status message.
- error (Integer): HTTP status code.
- timestamp (String): Response timestamp.
- Additional fields like
roomId
,url
,gameId
,history
,activeRooms
depending on endpoint.
{
"gameId": 1,
"durationMinutes": 5,
"gameName": "game name",
"createdBy": "user1",
"endedAt": "...",
"startedAt": "...",
"roomId": "A1B2C3D4",
"participants": [
"user1"
]
}
{
"gameId": 1,
"createdAt": "...",
"creatorId": 1,
"connectedUsers": [
"user1"
],
"roomId": "A1B2C3D4"
}
Method: POST
Path: /create
-
gameId
(Long): ID of the game to create room for.
{
"message": "Stworzono pokój gry.",
"error": 200,
"timestamp": "...",
"roomId": "A1B2C3D4",
"url": "/room/A1B2C3D4"
}
-
400 Bad Request
: Invalid request or user not authorized. -
403 Forbidden
: User is not the GameMaster or game is not active. -
404 Not Found
: Game not found.
Method: GET
Path: /gameIdForRoomId/{roomId}
-
roomId
(String): Room identifier.
{
"message": "Znaleziono ID gry dla podanego pokoju.",
"error": 200,
"timestamp": "...",
"gameId": 1
}
-
404 Not Found
: Room not found.
Method: GET
Path: /history
{
"history": [ ... ],
"message": "Historia pokoi gry.",
"error": 200,
"timestamp": "..."
}
-
401 Unauthorized
: User not authenticated.
Method: GET
Path: /active
-
gameId
(Long): ID of the game.
{
"message": "Znaleziono aktywne pokoje.",
"error": 200,
"activeRooms": [ ... ],
"timestamp": "..."
}
-
403 Forbidden
: User is not a participant of the game. -
404 Not Found
: Game not found.
- Game Master Requirement: Only GameMasters can create game rooms.
-
Room Not Found: Double-check the room ID when using
/gameIdForRoomId/{roomId}
. - No Active Rooms: Games without active players will not have any active rooms.