freechat/docs/content/endpoints/badges.md
shockrah a69ad24a45 + Badge structure docs
Also this is a new pattern but I'm going to start actually using those anchor tags
to self link to other places in the page.

+ /badge/new endpoint docs
+ /badge/delete endpoint docs
+ /badge/update/name endpoint docs
+ /badge/update/color endpoint docs
+ /badge/update/perms endpoint docs

! Small point but apparantly this layout is somewhat printer friendly
:^) Just thought that was kinda neat.
2021-07-01 21:09:26 -07:00

2.1 KiB

title anchor weight
Badges badges-ep 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 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 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