From aed173778299bc8f691463939837ebd51baaea9d Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 14 Jun 2021 21:38:56 -0700 Subject: [PATCH] + Docs for badge rtc events Describes what kind of data to expect from RTC events + Meta docs around conventions in badge docs section --- docs/content/rtc/events.md | 47 ++++++++++++++++++++++++++++++++++- docs/content/rtc/structure.md | 37 +++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 docs/content/rtc/structure.md diff --git a/docs/content/rtc/events.md b/docs/content/rtc/events.md index b27dc73..18c29d2 100644 --- a/docs/content/rtc/events.md +++ b/docs/content/rtc/events.md @@ -1,7 +1,7 @@ --- title: Events anchor: events -weight: 42 +weight: 43 --- ## Pertinent Event Data Structures @@ -81,3 +81,48 @@ Id of affected user * name: String 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 diff --git a/docs/content/rtc/structure.md b/docs/content/rtc/structure.md new file mode 100644 index 0000000..10af2d9 --- /dev/null +++ b/docs/content/rtc/structure.md @@ -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. + +* \: \ + +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 + } +} +``` + +