docs: update remaining docs with vote tracking API changes
Update README.md, docs/api/README.md, session-lifecycle guide, webhooks-and-events guide, and archive docs (BOT_INTEGRATION, API_QUICK_REFERENCE) with new endpoints and vote.received event. Made-with: Cursor
This commit is contained in:
@@ -40,6 +40,8 @@ All REST endpoints are prefixed with `/api/` except `/health`.
|
||||
- `GET /api/sessions/active`
|
||||
- `GET /api/sessions/{id}`
|
||||
- `GET /api/sessions/{id}/games`
|
||||
- `GET /api/sessions/{id}/votes`
|
||||
- `GET /api/votes`
|
||||
- `GET /api/stats`
|
||||
- `POST /api/pick`
|
||||
- `GET /health`
|
||||
@@ -82,7 +84,7 @@ SQLite stores booleans as integers (0/1). In request bodies, pass JavaScript boo
|
||||
|
||||
## Pagination
|
||||
|
||||
No pagination. All list endpoints return full result sets.
|
||||
Most list endpoints return full result sets. The exception is `GET /api/votes`, which supports pagination via `page` and `limit` query parameters (default: page 1, limit 50, max 100).
|
||||
|
||||
## Quick Reference
|
||||
|
||||
@@ -128,6 +130,7 @@ No pagination. All list endpoints return full result sets.
|
||||
| DELETE | `/api/sessions/{id}` | Yes | Delete a session |
|
||||
| POST | `/api/sessions/{id}/close` | Yes | Close a session |
|
||||
| GET | `/api/sessions/{id}/games` | No | List games in a session |
|
||||
| GET | `/api/sessions/{id}/votes` | No | Get per-game vote breakdown for a session |
|
||||
| POST | `/api/sessions/{id}/games` | Yes | Add a game to a session |
|
||||
| POST | `/api/sessions/{id}/chat-import` | Yes | Import chat log for vote processing |
|
||||
| GET | `/api/sessions/{id}/export` | Yes | Export session |
|
||||
@@ -154,6 +157,7 @@ No pagination. All list endpoints return full result sets.
|
||||
|
||||
| Method | Path | Auth | Description |
|
||||
|--------|------|------|-------------|
|
||||
| GET | `/api/votes` | No | Paginated vote history with filtering |
|
||||
| POST | `/api/votes/live` | Yes | Record a live vote (up/down) |
|
||||
|
||||
### Webhooks
|
||||
|
||||
@@ -270,7 +270,7 @@ curl -X DELETE "http://localhost:5000/api/sessions/5" \
|
||||
|
||||
## 9. Real-time Updates via WebSocket
|
||||
|
||||
The API provides real-time updates over WebSocket for session events: `session.started`, `game.added`, `session.ended`, and `player-count.updated`. Connect to `/api/sessions/live`, authenticate with your JWT, and subscribe to session IDs to receive these events without polling.
|
||||
The API provides real-time updates over WebSocket for session events: `session.started`, `game.added`, `session.ended`, `player-count.updated`, and `vote.received`. Connect to `/api/sessions/live`, authenticate with your JWT, and subscribe to session IDs to receive these events without polling.
|
||||
|
||||
For connection setup, message types, and event payloads, see [WebSocket Protocol](../websocket.md).
|
||||
|
||||
|
||||
@@ -132,6 +132,7 @@ The WebSocket server runs at `/api/sessions/live` on the same host and port as t
|
||||
| `game.added` | Session subscribers | `POST /api/sessions/{id}/games` |
|
||||
| `session.ended` | Session subscribers | `POST /api/sessions/{id}/close` |
|
||||
| `player-count.updated` | Session subscribers | `PATCH /api/sessions/{sessionId}/games/{sessionGameId}/player-count` |
|
||||
| `vote.received` | Session subscribers | `POST /api/votes/live` (live votes only, not chat-import) |
|
||||
|
||||
`session.started` goes to every authenticated client. The others go only to clients that have subscribed to the relevant session via `{ "type": "subscribe", "sessionId": 3 }`.
|
||||
|
||||
@@ -157,7 +158,7 @@ All events use this envelope:
|
||||
|---------|----------|-----------|
|
||||
| **Connection** | Stateless HTTP | Persistent |
|
||||
| **Auth** | Secret in config | JWT per connection |
|
||||
| **Events** | `game.added` | `session.started`, `game.added`, `session.ended`, `player-count.updated` |
|
||||
| **Events** | `game.added` | `session.started`, `game.added`, `session.ended`, `player-count.updated`, `vote.received` |
|
||||
| **Latency** | Higher (HTTP round trip) | Lower (push) |
|
||||
| **Reliability** | Logged, auditable | Best-effort |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user