Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

docs: document the built-in badge image routes (#3726)

Hampusbe3345412916
diff --git a/fluxer_docs/src/content/docs/admin-api/badges.mdx b/fluxer_docs/src/content/docs/admin-api/badges.mdx
index 58bdc56e0..8b46934ff 100644
--- a/fluxer_docs/src/content/docs/admin-api/badges.mdx
+++ b/fluxer_docs/src/content/docs/admin-api/badges.mdx
@@ -46,7 +46,7 @@ You can make up to 100 badges of each type, and an account or guild can have up
| --- | --- | --- |
| kind | string | The built-in badge<sup>1</sup> |
| asset_url | ?string | The replacement image as WebP from the media proxy, or null when the built-in image is used |
-| built_in_asset | ?string | The hash of the built-in image at `{static_cdn}/badges/{hash}.webp`, or null for a guild badge, which clients draw themselves |
+| built_in_asset | ?string | The hash of the built-in image at `{static_cdn}/badges/{hash}.webp`, or null for a guild badge |
<sup>1</sup> One of the profile badges `staff` and `premium`, or one of the guild badges `guild_verified`, `guild_partnered` and `guild_discoverable`
@@ -185,11 +185,18 @@ Uploads an image and shows it everywhere the built-in badge appears, then return
<sup>1</sup> The same formats and limits as [Create badge](#create-badge)
+### Response body
+
+| Field | Type | Description |
+| --- | --- | --- |
+| badges | array[[Admin custom badge](#admin-custom-badge-object) object] | The badges of both types |
+| built_in | array[[Built-in badge image](#built-in-badge-image-object) object] | Every built-in badge and the image the instance shows for it |
+
### Response
| Status | Body | Condition |
| --- | --- | --- |
-| 200 | [List badges](#list-badges) response body | The image was replaced |
+| 200 | response body | The image was replaced |
| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` for an unknown `kind` |
| 400 | [error response](/admin-api/#error-response) | `IMAGE_SIZE_EXCEEDS_LIMIT`, `INVALID_IMAGE_FORMAT` or `FAILED_TO_UPLOAD_IMAGE` for a bad image |
@@ -201,11 +208,18 @@ The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
Goes back to the built-in image for a badge, deletes the uploaded one and returns the same body as [List badges](#list-badges). You need `badge:update`.
+### Response body
+
+| Field | Type | Description |
+| --- | --- | --- |
+| badges | array[[Admin custom badge](#admin-custom-badge-object) object] | The badges of both types |
+| built_in | array[[Built-in badge image](#built-in-badge-image-object) object] | Every built-in badge and the image the instance shows for it |
+
### Response
| Status | Body | Condition |
| --- | --- | --- |
-| 200 | [List badges](#list-badges) response body | The built-in image is used again |
+| 200 | response body | The built-in image is used again |
| 400 | [error response](/admin-api/#error-response) | `INVALID_FORM_BODY` for an unknown `kind` |
The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
diff --git a/fluxer_docs/src/content/docs/admin-api/index.mdx b/fluxer_docs/src/content/docs/admin-api/index.mdx
index c1bf115ef..fc54886a4 100644
--- a/fluxer_docs/src/content/docs/admin-api/index.mdx
+++ b/fluxer_docs/src/content/docs/admin-api/index.mdx
@@ -450,7 +450,9 @@ These entries have `access` set to `write`.
| remove_relationships_by_category | Every relationship in one category was removed from an account |
| rename_registration_url | A registration URL was given a new label |
| reorder_badges | The display order of the custom badges was changed |
+| replace_built_in_badge_image | The image of a built-in badge was replaced |
| resend_verification_email | An email verification message was requested again for an account |
+| reset_built_in_badge_image | A built-in badge went back to its built-in image |
| resolve_report | A report was updated or resolved |
| revoke_admin_api_key | An Admin API key was revoked |
| revoke_recovery_kit | The recovery kit of an account was revoked |
diff --git a/fluxer_docs/src/content/docs/http-api/users.mdx b/fluxer_docs/src/content/docs/http-api/users.mdx
index dc402e774..5663fc623 100644
--- a/fluxer_docs/src/content/docs/http-api/users.mdx
+++ b/fluxer_docs/src/content/docs/http-api/users.mdx
@@ -519,8 +519,8 @@ One badge on a [full user profile](#full-user-profile-object). The API picks the
| key | string | The badge's identity, equal to `kind` for built-in badges and `custom:{id}` for a custom badge. Use it as the list key |
| kind<sup>1</sup> | string | The badge type |
| label | string | The badge description in your locale, for the tooltip and alt text. A custom badge uses its name |
-| asset<sup>2</sup> | ?string | The 16-character hex hash of the badge image, or null for a text badge, a custom badge or a built-in badge with a replaced image |
-| asset_url<sup>3</sup> | ?string | The image URL of a custom badge or of a built-in badge whose image the instance admins replaced, or null for other badges |
+| asset<sup>2</sup> | ?string | The hex hash of the badge image, or null for a text badge, a custom badge or a replaced built-in image |
+| asset_url<sup>3</sup> | ?string | The image URL of a custom badge or a built-in badge with a replaced image, or null for other badges |
| aspect_ratio | ?number | Image width divided by height, or null for a square badge |
| caption | ?string | Short text the badge stands for, shown in place of the image when `asset` is null |
| href | ?string | The URL a click opens, or null |