summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-07-31 05:40:02 +0200
committerRory& <root@rory.gay>2026-07-31 18:20:14 +0200
commit4cf0eadf7fc6e166e88cc032d9368814bb98a723 (patch)
treef3eba4759f3425a9e602be99a9c3618b562d3794
parentschemas for wellknowns (diff)
downloadserver-ts-4cf0eadf7fc6e166e88cc032d9368814bb98a723.tar.xz
schemas for gif/version
-rw-r--r--assets/openapi.json76
-rw-r--r--assets/schemas.json58
-rw-r--r--src/api/routes_toplevel/_spacebar/api/v1/integrations/gif.ts8
-rw-r--r--src/api/routes_toplevel/_spacebar/api/version.ts8
-rw-r--r--src/schemas/api/spacebar/Integrations.ts21
-rw-r--r--src/schemas/api/spacebar/Version.ts25
6 files changed, 190 insertions, 6 deletions
diff --git a/assets/openapi.json b/assets/openapi.json

index c7d9c6f0..7da3259e 100644 --- a/assets/openapi.json +++ b/assets/openapi.json
@@ -7367,6 +7367,60 @@ } } }, + "GifIntegrationsResponse": { + "type": "object", + "properties": { + "providers": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "available": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "available" + ] + } + } + }, + "required": [ + "providers" + ] + }, + "SpacebarVersionResponse": { + "type": "object", + "properties": { + "implementation": { + "type": "string" + }, + "version": { + "type": "object", + "properties": { + "rev": { + "type": [ + "null", + "string" + ] + }, + "lastModified": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": [ + "lastModified", + "rev" + ] + } + }, + "required": [ + "implementation", + "version" + ] + }, "SpacebarWellKnownLegacyResponse": { "type": "object", "properties": { @@ -29691,8 +29745,15 @@ {} ], "responses": { - "default": { - "description": "No description available" + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SpacebarVersionResponse" + } + } + } } }, "tags": [ @@ -29712,8 +29773,15 @@ {} ], "responses": { - "default": { - "description": "No description available" + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GifIntegrationsResponse" + } + } + } } }, "tags": [ diff --git a/assets/schemas.json b/assets/schemas.json
index 8879a307..acf04618 100644 --- a/assets/schemas.json +++ b/assets/schemas.json
@@ -7855,6 +7855,64 @@ "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, + "GifIntegrationsResponse": { + "type": "object", + "properties": { + "providers": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "available": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "available" + ] + } + } + }, + "additionalProperties": false, + "required": [ + "providers" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "SpacebarVersionResponse": { + "type": "object", + "properties": { + "implementation": { + "type": "string" + }, + "version": { + "type": "object", + "properties": { + "rev": { + "type": [ + "null", + "string" + ] + }, + "lastModified": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": [ + "lastModified", + "rev" + ] + } + }, + "additionalProperties": false, + "required": [ + "implementation", + "version" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, "SpacebarWellKnownLegacyResponse": { "type": "object", "properties": { diff --git a/src/api/routes_toplevel/_spacebar/api/v1/integrations/gif.ts b/src/api/routes_toplevel/_spacebar/api/v1/integrations/gif.ts
index 7839a7c1..c445febe 100644 --- a/src/api/routes_toplevel/_spacebar/api/v1/integrations/gif.ts +++ b/src/api/routes_toplevel/_spacebar/api/v1/integrations/gif.ts
@@ -19,6 +19,7 @@ import { Router, Response, Request } from "express"; import { route } from "@spacebar/api/middlewares"; import { GifProviderManager } from "@spacebar/integrations/gifs"; +import { GifIntegrationsResponse } from "@spacebar/schemas/api/spacebar/Integrations"; const router = Router({ mergeParams: true }); @@ -27,9 +28,14 @@ router.get( route({ spacebarOnly: true, authentication: "never", + responses: { + 200: { + body: "GifIntegrationsResponse", + }, + }, }), (req: Request, res: Response) => { - res.json({ providers: GifProviderManager.getProviders() }); + res.json({ providers: GifProviderManager.getProviders() } satisfies GifIntegrationsResponse); }, ); diff --git a/src/api/routes_toplevel/_spacebar/api/version.ts b/src/api/routes_toplevel/_spacebar/api/version.ts
index 13d8150a..ffb87fbc 100644 --- a/src/api/routes_toplevel/_spacebar/api/version.ts +++ b/src/api/routes_toplevel/_spacebar/api/version.ts
@@ -19,6 +19,7 @@ import { Router, Response, Request } from "express"; import { route } from "@spacebar/api/middlewares"; import { getRevInfoOrFail } from "@spacebar/util"; +import { SpacebarVersionResponse } from "@spacebar/schemas/api/spacebar/Version"; const router = Router({ mergeParams: true }); @@ -27,12 +28,17 @@ router.get( route({ spacebarOnly: true, authentication: "never", + responses: { + 200: { + body: "SpacebarVersionResponse", + }, + }, }), (req: Request, res: Response) => { res.json({ implementation: "spacebar-server-ts", version: getRevInfoOrFail(), - }); + } satisfies SpacebarVersionResponse); }, ); diff --git a/src/schemas/api/spacebar/Integrations.ts b/src/schemas/api/spacebar/Integrations.ts new file mode 100644
index 00000000..2b366634 --- /dev/null +++ b/src/schemas/api/spacebar/Integrations.ts
@@ -0,0 +1,21 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2026 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export interface GifIntegrationsResponse { + providers: { [provider: string]: { available: boolean } }; +} diff --git a/src/schemas/api/spacebar/Version.ts b/src/schemas/api/spacebar/Version.ts new file mode 100644
index 00000000..79ec5d4c --- /dev/null +++ b/src/schemas/api/spacebar/Version.ts
@@ -0,0 +1,25 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2026 Spacebar and Spacebar Contributors + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ + +export interface SpacebarVersionResponse { + implementation: string; + version: { + rev: string | null; + lastModified: number; + }; +}