Add message api

This commit is contained in:
Aslan 2026-01-11 07:13:52 -05:00
parent f72d0bedb8
commit 2060bcbcbf
3 changed files with 117 additions and 1 deletions

View file

@ -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"
}
]
}
```

92
docs/api/message.md Normal file
View file

@ -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"
}
```