Refactor private chat extension to become base for all types of chats

This commit is contained in:
ChronosX88 2020-09-05 23:43:04 +04:00
parent 9dfea26a7e
commit a6617a5c0b
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A

View File

@ -1,14 +1,14 @@
# Private chats # Basic chats
## 1. Introduction ## 1. Introduction
This extension is intended for organizing private chat between two users. This extension is intended for organizing chats between some entities.
## 2. Message type identifiers ## 2. Message type identifiers
- `urn:cadmium:chats:private:message` - regular message - `urn:cadmium:chats:message` - regular message
- `urn:cadmium:chats:private:read` - read message system - `urn:cadmium:chats:read` - read message system
- `urn:cadmium:chats:private:typing` - typing message system - `urn:cadmium:chats:typing` - typing message system
## 3. Errors ## 3. Errors
@ -30,7 +30,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "abcd", "id": "abcd",
"type": "urn:cadmium:chats:private:message", "type": "urn:cadmium:chats:message",
"to": ["@user2@cadmium.org"], "to": ["@user2@cadmium.org"],
"payload": { "payload": {
"type": "urn:cadmium:chats:message-types:general", "type": "urn:cadmium:chats:message-types:general",
@ -46,7 +46,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "abcd", "id": "abcd",
"type": "urn:cadmium:chats:private:message", "type": "urn:cadmium:chats:message",
"from": "cadmium.org", "from": "cadmium.org",
"ok": true, "ok": true,
"payload": { "payload": {
@ -61,7 +61,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "abcd", "id": "abcd",
"type": "urn:cadmium:chats:private:message", "type": "urn:cadmium:chats:message",
"from": "cadmium.org", "from": "cadmium.org",
"ok": false, "ok": false,
"payload": { "payload": {
@ -76,7 +76,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "abcd", "id": "abcd",
"type": "urn:cadmium:chats:private:message", "type": "urn:cadmium:chats:message",
"from": "@user1@cadmium.im", "from": "@user1@cadmium.im",
"ok": true, "ok": true,
"payload": { "payload": {
@ -98,7 +98,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "abcd", "id": "abcd",
"type": "urn:cadmium:chats:private:message", "type": "urn:cadmium:chats:message",
"to": ["@user2@cadmium.org"], "to": ["@user2@cadmium.org"],
"payload": { "payload": {
"type": "urn:cadmium:chats:message-types:general", "type": "urn:cadmium:chats:message-types:general",
@ -121,7 +121,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "abcd", "id": "abcd",
"type": "urn:cadmium:chats:private:message", "type": "urn:cadmium:chats:message",
"from": "cadmium.org", "from": "cadmium.org",
"ok": true, "ok": true,
"payload": { "payload": {
@ -136,7 +136,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "defg", "id": "defg",
"type": "urn:cadmium:chats:private:message", "type": "urn:cadmium:chats:message",
"from": "@user1@cadmium.im", "from": "@user1@cadmium.im",
"ok": true, "ok": true,
"payload": { "payload": {
@ -163,7 +163,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "abcd", "id": "abcd",
"type": "urn:cadmium:chats:private:read", "type": "urn:cadmium:chats:read",
"to": ["@user1@cadmium.org"], "to": ["@user1@cadmium.org"],
"payload": { "payload": {
"messageID": "7a1b9a72-1677-4476-9b22-ef7fdbcff52e", "messageID": "7a1b9a72-1677-4476-9b22-ef7fdbcff52e",
@ -176,7 +176,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "abcd", "id": "abcd",
"type": "urn:cadmium:chats:private:read", "type": "urn:cadmium:chats:read",
"from": "cadmium.im", "from": "cadmium.im",
"ok": true, "ok": true,
"payload": {} "payload": {}
@ -188,7 +188,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "defg", "id": "defg",
"type": "urn:cadmium:chats:private:read", "type": "urn:cadmium:chats:read",
"from": "@user2@cadmium.im", "from": "@user2@cadmium.im",
"ok": true, "ok": true,
"payload": { "payload": {
@ -204,7 +204,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "abcd", "id": "abcd",
"type": "urn:cadmium:chats:private:typing", "type": "urn:cadmium:chats:typing",
"to": ["@user1@cadmium.org"], "to": ["@user1@cadmium.org"],
"payload": {} "payload": {}
} }
@ -215,7 +215,7 @@ This extension is intended for organizing private chat between two users.
```json ```json
{ {
"id": "defg", "id": "defg",
"type": "urn:cadmium:chats:private:read", "type": "urn:cadmium:chats:read",
"from": "@user2@cadmium.im", "from": "@user2@cadmium.im",
"ok": true, "ok": true,
"payload": {} "payload": {}
@ -230,7 +230,7 @@ This extension is intended for organizing private chat between two users.
## 7. JSON Schema ## 7. JSON Schema
### Send message (`urn:cadmium:chats:private:message`) ### Send message (`urn:cadmium:chats:message`)
**Request**: **Request**:
@ -284,7 +284,7 @@ interface SendMessageResponsePayload {
} }
``` ```
### Receive message (`urn:cadmium:chats:private:message`) ### Receive message (`urn:cadmium:chats:message`)
```typescript ```typescript
interface ReceiveMessagePayload { interface ReceiveMessagePayload {
@ -296,7 +296,7 @@ interface ReceiveMessagePayload {
} }
``` ```
### Read message (`urn:cadmium:chats:private:read`) ### Read message (`urn:cadmium:chats:read`)
**Request**: **Request**:
@ -310,7 +310,7 @@ interface ReadMessagePayload {
None. None.
### Receive read message notification (`urn:cadmium:chats:private:read`) ### Receive read message notification (`urn:cadmium:chats:read`)
```typescript ```typescript
interface ReceiveReadMessageNotifPayload { interface ReceiveReadMessageNotifPayload {