|
| 1 | +# API Endpoints |
| 2 | + |
| 3 | +This diagram illustrates the API endpoints structure of the Split game application, showing the available routes for interacting with the system. |
| 4 | + |
| 5 | +```mermaid |
| 6 | +graph TD |
| 7 | + API[API v1] |
| 8 | +
|
| 9 | + API --> Users[Users] |
| 10 | + API --> Rooms[Rooms] |
| 11 | + API --> Games[Games] |
| 12 | + API --> Bots[Bots] |
| 13 | +
|
| 14 | + Users --> CreateUser[POST /users] |
| 15 | + Users --> LoginAsVisitor[POST /users/login-as-visitor] |
| 16 | + Users --> LoginViaGaas[POST /users/login-via-gaas-token] |
| 17 | + Users --> GetMe[GET /me] |
| 18 | +
|
| 19 | + Rooms --> ListRooms[GET /rooms] |
| 20 | + Rooms --> GetRoom[GET /rooms/:id] |
| 21 | + Rooms --> CreateRoom[POST /rooms] |
| 22 | + Rooms --> CloseRoom[POST /rooms/:id/close] |
| 23 | + Rooms --> KnockKnock[GET /rooms/:id/knock-knock] |
| 24 | + Rooms --> AddAI[POST /rooms/:id/ai_players] |
| 25 | +
|
| 26 | + Games --> GetGame[GET /games/:id] |
| 27 | + Games --> CreateGame[POST /rooms/:id/game] |
| 28 | + Games --> EndGame[DELETE /rooms/:id/game] |
| 29 | + Games --> PlaceStack[POST /games/:id/place-stack] |
| 30 | + Games --> SplitStack[POST /games/:id/split-stack] |
| 31 | + Games --> InitMap[POST /games/:id/init-map-automatically] |
| 32 | +``` |
| 33 | + |
| 34 | +## API Endpoints Description |
| 35 | + |
| 36 | +### User Management |
| 37 | + |
| 38 | +- **POST /api/v1/users**: Create a new user |
| 39 | +- **POST /api/v1/users/login-as-visitor**: Login as a visitor (guest user) |
| 40 | +- **POST /api/v1/users/login-via-gaas-token**: Login using a GaaS (Game as a Service) token |
| 41 | +- **GET /api/v1/me**: Get current user information |
| 42 | + |
| 43 | +### Room Management |
| 44 | + |
| 45 | +- **GET /api/v1/rooms**: List all available rooms |
| 46 | +- **GET /api/v1/rooms/:id**: Get details of a specific room |
| 47 | +- **POST /api/v1/rooms**: Create a new room |
| 48 | +- **POST /api/v1/rooms/:id/close**: Close a room |
| 49 | +- **GET /api/v1/rooms/:id/knock-knock**: Get a token to subscribe to a room's channel |
| 50 | +- **POST /api/v1/rooms/:id/ai_players**: Add an AI player to a room |
| 51 | + |
| 52 | +### Game Management |
| 53 | + |
| 54 | +- **GET /api/v1/games/:id**: Get details of a specific game |
| 55 | +- **POST /api/v1/rooms/:id/game**: Create a new game in a room |
| 56 | +- **DELETE /api/v1/rooms/:id/game**: End a game in a room |
| 57 | +- **POST /api/v1/games/:id/place-stack**: Place a stack on the board |
| 58 | +- **POST /api/v1/games/:id/split-stack**: Split a stack and move it |
| 59 | +- **POST /api/v1/games/:id/init-map-automatically**: Initialize the game map automatically |
| 60 | + |
| 61 | +### Bot Management |
| 62 | + |
| 63 | +- **GET /api/v1/bots**: List all bots |
| 64 | +- **POST /api/v1/bots**: Create a new bot |
| 65 | +- **GET /api/v1/bots/:id**: Get details of a specific bot |
| 66 | +- **PUT /api/v1/bots/:id**: Update a bot |
| 67 | +- **DELETE /api/v1/bots/:id**: Delete a bot |
| 68 | + |
| 69 | +The API follows RESTful principles and is organized around the main resources of the application: users, rooms, games, and bots. The endpoints provide the necessary operations to manage these resources and interact with the game system. |
0 commit comments