+ Docs for badge rtc events

Describes what kind of data to expect from RTC events

+ Meta docs around conventions in badge docs section
This commit is contained in:
shockrah 2021-06-14 21:38:56 -07:00
parent 55c2e6d960
commit aed1737782
2 changed files with 83 additions and 1 deletions

View File

@ -1,7 +1,7 @@
--- ---
title: Events title: Events
anchor: events anchor: events
weight: 42 weight: 43
--- ---
## Pertinent Event Data Structures ## Pertinent Event Data Structures
@ -81,3 +81,48 @@ Id of affected user
* name: String * name: String
New nickname of user New nickname of user
### `new-badge`
* id: u64
* name: String
* color: u32
* perms: u64
_Notes regarding data structure:_
* None of these fields are optional so if they are not all present the incoming data should be ignored.
### `update-badge-name`
* id: u64
* name: String
New name for of the badge referenced by `id`.
### `update-badge-perms`
* id: u64
* perms: u64
New permissions mask of the badge referenced by `id`.
### `update-badge-color`
* id: u64
* color: u32
New color for the badge referenced by `id`.
### `delete-badge`
* id: u64
Badge which has been deleted

View File

@ -0,0 +1,37 @@
---
title: Event Structure
anchor: event-structure
weight: 42
---
There are a few rules regarding RTC event data structures:
1. They are always JSON encoded
2. Top level keys are for either meta data or a root node which leads to actual event data
Top level fields are as follows:
* type: string
Denotes the event type as a string. This value is used as a key to identify the
actual event data itself.
* \<type\>: \<data\>
The key here is found by checking the value associated with "type".
Behind this event data can be found; for example a `new-message` event payload
would look like:
```
{
"type": "new-message",
"new-message": {
"id": 123,
"time: 1623730090
}
}
```