diff --git a/docs/content/endpoints/badges.md b/docs/content/endpoints/badges.md new file mode 100644 index 0000000..21c4c9b --- /dev/null +++ b/docs/content/endpoints/badges.md @@ -0,0 +1,135 @@ +--- +title: Badges +anchor: badges-ep +weight: 19 +--- + +### `/badge/new` + +It should be noted that while alpha values are technically valid it is up to +individual clients to decide what to do with that value. Personally I suggest not +doing anything with the alpha value so that it doesn't matter but that is up to +the client developer. + +* Required query string parameters: + + * badge\_name: String + * Name to assign to the new badge + * badge\_perms: u64 + * Permissions mask which apply to the badge + +* Semi optional query string parameter: + + * badge\_color: u32 + * If not included the color will default to `0xffffffff` + +* Required permissions + + * NEW\_BADGE + +* Returns + * A new [badge](#badges) behind the JSON key `badge`. + + +### `/badge/delete` + +* Required query string parameters: + + * id: u64 + * ID of the target badge to delete + +* Required permissions + + * DELETE\_BADGE + +* Returns + + * HTTP 200 on success + +Example: + +``` + > POST /badge/new + + < { + < "badge": { + < "id": 1, + < "name": "badge-name-here", + < "color": 1234, + < "perms": 1234, + < } + < } +``` + +### `/badge/list` + +* No query string required. + +* No required permissions, only that the client have a valid JWT. + +* Returns + * Array of [Badges](#badges) behind the JSON key `badges`. + +Example: + +``` + > GET /badge/list + + < { + < "badges": [ + < { + < "id": 1, + < "name": "badge-name-here", + < "color": 1234, + < "perms": 1234, + < }, + < ... + < ] + < } +``` + +### `/badge/update/color` + +* Required query string parameters: + + * badge\_id: u64 + * ID of the target badge to update. + + * badge\_color: u32 + * The new color to update to + +* Required permissions: + + * UPDATE\_COLOR\_BADGE + +* Returns: + + * HTTP 200 + +### `/badge/update/name` + +* Required query string parameters: + + * badge\_id: u64 + * ID of the target badge toupdate. + + * badge\_name: String + * The new badge name to assign. + +* Required permissions: + + * UPDATE\_NAME\_BADGE + +### `/badge/update/perms` + +* Required query string parameters: + + * badge\_id: u64 + * ID of the target badge toupdate. + + * badge\_perms: u64 + * Represented as a regular integer this is the bitmap of permissions which apply to the badge + +* Required permissions: + + * UPDATE\_PERMS\_BADGE diff --git a/docs/content/structures/badges.md b/docs/content/structures/badges.md new file mode 100644 index 0000000..8c3c5bb --- /dev/null +++ b/docs/content/structures/badges.md @@ -0,0 +1,14 @@ +--- +title: Badges +anchor: badges +weight: 55 +--- + + + Name | Type +:--------:|:-------: + `name` | `String` + `id` | `u64` + `color` | `u32` + `perms` | `u64` + diff --git a/docs/content/structures/channels.md b/docs/content/structures/channels.md index 3dbeffc..6fbc096 100644 --- a/docs/content/structures/channels.md +++ b/docs/content/structures/channels.md @@ -13,6 +13,7 @@ Channels are made up of the following components name | `String` kind | `i32` description| `String` +badge\_ids| `Array` Channels have two valid types or (more semantically) `kind` values: diff --git a/docs/content/structures/users.md b/docs/content/structures/users.md index f14f6f0..e3a53cf 100644 --- a/docs/content/structures/users.md +++ b/docs/content/structures/users.md @@ -14,10 +14,11 @@ Name | Type secret | `String` status | `i32` permissions| `u64` +badge\_ids | `Array` ### JWT -This data is retrieved after a sucessful `/login` hit. +This data is retrieved after a successful `/login` hit. Name | Type :-----:|:------: @@ -31,6 +32,7 @@ This data is retrieved after a sucessful `/login` hit. name | `String` status | `i32` permissions| `u64` +badge\_ids | `Array` For users _without_ the `USER_FETCH` permission the only two fields with actual data is `id` and `name`. The other fields will be set to 0.