HTTP API: a chat's recent messages, and sending a message (closes #5)
check / check (push) Successful in 1m5s

`GET /api/v1/chats/{id}/messages?count=N` returns a chat's recent messages, oldest first (`count` 1 to 100, default 20), and `POST` to the same path sends a text message and returns it once the chat client has taken it. Both answer `404` for any id the chats list does not show, looked up in the same contact list. The message record is defined once, for the webhooks to reuse.

Disclosures: items are read five at a time, because one item can be many times its text and 100 at once could pass the 16 MiB read limit; text too long gets `413`, a contact who deleted the chat `409` (unverified for one still connecting); a query the server cannot read gets its own `400`.

Model: opus-5-5
This commit was merged in pull request #15.
This commit is contained in:
2026-09-29 07:33:36 +02:00
parent 8f0906d677
commit f53b666119
12 changed files with 1143 additions and 53 deletions
+2
View File
@@ -27,6 +27,8 @@ with no deprecation warning.
# Completed Steps
- 2026-09-29 `GET` and `POST /api/v1/chats/{id}/messages`: a chat's
latest messages, and sending one
- 2026-09-29 Added the HTTP API in `internal/api`: the server on `PORT`,
the bearer credential from `API_TOKEN_FILE`, security headers and
limits, and `GET /api/v1/chats`