summary refs log tree commit diff
path: root/src
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 /src
parentschemas for wellknowns (diff)
downloadserver-ts-4cf0eadf7fc6e166e88cc032d9368814bb98a723.tar.xz
schemas for gif/version
Diffstat (limited to 'src')
-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
4 files changed, 60 insertions, 2 deletions
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 7839a7c1a..c445febe0 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 13d8150a4..ffb87fbc6 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 000000000..2b3666347 --- /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 000000000..79ec5d4c8 --- /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; + }; +}