summaryrefslogtreecommitdiff
path: root/docs/api/events.md
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-18 23:42:08 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-18 23:42:08 -0400
commit82338ddcb7f14ffbd584a954689f02b6e6a7988e (patch)
tree1e0a525766ca45067bb122cad3af69437db504ca /docs/api/events.md
parentbde5aea211e9838b4511a2b57c6a256fe89b66ab (diff)
parent17b62b3458e3a992b93cd485b05d3fb112dd349a (diff)
Merge branch 'wip/retain-deleted'
Diffstat (limited to 'docs/api/events.md')
-rw-r--r--docs/api/events.md34
1 files changed, 22 insertions, 12 deletions
diff --git a/docs/api/events.md b/docs/api/events.md
index 9fe9ca9..2f48df1 100644
--- a/docs/api/events.md
+++ b/docs/api/events.md
@@ -133,11 +133,16 @@ Sent whenever a new channel is created.
These events have the `event` field set to `"created"`. They include the following additional fields:
-| Field | Type | Description |
-|:-------|:----------|:--|
-| `at` | timestamp | The moment the channel was created. |
-| `id` | string | A unique identifier for the newly-created channel. This can be used to associate the channel with other events, or to make API calls targeting the channel. |
-| `name` | string | The channel's name. |
+| Field | Type | Description |
+|:-------------|:--------------------|:--|
+| `at` | timestamp | The moment the channel was created. |
+| `id` | string | A unique identifier for the newly-created channel. This can be used to associate the channel with other events, or to make API calls targeting the channel. |
+| `name` | string | The channel's name. |
+| `deleted_at` | timestamp, optional | If set, the moment the channel was deleted. |
+
+When a channel is deleted or expires, the `"created"` event is replaced with a tombstone `"created"` event, so that the original channel cannot be trivially recovered from the event stream. Tombstone events have a `deleted_at` field, and a `name` of `""`. Tombstone events for channels use an empty string as the name, and not `null` or with the `name` field removed entirely, to simplify client development. While clients _should_ treat deleted channels specially, for example by rendering them as "channel deleted" markers, they don't have to be - they make sense if interpreted as channels with empty names, too.
+
+Once a deleted channel is [purged](./channels-messages.md#expiry-and-purging), these tombstone events are removed from the event stream.
### Channel deleted
@@ -184,13 +189,18 @@ Sent whenever a message is sent by a client.
These events have the `event` field set to `"sent"`. They include the following additional 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 other events, or to make API calls targeting the message. |
-| `body` | string | The text of the message. |
+| 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 other events, or to make API calls targeting the message. |
+| `body` | string | The text of the message. |
+| `deleted_at` | timestamp, optional | If set, the moment the message was deleted. |
+
+When a message is deleted or expires, the `"sent"` event is replaced with a tombstone `"sent"` event, so that the original message cannot be trivially recovered from the event stream. Tombstone events have a `deleted_at` field, and a `body` of `""`. Tombstone events for messages use an empty string as the `body`, and not `null` or with the `body` field removed entirely, to simplify client development. While clients _should_ treat deleted messages specially, for example by rendering them as "message deleted" markers, they don't have to be - they make sense if interpreted as messages with empty bodies, too.
+
+Once a deleted message is [purged](./channels-messages.md#expiry-and-purging), these tombstone events are removed from the event stream.
### Message deleted