diff --git a/assets/openapi.json b/assets/openapi.json index c7d9c6f0b..7da3259ef 100644 Binary files a/assets/openapi.json and b/assets/openapi.json differ diff --git a/assets/schemas.json b/assets/schemas.json index 8879a307d..acf04618f 100644 Binary files a/assets/schemas.json and b/assets/schemas.json differ 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 . +*/ + +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 . +*/ + +export interface SpacebarVersionResponse { + implementation: string; + version: { + rev: string | null; + lastModified: number; + }; +}