summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/api/authentication.md16
-rw-r--r--docs/api/channels-messages.md38
-rw-r--r--docs/api/events.md5
-rw-r--r--docs/api/initial-setup.md16
-rw-r--r--docs/api/invitations.md16
5 files changed, 83 insertions, 8 deletions
diff --git a/docs/api/authentication.md b/docs/api/authentication.md
index d4c1f70..7e05443 100644
--- a/docs/api/authentication.md
+++ b/docs/api/authentication.md
@@ -56,7 +56,21 @@ The request must have the following fields:
<!-- This prose is duplicated by 03-initial-setup.md and in 04-invitations.md, with small changes for context. If you edit it here, edit it there, too. -->
-This endpoint will respond with a status of `204 No Content` when successful.
+This endpoint will respond with a status of `200 Okay` when successful. The body of the response will be a JSON object describing the authenticated login:
+
+```json
+{
+ "id": "Labcd1234",
+ "name": "Andrea"
+}
+```
+
+The response will include the following fields:
+
+| Field | Type | Description |
+|:------------|:-------|:--|
+| `id` | string | The authenticated login's ID. |
+| `name` | string | The authenticated login's name. |
The response will include a `Set-Cookie` header for the `identity` cookie, providing the client with a newly-minted identity token associated with the login identified in the request. This token's value must be kept confidential.
diff --git a/docs/api/channels-messages.md b/docs/api/channels-messages.md
index 99a525e..69cadcb 100644
--- a/docs/api/channels-messages.md
+++ b/docs/api/channels-messages.md
@@ -54,12 +54,12 @@ The request must have the following fields:
### Success
-This endpoint will respond with a status of `200 Okay` when successful. The body of the response will be a JSON object describing the new channel:
+This endpoint will respond with a status of `202 Accepted` when successful. The body of the response will be a JSON object describing the new channel:
```json
{
- "name": "a unique channel name",
"id": "C9876cyyz"
+ "name": "a unique channel name",
}
```
@@ -67,8 +67,10 @@ The response will have the following fields:
| Field | Type | Description |
|:-------|:-------|:--|
+| `id` | string | A unique identifier for the channel. This can be used to associate the channel with events, or to make API calls targeting the channel. |
| `name` | string | The channel's name. |
-| `id` | string | A unique identifier for the channel. This can be used to associate the channel with other events, or to make API calls targeting the channel. |
+
+When completed, the service will emit a [channel created](events.md#channel-created) event with the channel's ID.
### Duplicate channel name
@@ -101,14 +103,35 @@ The request must have the following fields:
### Success
-This endpoint will respond with a status of `202 Accepted` when successful. The response will not include a body.
+This endpoint will respond with a status of `202 Accepted` when successful. The body of the response will be a JSON object describing the newly-sent message:
+
+```json
+{
+ "at": "2024-10-19T04:37:09.467325Z",
+ "channel": "Cfqdn1234",
+ "sender": "Labcd1234",
+ "id": "Mgh98yp75",
+ "body": "an elaborate example message"
+}
+```
+
+The response will have the following fields:
+
+| Field | Type | Description |
+|:----------|:----------|:--|
+| `at` | timestamp | The moment the message was sent. |
+| `channel` | string | The ID of the channel the message was sent to. |
+| `sender` | string | The ID of the login that sent the message. |
+| `id` | string | A unique identifier for the message. This can be used to associate the message with events, or to make API calls targeting the message. |
+| `body` | string | The message's body. |
+
+When completed, the service will emit a [message sent](events.md#message-sent) event with the message's ID.
### Invalid channel ID
This endpoint will respond with a status of `404 Not Found` if the channel ID is not valid.
-
## `DELETE /api/channels/:id`
Deletes a channel (and all messages in it).
@@ -123,6 +146,9 @@ This endpoint requires the following path parameter:
This endpoint will respond with a status of `202 Accepted` when successful. The response will not include a body.
+When completed, the service will emit a [channel deleted](events.md#channel-deleted) event with the channel's ID.
+
+
### Invalid channel ID
This endpoint will respond with a status of `404 Not Found` if the channel ID is not valid.
@@ -142,6 +168,8 @@ This endpoint requires the following path parameter:
This endpoint will respond with a status of `202 Accepted` when successful. The response will not include a body.
+When completed, the service will emit a [message deleted](events.md#message-deleted) event with the channel's ID.
+
### Invalid message ID
This endpoint will respond with a status of `404 Not Found` if the message ID is not valid.
diff --git a/docs/api/events.md b/docs/api/events.md
index 2f48df1..b08e971 100644
--- a/docs/api/events.md
+++ b/docs/api/events.md
@@ -31,6 +31,11 @@ sequenceDiagram
The core of the service is to facilitate conversations between logins. Conversational activity is delivered to clients using _events_. Each event notifies interested clients of activity sent to the service through its API.
+## Asynchronous completion
+
+A number of endpoints return `202 Accepted` responses. The actions performed by those endpoints will be completed before events are delivered. To await the completion of an operation which returns this response, clients must monitor the event stream for the corresponding event.
+
+
## `GET /api/events`
Subscribes to events.
diff --git a/docs/api/initial-setup.md b/docs/api/initial-setup.md
index ad57089..3c5a8a6 100644
--- a/docs/api/initial-setup.md
+++ b/docs/api/initial-setup.md
@@ -55,7 +55,21 @@ The request must have the following fields:
<!-- This prose is duplicated from authentication.md, with small changes for context. If you edit it here, edit it there, too. -->
-This endpoint will respond with a status of `204 No Content` when successful.
+This endpoint will respond with a status of `200 Okay` when successful. The body of the response will be a JSON object describing the newly-created login:
+
+```json
+{
+ "id": "Labcd1234",
+ "name": "Andrea"
+}
+```
+
+The response will include the following fields:
+
+| Field | Type | Description |
+|:------------|:-------|:--|
+| `id` | string | A unique identifier for the newly-created login. This can be used to associate the login with other events, or to make API calls targeting the login. |
+| `name` | string | The login's name. |
The response will include a `Set-Cookie` header for the `identity` cookie, providing the client with a newly-minted identity token associated with the initial login created for this request. See the [authentication](./authentication) section for details on how this cookie may be used.
diff --git a/docs/api/invitations.md b/docs/api/invitations.md
index f75e30b..d3431d7 100644
--- a/docs/api/invitations.md
+++ b/docs/api/invitations.md
@@ -134,7 +134,21 @@ The request must have the following fields:
<!-- This prose is duplicated from authentication.md, with small changes for context. If you edit it here, edit it there, too. -->
-This endpoint will respond with a status of `204 No Content` when successful.
+This endpoint will respond with a status of `200 Okay` when successful. The body of the response will be a JSON object describing the newly-created login:
+
+```json
+{
+ "id": "Labcd1234",
+ "name": "Andrea"
+}
+```
+
+The response will include the following fields:
+
+| Field | Type | Description |
+|:------------|:-------|:--|
+| `id` | string | A unique identifier for the newly-created login. This can be used to associate the login with other events, or to make API calls targeting the login. |
+| `name` | string | The login's name. |
The response will include a `Set-Cookie` header for the `identity` cookie, providing the client with a newly-minted identity token associated with the login created for this request. See the [authentication](./authentication.md) section for details on how this cookie may be used.