five-on-it / apps/api/src/social-routes
apps/api/src/social-routes
The social routes (GAME_DESIGN §13, TECHNICAL_SPECS §9.6): friends and their presence, parties, the party's channel and direct messages, mutes, the feed, reports of players, and the moderation of a public room's chat that the game servers (and Nakama's module) ask for. The state is the SocialHub's (social.ts).
| Route | Who | What |
|---|---|---|
GET /social/friends | signed in | Friends and requests, each online or not and in which room (its title and game). |
POST /social/friends {name} or {id} | signed in | Ask an account to be friends, or accept its request. |
DELETE /social/friends/:id | signed in | Remove a friend, cancel or decline a request. |
PUT /social/presence {room} | signed in | Where the player's page is: a room's id, or null. Every half a minute or so. |
GET /social/party | signed in | The player's party and the invitations they have. |
POST /social/party, /social/party/invite {account}, /social/party/join {party}, /social/party/decline {party}, /social/party/leave | signed in | Create, invite a friend, join, decline, leave. |
POST /social/messages {to, text} | signed in | A line on the party's channel (to: "party") or to a friend (their id). |
GET /social/events?after=n&wait=s | signed in | The feed after event n, waiting up to s seconds (25 at most) for one. |
GET /social/mutes, PUT and DELETE /social/mutes/:id | signed in | The accounts the player muted; mute one, or not any more. |
POST /players/:id/reports {reason, text?, name?, room?} | signed in | A report of a player, into the moderators' queue. |
POST /moderation/chat {texts, room?} | the room secret | Whether a public room's chat line may be read ({allowed, reasons}), by the chat's moderator (with FOI_MODERATION=openrouter the word list alone: the chat spends nothing): a room the API opened as private needs no check. |