From 2060bcbcbfced507c2c4a74c4ee23456572381549e894c1d41731dc0a74dd31d Mon Sep 17 00:00:00 2001 From: aslan Date: Sun, 11 Jan 2026 07:13:52 -0500 Subject: [PATCH] Add message api --- VERSION | 2 +- docs/api/channel.md | 24 ++++++++++++ docs/api/message.md | 92 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 docs/api/message.md diff --git a/VERSION b/VERSION index 7c7e98c..0e2a180 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.7 +0.4.0 diff --git a/docs/api/channel.md b/docs/api/channel.md index c05ff71..1e1556a 100644 --- a/docs/api/channel.md +++ b/docs/api/channel.md @@ -84,3 +84,27 @@ Removes a channel with id = {id} "communityId": "string" } ``` + +## GET /api/v1/channel/{id}/messages + +_Requires an authorization header_ + +Returns messages for a channel with id = {id} + +### Response: + +```json +{ + "id": "string", + "name": "string", + "messages": [ + { + "id": "string", + "userId": "string", + "text": "string", + "edited": "boolean", + "creationDate": "number" + } + ] +} +``` diff --git a/docs/api/message.md b/docs/api/message.md new file mode 100644 index 0000000..525b7c3 --- /dev/null +++ b/docs/api/message.md @@ -0,0 +1,92 @@ +## GET /api/v1/message/{id} + +_Requires an authorization header_ + +Returns a message with id = {id} + +### Response: + +```json +{ + "id": "string", + "text": "string", + "editHistory": "string[]", + "edited": "boolean", + "userId": "string", + "channelId": "string", + "creationDate": "number" +} +``` + +## POST /api/v1/message + +_Requires an authorization header_ + +### Request: + +```json +{ + "text": "string", + "channelId": "string" +} +``` + +Creates a new message and returns it + +### Response: + +```json +{ + "id": "string", + "text": "string", + "editHistory": "string[]", + "edited": "boolean", + "userId": "string", + "channelId": "string", + "creationDate": "number" +} +``` + +## PATCH /api/v1/message/{id} + +_Requires an authorization header_ + +### Request: + +```json +{ + "newText": "string" +} +``` + +Updates a message with id = {id} + +### Response: + +```json +{ + "id": "string", + "text": "string", + "editHistory": "string[]", + "edited": "boolean", + "userId": "string", + "channelId": "string", + "creationDate": "number" +} +``` + +## DELETE /api/v1/message/{id} + +_Requires an authorization header_ + +Removes a message with id = {id} + +### Response: + +```json +{ + "id": "string", + "userId": "string", + "channelId": "string" +} +```