feat(api): add comprehensive API collection for NowChess microservices
Build & Test (NowChessSystems) TeamCity build finished
Build & Test (NowChessSystems) TeamCity build finished
This commit is contained in:
+149
@@ -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)
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
meta {
|
||||
name: account
|
||||
seq: 1
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
meta {
|
||||
name: challenge
|
||||
seq: 2
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
meta {
|
||||
name: official
|
||||
seq: 3
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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.
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
meta {
|
||||
name: Rebalance
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
http {
|
||||
method: POST
|
||||
url: {{baseUrl}}/coordinator/rebalance
|
||||
auth: none
|
||||
}
|
||||
|
||||
headers {
|
||||
Accept: application/json
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
meta {
|
||||
name: coordinator
|
||||
seq: 4
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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"}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -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}}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
meta {
|
||||
name: game
|
||||
seq: 1
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
{}
|
||||
}
|
||||
@@ -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 {
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
meta {
|
||||
name: io
|
||||
seq: 3
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
{}
|
||||
}
|
||||
@@ -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 {
|
||||
{}
|
||||
}
|
||||
@@ -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 {
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
meta {
|
||||
name: rules
|
||||
seq: 2
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user