summaryrefslogtreecommitdiff
path: root/docs/api/events.md
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-19 00:57:20 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-19 00:57:20 -0400
commitad00b553d845dba8af7b0e9fa2930209aee1dd62 (patch)
tree0a91c3c0113b2618730d3160f311c083e95b0581 /docs/api/events.md
parent635d92eb4ffc5a1c94cba784a2a4f18e1cb5effc (diff)
Make the responses for various data creation requests more consistent.
In general: * If the client can only assume the response is immediately valid (mostly, login creation, where the client cannot monitor the event stream), then 200 Okay, with data describing the server's view of the request. * If the client can monitor for completion by watching the event stream, then 202 Accepted, with data describing the server's view of the request. This comes on the heels of a comment I made on Discord: > hrm > > creating a login: 204 No Content, no body > sending a message: 202 Accepted, no body > creating a channel: 200 Okay, has a body > > past me, what were you on There wasn't any principled reason for this inconsistency; it happened as the endpoints were written at different times and with different states of mind.
Diffstat (limited to 'docs/api/events.md')
-rw-r--r--docs/api/events.md5
1 files changed, 5 insertions, 0 deletions
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.