From 4cf0eadf7fc6e166e88cc032d9368814bb98a723 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 31 Jul 2026 05:40:02 +0200 Subject: [PATCH] schemas for gif/version --- assets/openapi.json | Bin 1035668 -> 1038146 bytes assets/schemas.json | Bin 463711 -> 465389 bytes .../_spacebar/api/v1/integrations/gif.ts | 8 +++++- .../routes_toplevel/_spacebar/api/version.ts | 8 +++++- src/schemas/api/spacebar/Integrations.ts | 21 +++++++++++++++ src/schemas/api/spacebar/Version.ts | 25 ++++++++++++++++++ 6 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/schemas/api/spacebar/Integrations.ts create mode 100644 src/schemas/api/spacebar/Version.ts diff --git a/assets/openapi.json b/assets/openapi.json index c7d9c6f0bedf9ff829f6a07c94882e6ef29e6ea3..7da3259efcc294b271fe1f2e05477f082116abce 100644 GIT binary patch delta 420 zcmYk&O(=tL90&0J|L4DF&$eftM@vR%UK$ccD^c@S!ogcgIcf219x?M+yJ2e5a#4?b z4=$Xo6?L`_-1I-p)bW3wIwZ< zKyka!WIlHX_peAZ0zooL4GrObS_Ny`ts=f5Od_yOA~-K2Oc+_7!^|G3$rp=Zby7ca zkE9%Gkai%|LI!?gB9G}29eoS7vV77Z7+MlXvY20O(D^q!jOuz;!6!@jej=^gArIqh zoXFWZiF0sH&c(@`n=85rd6eAgaW1Qn!dVluv=XVTUB%(6lz{avRo#@{D~#ajRyoD^ Smi*=X_xp=%(Otg2CjS6#R*r%I delta 126 zcmX@K&VI^l`-T?A7N!>FEiAUe)89z52u|0%#LqvO>w5I`{xU|l$s0V~+jmN{05K~N zvjH(X5OV-AClGT1F*gwN05LBR^KIWL&3|L%^b5;4mraj9&;M=u?$i8y(<4ssuR@4z J2a2_G0{{}_G#>x} diff --git a/assets/schemas.json b/assets/schemas.json index 8879a307d696cb7d051737dacdb33a1097bfb30f..acf04618f36464ff7f471a8f58a62d98949dcb48 100644 GIT binary patch delta 284 zcmcb=Oy=!onT8g|7N#xCCN-SynQ5MRC8_B})7LdIsZ4KBXEd0;z>Ae_a>)((=>ZoQ z1EwbwGrLWXF=LgRE)dDgJH22go95&RfgRKTZerw|e&i#I;N%HRER!b$DNb(q6gGXH z7c0kfMs>#U={2>?94uj}Ma9$4vorZ~W#$&-q~@mPl_XA2>;jtjo|#2;@`H7D%tfhX zlM5SFrwi<06r0`(vF9Wfm-yzVOjitNkpijVoW9{F zqv~XZrgCnmRAyRc>hy&Rm?c?&<|$2gJjlj6*=igw71-VVI-L-}p Ph*^M`b-QZ~o78jw4c%t` delta 38 rcmaF6S?2ySnT8g|7N#xCCNX|v(Pc<w;raT=0I<^nh 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; + }; +}