From 3844456f0ca41d9056a7fb9e4bb6a762824b0b74 Mon Sep 17 00:00:00 2001 From: Janis Date: Thu, 30 Apr 2026 18:56:48 +0200 Subject: [PATCH] feat(api): add comprehensive API collection for NowChess microservices --- bruno/README.md | 149 ++++++++++++++++++ bruno/account/account/01 Register.bru | 24 +++ bruno/account/account/02 Login.bru | 23 +++ bruno/account/account/03 Get Current User.bru | 16 ++ .../account/account/04 Get Public Profile.bru | 15 ++ bruno/account/account/05 Create Bot.bru | 23 +++ bruno/account/account/06 List Bots.bru | 16 ++ bruno/account/account/07 Update Bot Name.bru | 23 +++ bruno/account/account/08 Rotate Bot Token.bru | 15 ++ bruno/account/account/09 Delete Bot.bru | 15 ++ .../account/account/10 Get Official Bots.bru | 15 ++ bruno/account/account/11 Ban User.bru | 15 ++ bruno/account/account/12 Unban User.bru | 15 ++ bruno/account/account/folder.bru | 4 + bruno/account/challenge/01 Send Challenge.bru | 26 +++ .../account/challenge/02 List Challenges.bru | 16 ++ bruno/account/challenge/03 Get Challenge.bru | 16 ++ .../account/challenge/04 Accept Challenge.bru | 15 ++ .../challenge/05 Decline Challenge.bru | 23 +++ .../account/challenge/06 Cancel Challenge.bru | 15 ++ bruno/account/challenge/folder.bru | 4 + .../official/01 Challenge Official Bot.bru | 22 +++ .../official/02 Create Official Bot.bru | 23 +++ .../official/03 Delete Official Bot.bru | 15 ++ bruno/account/official/folder.bru | 4 + bruno/bot/01 Stream Bot Events.bru | 26 +++ bruno/bot/02 Stream Game Events.bru | 20 +++ bruno/bot/03 Make Bot Move.bru | 23 +++ bruno/collection.bru | 36 +++++ bruno/core/coordinator/01 List Instances.bru | 15 ++ bruno/core/coordinator/02 Get Metrics.bru | 15 ++ bruno/core/coordinator/03 Rebalance.bru | 15 ++ bruno/core/coordinator/04 Failover.bru | 15 ++ bruno/core/coordinator/05 Scale Up.bru | 15 ++ bruno/core/coordinator/06 Scale Down.bru | 15 ++ bruno/core/coordinator/folder.bru | 4 + bruno/core/game/01 Create Game.bru | 26 +++ bruno/core/game/02 Get Game.bru | 15 ++ bruno/core/game/03 Make Move.bru | 15 ++ bruno/core/game/04 Get Legal Moves.bru | 15 ++ bruno/core/game/05 Undo Move.bru | 15 ++ bruno/core/game/06 Redo Move.bru | 15 ++ bruno/core/game/07 Resign Game.bru | 15 ++ bruno/core/game/08 Import FEN.bru | 24 +++ bruno/core/game/09 Import PGN.bru | 22 +++ bruno/core/game/10 Export FEN.bru | 15 ++ bruno/core/game/11 Export PGN.bru | 15 ++ bruno/core/game/12 Offer Draw.bru | 15 ++ bruno/core/game/13 Accept Draw.bru | 15 ++ bruno/core/game/14 Decline Draw.bru | 15 ++ bruno/core/game/15 Claim Draw.bru | 15 ++ bruno/core/game/16 Request Takeback.bru | 15 ++ bruno/core/game/17 Accept Takeback.bru | 15 ++ bruno/core/game/18 Decline Takeback.bru | 15 ++ bruno/core/game/folder.bru | 4 + bruno/core/io/01 Import FEN.bru | 23 +++ bruno/core/io/02 Import PGN.bru | 23 +++ bruno/core/io/03 Export FEN.bru | 21 +++ bruno/core/io/04 Export PGN.bru | 21 +++ bruno/core/io/folder.bru | 4 + bruno/core/rules/01 Candidate Moves.bru | 24 +++ bruno/core/rules/02 Legal Moves.bru | 24 +++ bruno/core/rules/03 All Legal Moves.bru | 21 +++ bruno/core/rules/04 Is Check.bru | 21 +++ bruno/core/rules/05 Is Checkmate.bru | 21 +++ bruno/core/rules/folder.bru | 4 + bruno/environments/local.bru | 8 +- bruno/environments/prod.bru | 7 + bruno/environments/staging.bru | 7 + bruno/store/01 Get Game Record.bru | 15 ++ bruno/store/02 Get Running Games.bru | 21 +++ bruno/store/03 Get Game History.bru | 21 +++ bruno/ws/01 Game WebSocket.bru | 31 ++++ bruno/ws/02 User WebSocket.bru | 32 ++++ 74 files changed, 1395 insertions(+), 1 deletion(-) create mode 100644 bruno/README.md create mode 100644 bruno/account/account/01 Register.bru create mode 100644 bruno/account/account/02 Login.bru create mode 100644 bruno/account/account/03 Get Current User.bru create mode 100644 bruno/account/account/04 Get Public Profile.bru create mode 100644 bruno/account/account/05 Create Bot.bru create mode 100644 bruno/account/account/06 List Bots.bru create mode 100644 bruno/account/account/07 Update Bot Name.bru create mode 100644 bruno/account/account/08 Rotate Bot Token.bru create mode 100644 bruno/account/account/09 Delete Bot.bru create mode 100644 bruno/account/account/10 Get Official Bots.bru create mode 100644 bruno/account/account/11 Ban User.bru create mode 100644 bruno/account/account/12 Unban User.bru create mode 100644 bruno/account/account/folder.bru create mode 100644 bruno/account/challenge/01 Send Challenge.bru create mode 100644 bruno/account/challenge/02 List Challenges.bru create mode 100644 bruno/account/challenge/03 Get Challenge.bru create mode 100644 bruno/account/challenge/04 Accept Challenge.bru create mode 100644 bruno/account/challenge/05 Decline Challenge.bru create mode 100644 bruno/account/challenge/06 Cancel Challenge.bru create mode 100644 bruno/account/challenge/folder.bru create mode 100644 bruno/account/official/01 Challenge Official Bot.bru create mode 100644 bruno/account/official/02 Create Official Bot.bru create mode 100644 bruno/account/official/03 Delete Official Bot.bru create mode 100644 bruno/account/official/folder.bru create mode 100644 bruno/bot/01 Stream Bot Events.bru create mode 100644 bruno/bot/02 Stream Game Events.bru create mode 100644 bruno/bot/03 Make Bot Move.bru create mode 100644 bruno/core/coordinator/01 List Instances.bru create mode 100644 bruno/core/coordinator/02 Get Metrics.bru create mode 100644 bruno/core/coordinator/03 Rebalance.bru create mode 100644 bruno/core/coordinator/04 Failover.bru create mode 100644 bruno/core/coordinator/05 Scale Up.bru create mode 100644 bruno/core/coordinator/06 Scale Down.bru create mode 100644 bruno/core/coordinator/folder.bru create mode 100644 bruno/core/game/01 Create Game.bru create mode 100644 bruno/core/game/02 Get Game.bru create mode 100644 bruno/core/game/03 Make Move.bru create mode 100644 bruno/core/game/04 Get Legal Moves.bru create mode 100644 bruno/core/game/05 Undo Move.bru create mode 100644 bruno/core/game/06 Redo Move.bru create mode 100644 bruno/core/game/07 Resign Game.bru create mode 100644 bruno/core/game/08 Import FEN.bru create mode 100644 bruno/core/game/09 Import PGN.bru create mode 100644 bruno/core/game/10 Export FEN.bru create mode 100644 bruno/core/game/11 Export PGN.bru create mode 100644 bruno/core/game/12 Offer Draw.bru create mode 100644 bruno/core/game/13 Accept Draw.bru create mode 100644 bruno/core/game/14 Decline Draw.bru create mode 100644 bruno/core/game/15 Claim Draw.bru create mode 100644 bruno/core/game/16 Request Takeback.bru create mode 100644 bruno/core/game/17 Accept Takeback.bru create mode 100644 bruno/core/game/18 Decline Takeback.bru create mode 100644 bruno/core/game/folder.bru create mode 100644 bruno/core/io/01 Import FEN.bru create mode 100644 bruno/core/io/02 Import PGN.bru create mode 100644 bruno/core/io/03 Export FEN.bru create mode 100644 bruno/core/io/04 Export PGN.bru create mode 100644 bruno/core/io/folder.bru create mode 100644 bruno/core/rules/01 Candidate Moves.bru create mode 100644 bruno/core/rules/02 Legal Moves.bru create mode 100644 bruno/core/rules/03 All Legal Moves.bru create mode 100644 bruno/core/rules/04 Is Check.bru create mode 100644 bruno/core/rules/05 Is Checkmate.bru create mode 100644 bruno/core/rules/folder.bru create mode 100644 bruno/environments/prod.bru create mode 100644 bruno/environments/staging.bru create mode 100644 bruno/store/01 Get Game Record.bru create mode 100644 bruno/store/02 Get Running Games.bru create mode 100644 bruno/store/03 Get Game History.bru create mode 100644 bruno/ws/01 Game WebSocket.bru create mode 100644 bruno/ws/02 User WebSocket.bru diff --git a/bruno/README.md b/bruno/README.md new file mode 100644 index 0000000..33c6b8d --- /dev/null +++ b/bruno/README.md @@ -0,0 +1,149 @@ +# NowChess Bruno API Collection + +Complete API collection for all NowChess microservices. + +## Structure + +``` +bruno/ +├── collection.bru # Collection metadata +├── environments/ # Environment configurations +│ ├── local.bru # Local development (http://localhost) +│ ├── staging.bru # Staging (https://st.nowchess.janis-eccarius.de) +│ └── prod.bru # Production (https://nowchess.janis-eccarius.de) +├── core/ # Core service endpoints (port 8080) +│ ├── game.bru # Game management +│ ├── rules.bru # Rule validation (@InternalOnly) +│ ├── io.bru # Import/Export (@InternalOnly) +│ └── coordinator.bru # Orchestration +├── account/ # Account service (port 8083) +│ ├── account.bru # User & bot accounts +│ ├── challenge.bru # Player challenges +│ └── official-challenge.bru # Official bot challenges +├── store/ # Store service (port 8085) +│ └── game.bru # Game persistence +├── ws/ # WebSocket (port 8084) +│ ├── game-ws.bru # Game real-time updates +│ └── user-ws.bru # User notifications +└── bot/ # Bot integration + └── events.bru # Bot event streaming +``` + +## Ingress Routing + +Based on `ingress-nginx` configuration: + +```yaml +/api/account → nowchess-account-active:8083 +/ws → nowchess-ws-active:8084 +/api/store → nowchess-store-active:8085 +/api → nowchess-core-active:8080 +``` + +## Environments + +### Local Development +``` +baseUrl: http://localhost:8080 +accountBaseUrl: http://localhost:8083 +storeBaseUrl: http://localhost:8085 +wsBaseUrl: ws://localhost:8084 +``` + +### Staging +``` +baseUrl: https://st.nowchess.janis-eccarius.de/api +wsBaseUrl: wss://st.nowchess.janis-eccarius.de/ws +``` + +### Production +``` +baseUrl: https://nowchess.janis-eccarius.de/api +wsBaseUrl: wss://nowchess.janis-eccarius.de/ws +``` + +## Environment Variables + +Set these in your Bruno environment for authentication: +- `token`: JWT token for regular user operations +- `adminToken`: JWT token with Admin role +- `botToken`: Bot account JWT token +- `internalToken`: Internal service-to-service token +- `gameId`: Game identifier for game endpoints +- `username`: User username for profile/challenge operations +- `playerId`: Player ID for store operations +- `botId`: Bot ID for bot endpoints +- `botName`: Official bot name for challenges +- `difficulty`: Bot difficulty 1000-2800 (ELO) +- `color`: white/black/random for bot challenges + +## Security Notes + +From `@modules/security/src`: +- **InternalOnly** endpoints require internal service authentication + - `/api/rules/*` + - `/io/*` +- **@RolesAllowed** endpoints require JWT with specific roles + - Admin operations + - Authenticated user operations +- Internal filters validate service-to-service calls + +## API Endpoints Summary + +### Public Endpoints (No Auth Required) +- `GET /api/account/{username}` - Public profile +- `GET /api/account/official-bots` - List official bots +- `GET /game/{gameId}` - Game record +- `GET /api/board/game/{gameId}` - Game state +- `GET /api/board/game/{gameId}/moves` - Legal moves + +### Authenticated Endpoints (JWT Required) +- `POST /api/account` - Register +- `POST /api/account/login` - Login +- `GET /api/account/me` - Current user profile +- `POST /api/challenge/*` - Challenge operations +- `POST /api/challenge/official/{botName}` - Challenge official bot +- `POST /api/account/bots` - Create bot account +- `GET /api/bot/stream/events` - Bot event stream +- `WS /api/board/game/{gameId}/ws` - Game WebSocket +- `WS /api/user/ws` - User notifications + +### Internal Endpoints (@InternalOnly) +- `POST /api/rules/*` - Rule validation +- `POST /io/*` - Format conversion +- `POST /api/board/game` - Create game + +## Usage + +1. **Select Environment**: Click the environment dropdown and choose local/staging/prod +2. **Set Variables**: Update `token`, `gameId`, `username`, etc. as needed +3. **Send Request**: Click Send on any endpoint +4. **WebSocket**: Use Bruno's WebSocket support or connect manually with: + ```bash + websocat wss://nowchess.janis-eccarius.de/ws/api/board/game/GAMEID/ws + ``` + +## Example Workflows + +### Play a Game +1. `POST /api/account` - Create user +2. `POST /api/account/login` - Get JWT token +3. `POST /api/challenge/official/Stockfish` - Challenge a bot +4. Use returned `gameId` for subsequent moves +5. `WS /api/board/game/{gameId}/ws` - Connect for real-time updates +6. `POST /api/board/game/{gameId}/move/{uci}` - Make moves + +### Manage Bot Account +1. `POST /api/account` - Create main account +2. `POST /api/account/login` - Get token +3. `POST /api/account/bots` - Create bot account +4. Copy bot token from response +5. `GET /api/bot/stream/events?botId={botId}` - Listen for game invites +6. `POST /api/bot/game/{gameId}/move/{uci}` - Submit moves + +## Notes + +- All timestamps are ISO 8601 format +- Move notation uses UCI (e.g., "e2e4") +- Game IDs are auto-generated UUIDs +- WebSocket connections auto-close on inactivity (check your server timeout) diff --git a/bruno/account/account/01 Register.bru b/bruno/account/account/01 Register.bru new file mode 100644 index 0000000..26d53ef --- /dev/null +++ b/bruno/account/account/01 Register.bru @@ -0,0 +1,24 @@ +meta { + name: Register + type: http + seq: 1 +} + +http { + method: POST + url: {{accountBaseUrl}}/account + body: json + auth: none +} + +headers { + Content-Type: application/json +} + +body:json { + { + "username": "player1", + "email": "player1@example.com", + "password": "securepassword" + } +} diff --git a/bruno/account/account/02 Login.bru b/bruno/account/account/02 Login.bru new file mode 100644 index 0000000..23b06bf --- /dev/null +++ b/bruno/account/account/02 Login.bru @@ -0,0 +1,23 @@ +meta { + name: Login + type: http + seq: 2 +} + +http { + method: POST + url: {{accountBaseUrl}}/account/login + body: json + auth: none +} + +headers { + Content-Type: application/json +} + +body:json { + { + "username": "player1", + "password": "securepassword" + } +} diff --git a/bruno/account/account/03 Get Current User.bru b/bruno/account/account/03 Get Current User.bru new file mode 100644 index 0000000..968abf7 --- /dev/null +++ b/bruno/account/account/03 Get Current User.bru @@ -0,0 +1,16 @@ +meta { + name: Get Current User + type: http + seq: 3 +} + +get { + url: {{accountBaseUrl}}/account/me + body: none + auth: none +} + +headers { + Authorization: Bearer {{token}} + Accept: application/json +} diff --git a/bruno/account/account/04 Get Public Profile.bru b/bruno/account/account/04 Get Public Profile.bru new file mode 100644 index 0000000..b387563 --- /dev/null +++ b/bruno/account/account/04 Get Public Profile.bru @@ -0,0 +1,15 @@ +meta { + name: Get Public Profile + type: http + seq: 4 +} + +http { + method: GET + url: {{accountBaseUrl}}/account/{{username}} + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/account/account/05 Create Bot.bru b/bruno/account/account/05 Create Bot.bru new file mode 100644 index 0000000..8dffb23 --- /dev/null +++ b/bruno/account/account/05 Create Bot.bru @@ -0,0 +1,23 @@ +meta { + name: Create Bot + type: http + seq: 5 +} + +http { + method: POST + url: {{accountBaseUrl}}/account/bots + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{token}} +} + +body:json { + { + "name": "ChessBot-1" + } +} diff --git a/bruno/account/account/06 List Bots.bru b/bruno/account/account/06 List Bots.bru new file mode 100644 index 0000000..44fada9 --- /dev/null +++ b/bruno/account/account/06 List Bots.bru @@ -0,0 +1,16 @@ +meta { + name: List Bots + type: http + seq: 6 +} + +get { + url: {{accountBaseUrl}}/account/bots + body: none + auth: none +} + +headers { + Authorization: Bearer {{token}} + Accept: application/json +} diff --git a/bruno/account/account/07 Update Bot Name.bru b/bruno/account/account/07 Update Bot Name.bru new file mode 100644 index 0000000..ecc7304 --- /dev/null +++ b/bruno/account/account/07 Update Bot Name.bru @@ -0,0 +1,23 @@ +meta { + name: Update Bot Name + type: http + seq: 7 +} + +http { + method: PUT + url: {{accountBaseUrl}}/account/bots/{{botId}} + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{token}} +} + +body:json { + { + "name": "ChessBot-Updated" + } +} diff --git a/bruno/account/account/08 Rotate Bot Token.bru b/bruno/account/account/08 Rotate Bot Token.bru new file mode 100644 index 0000000..efff097 --- /dev/null +++ b/bruno/account/account/08 Rotate Bot Token.bru @@ -0,0 +1,15 @@ +meta { + name: Rotate Bot Token + type: http + seq: 8 +} + +http { + method: POST + url: {{accountBaseUrl}}/account/bots/{{botId}}/rotate-token + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/account/account/09 Delete Bot.bru b/bruno/account/account/09 Delete Bot.bru new file mode 100644 index 0000000..6f3b068 --- /dev/null +++ b/bruno/account/account/09 Delete Bot.bru @@ -0,0 +1,15 @@ +meta { + name: Delete Bot + type: http + seq: 9 +} + +http { + method: DELETE + url: {{accountBaseUrl}}/account/bots/{{botId}} + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/account/account/10 Get Official Bots.bru b/bruno/account/account/10 Get Official Bots.bru new file mode 100644 index 0000000..33dd4b5 --- /dev/null +++ b/bruno/account/account/10 Get Official Bots.bru @@ -0,0 +1,15 @@ +meta { + name: Get Official Bots + type: http + seq: 10 +} + +http { + method: GET + url: {{accountBaseUrl}}/account/official-bots + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/account/account/11 Ban User.bru b/bruno/account/account/11 Ban User.bru new file mode 100644 index 0000000..1c5aaae --- /dev/null +++ b/bruno/account/account/11 Ban User.bru @@ -0,0 +1,15 @@ +meta { + name: Ban User + type: http + seq: 11 +} + +http { + method: POST + url: {{accountBaseUrl}}/account/{{userId}}/ban + auth: none +} + +headers { + Authorization: Bearer {{adminToken}} +} diff --git a/bruno/account/account/12 Unban User.bru b/bruno/account/account/12 Unban User.bru new file mode 100644 index 0000000..d82e5b9 --- /dev/null +++ b/bruno/account/account/12 Unban User.bru @@ -0,0 +1,15 @@ +meta { + name: Unban User + type: http + seq: 12 +} + +http { + method: POST + url: {{accountBaseUrl}}/account/{{userId}}/unban + auth: none +} + +headers { + Authorization: Bearer {{adminToken}} +} diff --git a/bruno/account/account/folder.bru b/bruno/account/account/folder.bru new file mode 100644 index 0000000..0122192 --- /dev/null +++ b/bruno/account/account/folder.bru @@ -0,0 +1,4 @@ +meta { + name: account + seq: 1 +} diff --git a/bruno/account/challenge/01 Send Challenge.bru b/bruno/account/challenge/01 Send Challenge.bru new file mode 100644 index 0000000..2713c70 --- /dev/null +++ b/bruno/account/challenge/01 Send Challenge.bru @@ -0,0 +1,26 @@ +meta { + name: Send Challenge + type: http + seq: 1 +} + +http { + method: POST + url: {{accountBaseUrl}}/challenge/{{username}} + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{token}} +} + +body:json { + { + "timeControl": { + "limitSeconds": 600, + "incrementSeconds": 5 + } + } +} diff --git a/bruno/account/challenge/02 List Challenges.bru b/bruno/account/challenge/02 List Challenges.bru new file mode 100644 index 0000000..fdc8d77 --- /dev/null +++ b/bruno/account/challenge/02 List Challenges.bru @@ -0,0 +1,16 @@ +meta { + name: List Challenges + type: http + seq: 2 +} + +get { + url: {{accountBaseUrl}}/challenge + body: none + auth: none +} + +headers { + Authorization: Bearer {{token}} + Accept: application/json +} diff --git a/bruno/account/challenge/03 Get Challenge.bru b/bruno/account/challenge/03 Get Challenge.bru new file mode 100644 index 0000000..0cc27d0 --- /dev/null +++ b/bruno/account/challenge/03 Get Challenge.bru @@ -0,0 +1,16 @@ +meta { + name: Get Challenge + type: http + seq: 3 +} + +http { + method: GET + url: {{accountBaseUrl}}/challenge/{{challengeId}} + auth: none +} + +headers { + Authorization: Bearer {{token}} + Accept: application/json +} diff --git a/bruno/account/challenge/04 Accept Challenge.bru b/bruno/account/challenge/04 Accept Challenge.bru new file mode 100644 index 0000000..efc8606 --- /dev/null +++ b/bruno/account/challenge/04 Accept Challenge.bru @@ -0,0 +1,15 @@ +meta { + name: Accept Challenge + type: http + seq: 4 +} + +http { + method: POST + url: {{accountBaseUrl}}/challenge/{{challengeId}}/accept + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/account/challenge/05 Decline Challenge.bru b/bruno/account/challenge/05 Decline Challenge.bru new file mode 100644 index 0000000..90bb92d --- /dev/null +++ b/bruno/account/challenge/05 Decline Challenge.bru @@ -0,0 +1,23 @@ +meta { + name: Decline Challenge + type: http + seq: 5 +} + +http { + method: POST + url: {{accountBaseUrl}}/challenge/{{challengeId}}/decline + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{token}} +} + +body:json { + { + "reason": "Not interested" + } +} diff --git a/bruno/account/challenge/06 Cancel Challenge.bru b/bruno/account/challenge/06 Cancel Challenge.bru new file mode 100644 index 0000000..9f6f7d0 --- /dev/null +++ b/bruno/account/challenge/06 Cancel Challenge.bru @@ -0,0 +1,15 @@ +meta { + name: Cancel Challenge + type: http + seq: 6 +} + +http { + method: POST + url: {{accountBaseUrl}}/challenge/{{challengeId}}/cancel + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/account/challenge/folder.bru b/bruno/account/challenge/folder.bru new file mode 100644 index 0000000..217c1c7 --- /dev/null +++ b/bruno/account/challenge/folder.bru @@ -0,0 +1,4 @@ +meta { + name: challenge + seq: 2 +} diff --git a/bruno/account/official/01 Challenge Official Bot.bru b/bruno/account/official/01 Challenge Official Bot.bru new file mode 100644 index 0000000..2147866 --- /dev/null +++ b/bruno/account/official/01 Challenge Official Bot.bru @@ -0,0 +1,22 @@ +meta { + name: Challenge Official Bot + type: http + seq: 1 +} + +http { + method: POST + url: {{accountBaseUrl}}/challenge/official/{{botName}}?difficulty={{difficulty}}&color={{color}} + auth: none +} + +headers { + Authorization: Bearer {{token}} + Accept: application/json +} + +notes { + Query Parameters: + - difficulty: 1000-2800 (ELO) + - color: white | black | random +} diff --git a/bruno/account/official/02 Create Official Bot.bru b/bruno/account/official/02 Create Official Bot.bru new file mode 100644 index 0000000..7410011 --- /dev/null +++ b/bruno/account/official/02 Create Official Bot.bru @@ -0,0 +1,23 @@ +meta { + name: Create Official Bot + type: http + seq: 2 +} + +http { + method: POST + url: {{accountBaseUrl}}/account/official-bots + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{adminToken}} +} + +body:json { + { + "name": "Stockfish-1000" + } +} diff --git a/bruno/account/official/03 Delete Official Bot.bru b/bruno/account/official/03 Delete Official Bot.bru new file mode 100644 index 0000000..3f62a49 --- /dev/null +++ b/bruno/account/official/03 Delete Official Bot.bru @@ -0,0 +1,15 @@ +meta { + name: Delete Official Bot + type: http + seq: 3 +} + +http { + method: DELETE + url: {{accountBaseUrl}}/account/official-bots/{{botId}} + auth: none +} + +headers { + Authorization: Bearer {{adminToken}} +} diff --git a/bruno/account/official/folder.bru b/bruno/account/official/folder.bru new file mode 100644 index 0000000..bf82589 --- /dev/null +++ b/bruno/account/official/folder.bru @@ -0,0 +1,4 @@ +meta { + name: official + seq: 3 +} diff --git a/bruno/bot/01 Stream Bot Events.bru b/bruno/bot/01 Stream Bot Events.bru new file mode 100644 index 0000000..34ac715 --- /dev/null +++ b/bruno/bot/01 Stream Bot Events.bru @@ -0,0 +1,26 @@ +meta { + name: Stream Bot Events + type: http + seq: 1 +} + +http { + method: GET + url: {{baseUrl}}/bot/stream/events?botId={{botId}} + auth: none +} + +headers { + Authorization: Bearer {{botToken}} + Accept: text/event-stream +} + +notes { + Server-Sent Events stream. + Bot must match token subject (botId). + + Events: + - Game start notification + - Move requests + - Game end notification +} diff --git a/bruno/bot/02 Stream Game Events.bru b/bruno/bot/02 Stream Game Events.bru new file mode 100644 index 0000000..2ba01b9 --- /dev/null +++ b/bruno/bot/02 Stream Game Events.bru @@ -0,0 +1,20 @@ +meta { + name: Stream Game Events + type: http + seq: 2 +} + +http { + method: GET + url: {{baseUrl}}/bot/game/stream/{{gameId}} + auth: none +} + +headers { + Accept: text/event-stream +} + +notes { + Server-Sent Events stream of game updates. + No authentication required - broadcasts all state changes. +} diff --git a/bruno/bot/03 Make Bot Move.bru b/bruno/bot/03 Make Bot Move.bru new file mode 100644 index 0000000..cc596c2 --- /dev/null +++ b/bruno/bot/03 Make Bot Move.bru @@ -0,0 +1,23 @@ +meta { + name: Make Bot Move + type: http + seq: 3 +} + +http { + method: POST + url: {{baseUrl}}/bot/game/{{gameId}}/move/{{uci}} + auth: none +} + +headers { + Authorization: Bearer {{botToken}} +} + +notes { + Submit move from bot. + + Parameters: + - gameId: Game identifier + - uci: Move notation (e.g., e2e4) +} diff --git a/bruno/collection.bru b/bruno/collection.bru index e69de29..c0bf10f 100644 --- a/bruno/collection.bru +++ b/bruno/collection.bru @@ -0,0 +1,36 @@ +meta { + name: NowChess API + type: http + seq: 1 +} + +docs { + title: NowChess Microservices API Collection + content: | + # NowChess API Collection + + Complete API collection for all NowChess microservices. + + ## Services Architecture + - **Core** (8080): Game engine, rules validation, format import/export + - **Account** (8083): User management, bot accounts, challenges + - **Store** (8085): Game persistence and history + - **WebSocket** (8084): Real-time game updates + + ## Ingress Routing + - /api/account → nowchess-account-active:8083 + - /ws → nowchess-ws-active:8084 + - /api/store → nowchess-store-active:8085 + - /api → nowchess-core-active:8080 + + ## Environments + - **local**: http://localhost (direct service ports) + - **staging**: https://st.nowchess.janis-eccarius.de/api + - **prod**: https://nowchess.janis-eccarius.de/api + + ## Security + @modules/security/src contains: + - InternalAuthFilter: Validates internal service tokens + - InternalOnly: Annotation for internal endpoints (rules, io) + - JWT validation for authenticated endpoints +} diff --git a/bruno/core/coordinator/01 List Instances.bru b/bruno/core/coordinator/01 List Instances.bru new file mode 100644 index 0000000..c47f7b9 --- /dev/null +++ b/bruno/core/coordinator/01 List Instances.bru @@ -0,0 +1,15 @@ +meta { + name: List Instances + type: http + seq: 1 +} + +http { + method: GET + url: {{baseUrl}}/coordinator/instances + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/core/coordinator/02 Get Metrics.bru b/bruno/core/coordinator/02 Get Metrics.bru new file mode 100644 index 0000000..5a8c1ef --- /dev/null +++ b/bruno/core/coordinator/02 Get Metrics.bru @@ -0,0 +1,15 @@ +meta { + name: Get Metrics + type: http + seq: 2 +} + +http { + method: GET + url: {{baseUrl}}/coordinator/metrics + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/core/coordinator/03 Rebalance.bru b/bruno/core/coordinator/03 Rebalance.bru new file mode 100644 index 0000000..b6c9532 --- /dev/null +++ b/bruno/core/coordinator/03 Rebalance.bru @@ -0,0 +1,15 @@ +meta { + name: Rebalance + type: http + seq: 3 +} + +http { + method: POST + url: {{baseUrl}}/coordinator/rebalance + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/core/coordinator/04 Failover.bru b/bruno/core/coordinator/04 Failover.bru new file mode 100644 index 0000000..3ba5252 --- /dev/null +++ b/bruno/core/coordinator/04 Failover.bru @@ -0,0 +1,15 @@ +meta { + name: Failover + type: http + seq: 4 +} + +http { + method: POST + url: {{baseUrl}}/coordinator/failover/{{instanceId}} + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/core/coordinator/05 Scale Up.bru b/bruno/core/coordinator/05 Scale Up.bru new file mode 100644 index 0000000..b93f15e --- /dev/null +++ b/bruno/core/coordinator/05 Scale Up.bru @@ -0,0 +1,15 @@ +meta { + name: Scale Up + type: http + seq: 5 +} + +http { + method: POST + url: {{baseUrl}}/coordinator/scale-up + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/core/coordinator/06 Scale Down.bru b/bruno/core/coordinator/06 Scale Down.bru new file mode 100644 index 0000000..f9a332e --- /dev/null +++ b/bruno/core/coordinator/06 Scale Down.bru @@ -0,0 +1,15 @@ +meta { + name: Scale Down + type: http + seq: 6 +} + +http { + method: POST + url: {{baseUrl}}/coordinator/scale-down + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/core/coordinator/folder.bru b/bruno/core/coordinator/folder.bru new file mode 100644 index 0000000..3ec5a8b --- /dev/null +++ b/bruno/core/coordinator/folder.bru @@ -0,0 +1,4 @@ +meta { + name: coordinator + seq: 4 +} diff --git a/bruno/core/game/01 Create Game.bru b/bruno/core/game/01 Create Game.bru new file mode 100644 index 0000000..0a9e838 --- /dev/null +++ b/bruno/core/game/01 Create Game.bru @@ -0,0 +1,26 @@ +meta { + name: Create Game + type: http + seq: 1 +} + +http { + method: POST + url: {{baseUrl}}/board/game + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + { + "white": {"id": "p1", "displayName": "Player 1"}, + "black": {"id": "p2", "displayName": "Player 2"}, + "timeControl": {"limitSeconds": 600, "incrementSeconds": 5}, + "mode": "Open" + } +} diff --git a/bruno/core/game/02 Get Game.bru b/bruno/core/game/02 Get Game.bru new file mode 100644 index 0000000..e6b91ba --- /dev/null +++ b/bruno/core/game/02 Get Game.bru @@ -0,0 +1,15 @@ +meta { + name: Get Game + type: http + seq: 2 +} + +http { + method: GET + url: {{baseUrl}}/board/game/{{gameId}} + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/core/game/03 Make Move.bru b/bruno/core/game/03 Make Move.bru new file mode 100644 index 0000000..c5a4c57 --- /dev/null +++ b/bruno/core/game/03 Make Move.bru @@ -0,0 +1,15 @@ +meta { + name: Make Move + type: http + seq: 3 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/move/{{uci}} + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/04 Get Legal Moves.bru b/bruno/core/game/04 Get Legal Moves.bru new file mode 100644 index 0000000..8b38c34 --- /dev/null +++ b/bruno/core/game/04 Get Legal Moves.bru @@ -0,0 +1,15 @@ +meta { + name: Get Legal Moves + type: http + seq: 4 +} + +http { + method: GET + url: {{baseUrl}}/board/game/{{gameId}}/moves?square={{square}} + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/core/game/05 Undo Move.bru b/bruno/core/game/05 Undo Move.bru new file mode 100644 index 0000000..e2a0a79 --- /dev/null +++ b/bruno/core/game/05 Undo Move.bru @@ -0,0 +1,15 @@ +meta { + name: Undo Move + type: http + seq: 5 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/undo + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/06 Redo Move.bru b/bruno/core/game/06 Redo Move.bru new file mode 100644 index 0000000..57cc6e4 --- /dev/null +++ b/bruno/core/game/06 Redo Move.bru @@ -0,0 +1,15 @@ +meta { + name: Redo Move + type: http + seq: 6 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/redo + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/07 Resign Game.bru b/bruno/core/game/07 Resign Game.bru new file mode 100644 index 0000000..d40381b --- /dev/null +++ b/bruno/core/game/07 Resign Game.bru @@ -0,0 +1,15 @@ +meta { + name: Resign Game + type: http + seq: 7 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/resign + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/08 Import FEN.bru b/bruno/core/game/08 Import FEN.bru new file mode 100644 index 0000000..7f59a84 --- /dev/null +++ b/bruno/core/game/08 Import FEN.bru @@ -0,0 +1,24 @@ +meta { + name: Import FEN + type: http + seq: 8 +} + +http { + method: POST + url: {{baseUrl}}/board/game/import/fen + body: json + auth: none +} + +headers { + Content-Type: application/json +} + +body:json { + { + "fen": "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1", + "white": {"id": "p1", "displayName": "Player 1"}, + "black": {"id": "p2", "displayName": "Player 2"} + } +} diff --git a/bruno/core/game/09 Import PGN.bru b/bruno/core/game/09 Import PGN.bru new file mode 100644 index 0000000..1057a6d --- /dev/null +++ b/bruno/core/game/09 Import PGN.bru @@ -0,0 +1,22 @@ +meta { + name: Import PGN + type: http + seq: 9 +} + +http { + method: POST + url: {{baseUrl}}/board/game/import/pgn + body: json + auth: none +} + +headers { + Content-Type: application/json +} + +body:json { + { + "pgn": "[Event \"Test Game\"]\n[Site \"NowChess\"]\n1. e4 e5 2. Nf3 Nc6" + } +} diff --git a/bruno/core/game/10 Export FEN.bru b/bruno/core/game/10 Export FEN.bru new file mode 100644 index 0000000..90878d1 --- /dev/null +++ b/bruno/core/game/10 Export FEN.bru @@ -0,0 +1,15 @@ +meta { + name: Export FEN + type: http + seq: 10 +} + +http { + method: GET + url: {{baseUrl}}/board/game/{{gameId}}/export/fen + auth: none +} + +headers { + Accept: text/plain +} diff --git a/bruno/core/game/11 Export PGN.bru b/bruno/core/game/11 Export PGN.bru new file mode 100644 index 0000000..308fd22 --- /dev/null +++ b/bruno/core/game/11 Export PGN.bru @@ -0,0 +1,15 @@ +meta { + name: Export PGN + type: http + seq: 11 +} + +http { + method: GET + url: {{baseUrl}}/board/game/{{gameId}}/export/pgn + auth: none +} + +headers { + Accept: application/x-chess-pgn +} diff --git a/bruno/core/game/12 Offer Draw.bru b/bruno/core/game/12 Offer Draw.bru new file mode 100644 index 0000000..2198126 --- /dev/null +++ b/bruno/core/game/12 Offer Draw.bru @@ -0,0 +1,15 @@ +meta { + name: Offer Draw + type: http + seq: 12 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/draw/offer + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/13 Accept Draw.bru b/bruno/core/game/13 Accept Draw.bru new file mode 100644 index 0000000..024c447 --- /dev/null +++ b/bruno/core/game/13 Accept Draw.bru @@ -0,0 +1,15 @@ +meta { + name: Accept Draw + type: http + seq: 13 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/draw/accept + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/14 Decline Draw.bru b/bruno/core/game/14 Decline Draw.bru new file mode 100644 index 0000000..e434ad8 --- /dev/null +++ b/bruno/core/game/14 Decline Draw.bru @@ -0,0 +1,15 @@ +meta { + name: Decline Draw + type: http + seq: 14 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/draw/decline + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/15 Claim Draw.bru b/bruno/core/game/15 Claim Draw.bru new file mode 100644 index 0000000..1130443 --- /dev/null +++ b/bruno/core/game/15 Claim Draw.bru @@ -0,0 +1,15 @@ +meta { + name: Claim Draw + type: http + seq: 15 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/draw/claim + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/16 Request Takeback.bru b/bruno/core/game/16 Request Takeback.bru new file mode 100644 index 0000000..bcbbfe3 --- /dev/null +++ b/bruno/core/game/16 Request Takeback.bru @@ -0,0 +1,15 @@ +meta { + name: Request Takeback + type: http + seq: 16 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/takeback/request + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/17 Accept Takeback.bru b/bruno/core/game/17 Accept Takeback.bru new file mode 100644 index 0000000..0b0db0f --- /dev/null +++ b/bruno/core/game/17 Accept Takeback.bru @@ -0,0 +1,15 @@ +meta { + name: Accept Takeback + type: http + seq: 17 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/takeback/accept + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/18 Decline Takeback.bru b/bruno/core/game/18 Decline Takeback.bru new file mode 100644 index 0000000..89ec3c3 --- /dev/null +++ b/bruno/core/game/18 Decline Takeback.bru @@ -0,0 +1,15 @@ +meta { + name: Decline Takeback + type: http + seq: 18 +} + +http { + method: POST + url: {{baseUrl}}/board/game/{{gameId}}/takeback/decline + auth: none +} + +headers { + Authorization: Bearer {{token}} +} diff --git a/bruno/core/game/folder.bru b/bruno/core/game/folder.bru new file mode 100644 index 0000000..2abf399 --- /dev/null +++ b/bruno/core/game/folder.bru @@ -0,0 +1,4 @@ +meta { + name: game + seq: 1 +} diff --git a/bruno/core/io/01 Import FEN.bru b/bruno/core/io/01 Import FEN.bru new file mode 100644 index 0000000..f9e308f --- /dev/null +++ b/bruno/core/io/01 Import FEN.bru @@ -0,0 +1,23 @@ +meta { + name: Import FEN + type: http + seq: 1 +} + +http { + method: POST + url: {{ioBaseUrl}}/io/import/fen + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + { + "fen": "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1" + } +} diff --git a/bruno/core/io/02 Import PGN.bru b/bruno/core/io/02 Import PGN.bru new file mode 100644 index 0000000..454adad --- /dev/null +++ b/bruno/core/io/02 Import PGN.bru @@ -0,0 +1,23 @@ +meta { + name: Import PGN + type: http + seq: 2 +} + +http { + method: POST + url: {{ioBaseUrl}}/io/import/pgn + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + { + "pgn": "[Event \"Test\"]\n1. e4 e5" + } +} diff --git a/bruno/core/io/03 Export FEN.bru b/bruno/core/io/03 Export FEN.bru new file mode 100644 index 0000000..f25645e --- /dev/null +++ b/bruno/core/io/03 Export FEN.bru @@ -0,0 +1,21 @@ +meta { + name: Export FEN + type: http + seq: 3 +} + +http { + method: POST + url: {{ioBaseUrl}}/io/export/fen + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + {} +} diff --git a/bruno/core/io/04 Export PGN.bru b/bruno/core/io/04 Export PGN.bru new file mode 100644 index 0000000..790b519 --- /dev/null +++ b/bruno/core/io/04 Export PGN.bru @@ -0,0 +1,21 @@ +meta { + name: Export PGN + type: http + seq: 4 +} + +http { + method: POST + url: {{ioBaseUrl}}/io/export/pgn + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + {} +} diff --git a/bruno/core/io/folder.bru b/bruno/core/io/folder.bru new file mode 100644 index 0000000..6ccde57 --- /dev/null +++ b/bruno/core/io/folder.bru @@ -0,0 +1,4 @@ +meta { + name: io + seq: 3 +} diff --git a/bruno/core/rules/01 Candidate Moves.bru b/bruno/core/rules/01 Candidate Moves.bru new file mode 100644 index 0000000..e02b232 --- /dev/null +++ b/bruno/core/rules/01 Candidate Moves.bru @@ -0,0 +1,24 @@ +meta { + name: Candidate Moves + type: http + seq: 1 +} + +post { + url: {{baseUrl}}/rules/candidate-moves + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + { + "context": {}, + "square": "e2" + } +} + diff --git a/bruno/core/rules/02 Legal Moves.bru b/bruno/core/rules/02 Legal Moves.bru new file mode 100644 index 0000000..1133971 --- /dev/null +++ b/bruno/core/rules/02 Legal Moves.bru @@ -0,0 +1,24 @@ +meta { + name: Legal Moves + type: http + seq: 2 +} + +http { + method: POST + url: {{baseUrl}}/rules/legal-moves + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + { + "context": {}, + "square": "e2" + } +} diff --git a/bruno/core/rules/03 All Legal Moves.bru b/bruno/core/rules/03 All Legal Moves.bru new file mode 100644 index 0000000..7d3f91e --- /dev/null +++ b/bruno/core/rules/03 All Legal Moves.bru @@ -0,0 +1,21 @@ +meta { + name: All Legal Moves + type: http + seq: 3 +} + +http { + method: POST + url: {{baseUrl}}/rules/all-legal-moves + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + {} +} diff --git a/bruno/core/rules/04 Is Check.bru b/bruno/core/rules/04 Is Check.bru new file mode 100644 index 0000000..57aaa25 --- /dev/null +++ b/bruno/core/rules/04 Is Check.bru @@ -0,0 +1,21 @@ +meta { + name: Is Check + type: http + seq: 4 +} + +http { + method: POST + url: {{baseUrl}}/rules/is-check + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + {} +} diff --git a/bruno/core/rules/05 Is Checkmate.bru b/bruno/core/rules/05 Is Checkmate.bru new file mode 100644 index 0000000..501a374 --- /dev/null +++ b/bruno/core/rules/05 Is Checkmate.bru @@ -0,0 +1,21 @@ +meta { + name: Is Checkmate + type: http + seq: 5 +} + +http { + method: POST + url: {{baseUrl}}/rules/is-checkmate + body: json + auth: none +} + +headers { + Content-Type: application/json + Authorization: Bearer {{internalToken}} +} + +body:json { + {} +} diff --git a/bruno/core/rules/folder.bru b/bruno/core/rules/folder.bru new file mode 100644 index 0000000..5c43fe2 --- /dev/null +++ b/bruno/core/rules/folder.bru @@ -0,0 +1,4 @@ +meta { + name: rules + seq: 2 +} diff --git a/bruno/environments/local.bru b/bruno/environments/local.bru index 7ec255f..a52e265 100644 --- a/bruno/environments/local.bru +++ b/bruno/environments/local.bru @@ -1,5 +1,11 @@ vars { baseUrl: http://localhost:8080 wsBaseUrl: ws://localhost:8084 - ioBaseUrl: http://localhost:8081 + ioBaseUrl: http://localhost:8080 + accountBaseUrl: http://localhost:8083/api + storeBaseUrl: http://localhost:8085 + token: your_jwt_token_here + adminToken: your_admin_jwt_token_here + botToken: your_bot_jwt_token_here + internalToken: your_internal_service_token_here } diff --git a/bruno/environments/prod.bru b/bruno/environments/prod.bru new file mode 100644 index 0000000..8da4862 --- /dev/null +++ b/bruno/environments/prod.bru @@ -0,0 +1,7 @@ +vars { + baseUrl: https://nowchess.janis-eccarius.de/api + wsBaseUrl: wss://nowchess.janis-eccarius.de/ws + ioBaseUrl: https://nowchess.janis-eccarius.de/api + accountBaseUrl: https://nowchess.janis-eccarius.de/api + storeBaseUrl: https://nowchess.janis-eccarius.de/api +} diff --git a/bruno/environments/staging.bru b/bruno/environments/staging.bru new file mode 100644 index 0000000..3cf331f --- /dev/null +++ b/bruno/environments/staging.bru @@ -0,0 +1,7 @@ +vars { + baseUrl: https://st.nowchess.janis-eccarius.de/api + wsBaseUrl: wss://st.nowchess.janis-eccarius.de/ws + ioBaseUrl: https://st.nowchess.janis-eccarius.de/api + accountBaseUrl: https://st.nowchess.janis-eccarius.de/api + storeBaseUrl: https://st.nowchess.janis-eccarius.de/api +} diff --git a/bruno/store/01 Get Game Record.bru b/bruno/store/01 Get Game Record.bru new file mode 100644 index 0000000..d6d9cfa --- /dev/null +++ b/bruno/store/01 Get Game Record.bru @@ -0,0 +1,15 @@ +meta { + name: Get Game Record + type: http + seq: 1 +} + +http { + method: GET + url: {{storeBaseUrl}}/game/{{gameId}} + auth: none +} + +headers { + Accept: application/json +} diff --git a/bruno/store/02 Get Running Games.bru b/bruno/store/02 Get Running Games.bru new file mode 100644 index 0000000..c9844d9 --- /dev/null +++ b/bruno/store/02 Get Running Games.bru @@ -0,0 +1,21 @@ +meta { + name: Get Running Games + type: http + seq: 2 +} + +http { + method: GET + url: {{storeBaseUrl}}/game/running/{{playerId}}?offset=0&limit=20 + auth: none +} + +headers { + Accept: application/json +} + +notes { + Optional query parameters: + - offset: Skip N records (default 0) + - limit: Return N records (default 20) +} diff --git a/bruno/store/03 Get Game History.bru b/bruno/store/03 Get Game History.bru new file mode 100644 index 0000000..562656d --- /dev/null +++ b/bruno/store/03 Get Game History.bru @@ -0,0 +1,21 @@ +meta { + name: Get Game History + type: http + seq: 3 +} + +http { + method: GET + url: {{storeBaseUrl}}/game/history/{{playerId}}?offset=0&limit=20 + auth: none +} + +headers { + Accept: application/json +} + +notes { + Optional query parameters: + - offset: Skip N records (default 0) + - limit: Return N records (default 20) +} diff --git a/bruno/ws/01 Game WebSocket.bru b/bruno/ws/01 Game WebSocket.bru new file mode 100644 index 0000000..3d00f2e --- /dev/null +++ b/bruno/ws/01 Game WebSocket.bru @@ -0,0 +1,31 @@ +meta { + name: Game WebSocket + type: http + seq: 1 +} + +http { + method: GET + url: {{wsBaseUrl}}/api/board/game/{{gameId}}/ws + auth: none +} + +headers { + Authorization: Bearer {{token}} + Connection: Upgrade + Upgrade: websocket +} + +notes { + WebSocket connection for real-time game updates. + + Local: ws://localhost:8084/api/board/game/{{gameId}}/ws + Staging: wss://st.nowchess.janis-eccarius.de/ws/api/board/game/{{gameId}}/ws + Prod: wss://nowchess.janis-eccarius.de/ws/api/board/game/{{gameId}}/ws + + Message Types: + - CONNECTED: Connection established + - MOVE: Player move + - GAME_STATE: Full state update + - ERROR: Error message +} diff --git a/bruno/ws/02 User WebSocket.bru b/bruno/ws/02 User WebSocket.bru new file mode 100644 index 0000000..cdd78c0 --- /dev/null +++ b/bruno/ws/02 User WebSocket.bru @@ -0,0 +1,32 @@ +meta { + name: User WebSocket + type: http + seq: 2 +} + +http { + method: GET + url: {{wsBaseUrl}}/api/user/ws + auth: none +} + +headers { + Authorization: Bearer {{token}} + Connection: Upgrade + Upgrade: websocket +} + +notes { + WebSocket connection for user notifications. + + Local: ws://localhost:8084/api/user/ws + Staging: wss://st.nowchess.janis-eccarius.de/ws/api/user/ws + Prod: wss://nowchess.janis-eccarius.de/ws/api/user/ws + + Message Types: + - CONNECTED: Connection established + - CHALLENGE: Challenge received + - GAME_INVITE: Game invitation + - NOTIFICATION: General notification + - ERROR: Error message +}