diff --git a/API-Reference.md b/API-Reference.md index f017c76..b8dd271 100644 --- a/API-Reference.md +++ b/API-Reference.md @@ -12,6 +12,7 @@ All endpoints except auth require a valid session cookie (`dumpster_session`). { "email": "user@example.com", "username": "username", + "display_name": "Nickname", "password": "hunter2" } ``` @@ -33,12 +34,27 @@ Returns: `{ "id": "uuid" }` Clears session cookie. Returns 204. +### GET /auth/me + +Returns full user profile including `bio`, `accent_color`, `status_text`, `avatar`. + +### PATCH /auth/me + +Update profile fields. All optional: + +```json +{ + "display_name": "New Name", + "bio": "Hello world", + "accent_color": "#fe8019", + "status_text": "brb" +} +``` + ## Servers ### POST /servers -Create a server. - ```json { "name": "My Server", @@ -94,15 +110,16 @@ Delete a channel. ## Messages -### GET /messages/:channelID/messages?limit=50&before=messageID +### GET /channels/:channelID/messages?limit=50&before=messageID Get messages in a channel. Cursor-based pagination. -### POST /messages/:channelID/messages +### POST /channels/:channelID/messages ```json { - "content": "hello" + "content": "hello", + "reply_to": "optional-message-uuid" } ``` @@ -118,6 +135,190 @@ Get messages in a channel. Cursor-based pagination. Delete a message. Author only. +## Reactions + +### POST /messages/:messageID/reactions + +```json +{ + "emoji": "👍" +} +``` + +### DELETE /messages/:messageID/reactions/:emoji + +Remove a reaction. + +### GET /messages/:messageID/reactions + +List reactions grouped by emoji with user IDs and counts. + +## Voice + +### POST /voice/token + +```json +{ + "room_name": "voice-channel-id" +} +``` + +Returns: `{ "token": "jwt...", "livekit_url": "wss://..." }` + +### GET /voice/rooms/:roomID/participants + +List participants in a voice room. + +## Invites + +### POST /invites + +```json +{ + "server_id": "uuid", + "expires_hours": 24, + "max_uses": 10 +} +``` + +Returns: `{ "code": "ABCD1234", "url": "https://..." }` + +### GET /invites/:code + +Get invite info (server name, inviter, expiry). + +### POST /invites/:code/join + +Join server via invite code. + +## Bots + +### POST /bots + +```json +{ + "name": "Modbot", + "description": "Moderation bot" +} +``` + +Returns bot with `token` (shown only once). + +### GET /bots + +List bots owned by current user. + +### GET /bots/:id + +Get bot details. + +### PATCH /bots/:id + +```json +{ + "name": "New Name", + "description": "New description" +} +``` + +### DELETE /bots/:id + +Delete a bot. + +### POST /bots/:id/servers + +```json +{ + "server_id": "uuid" +} +``` + +Add bot to server. + +### DELETE /bots/:id/servers/:serverID + +Remove bot from server. + +### POST /bots/:id/regenerate-token + +Returns: `{ "token": "new_token..." }` + +## Slash Commands + +### POST /bots/:id/commands + +```json +{ + "server_id": "uuid", + "name": "kick", + "description": "Kick a user" +} +``` + +### GET /bots/:id/commands + +List commands for a bot. + +### DELETE /bots/:id/commands/:cmdID + +Delete a command. + +### GET /servers/:serverID/commands + +List all commands for a server (for autocomplete). + +## Webhooks + +### POST /channels/:channelID/webhooks + +```json +{ + "name": "GitHub" +} +``` + +Returns: `{ "id": "...", "token": "...", "url": "https://host/webhooks/{id}/{token}" }` + +### GET /channels/:channelID/webhooks + +List webhooks for a channel. + +### DELETE /webhooks/:webhookID + +Delete a webhook. + +### POST /webhooks/:webhookID/:token + +Execute webhook (public, no auth required): + +```json +{ + "content": "New commit pushed", + "username": "GitHub", + "avatar_url": "https://..." +} +``` + +## File Upload + +### POST /upload + +Multipart form upload. Returns: `{ "url": "/files/uuid.ext", "size": 12345 }` + +### GET /files/:filename + +Serve uploaded file. + +## Giphy + +### GET /gifs/search?q=query + +Search GIFs (requires `GIPHY_API_KEY`). + +### GET /gifs/trending + +Get trending GIFs. + ## WebSocket Connect to `/ws` with the session cookie. Incoming events: @@ -132,3 +333,11 @@ Connect to `/ws` with the session cookie. Incoming events: - `SERVER_MEMBER_REMOVE` - `PRESENCE_UPDATE` - `TYPING_START` +- `REACTION_ADD` +- `REACTION_REMOVE` +- `VOICE_JOIN` +- `VOICE_LEAVE` +- `VOICE_MUTE` +- `VOICE_DEAFEN` +- `BOT_JOIN` +- `BOT_LEAVE`