diff options
Diffstat (limited to 'docs/api.md')
| -rw-r--r-- | docs/api.md | 70 |
1 files changed, 19 insertions, 51 deletions
diff --git a/docs/api.md b/docs/api.md index e8c8c8c..91485f3 100644 --- a/docs/api.md +++ b/docs/api.md @@ -25,6 +25,25 @@ Returns information needed to boot the client. Also the recommended way to check "id": "L1234abcd", }, "resume_point": "1312", + "channels": [ + { + "name": "nonsense and such", + "id": "C1234abcd", + "messages": [ + { + "at": "2024-09-27T23:19:10.208147Z", + "sender": { + "id": "L1234abcd", + "name": "example username" + }, + "message": { + "id": "M1312acab", + "body": "beep" + } + } + ] + } + ] } ``` @@ -77,27 +96,6 @@ This endpoint returns a 204 No Content response on success, with a `Set-Cookie` Channels are the containers for conversations. The API supports listing channels, creating new channels, and send messages to an existing channel. -### `GET /api/channels` - -Lists channels. - -#### Query parameters - -This endpoint accepts an optional `resume_point` query parameter. If provided, the value must be the value obtained from the `/api/boot` method. This parameter will restrict the returned list to channels as they existed at a fixed point in time, with any later changes only appearing in the event stream. - -#### On success - -Responds with a list of channel objects, one per channel: - -```json -[ - { - "name": "nonsense and such", - "id": "C1234abcd", - } -] -``` - ### `POST /api/channels` Creates a channel. @@ -127,36 +125,6 @@ Channel names must be unique. If a channel with the same name already exists, th The API delivers events to clients to update them on other clients' actions and messages. While there is no specific delivery deadline, messages are delivered as soon as possible on a best-effort basis, and the event system allows clients to replay events or resume interrupted streams, to allow recovery if a message is lost. -### `GET /api/channels/:channel/messages` - -Retrieves historical messages in a channel. - -The `:channel` placeholder must be a channel ID, as returned by `GET /api/channels` or `POST /api/channels`. - -#### Query parameters - -This endpoint accepts an optional `resume_point` query parameter. If provided, the value must be the value obtained from the `/api/boot` method. This parameter will restrict the returned list to messages as they existed at a fixed point in time, with any later changes only appearing in the event stream. - -#### On success - -Responds with a list of message objects, one per message: - -```json -[ - { - "at": "2024-09-27T23:19:10.208147Z", - "sender": { - "id": "L1234abcd", - "name": "example username" - }, - "message": { - "id": "M1312acab", - "body": "beep" - } - } -] -``` - ### `POST /api/channels/:channel` Sends a chat message to a channel. It will be relayed to clients subscribed to the channel's events, and recorded for replay. |
