summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-07-14 18:34:32 +0200
committerRory& <root@rory.gay>2025-09-29 18:38:06 +0200
commit387722d017fe51335020f40852e8f2c708064bf6 (patch)
treef4f748b16a8bf936cde5f2afba39141dceaa705a /src/api
parentAdd schemas for collectibles (diff)
downloadserver-ts-387722d017fe51335020f40852e8f2c708064bf6.tar.xz
Add endpoint implementations
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/collectibles-categories.ts40
-rw-r--r--src/api/routes/collectibles-shop.ts43
-rw-r--r--src/api/routes/users/@me/collectibles-marketing.ts49
-rw-r--r--src/api/routes/users/@me/collectibles-purchases.ts46
4 files changed, 178 insertions, 0 deletions
diff --git a/src/api/routes/collectibles-categories.ts b/src/api/routes/collectibles-categories.ts
new file mode 100644

index 00000000..87e79f55 --- /dev/null +++ b/src/api/routes/collectibles-categories.ts
@@ -0,0 +1,40 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 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/>. +*/ + +import { route } from "@spacebar/api"; +import { Request, Response, Router } from "express"; +import { CollectiblesCategoriesResponse } from "@spacebar/util"; + +const router = Router(); + +router.get( + "/", + route({ + responses: { + 200: { + body: "CollectiblesCategoriesResponse", + }, + 204: {}, + }, + }), + (req: Request, res: Response) => { + res.send([] as CollectiblesCategoriesResponse); + }, +); + +export default router; diff --git a/src/api/routes/collectibles-shop.ts b/src/api/routes/collectibles-shop.ts new file mode 100644
index 00000000..118c2c0f --- /dev/null +++ b/src/api/routes/collectibles-shop.ts
@@ -0,0 +1,43 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 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/>. +*/ + +import { route } from "@spacebar/api"; +import { Request, Response, Router } from "express"; +import { CollectiblesShopResponse } from "@spacebar/util"; + +const router = Router(); + +router.get( + "/", + route({ + responses: { + 200: { + body: "CollectiblesShopResponse", + }, + 204: {}, + }, + }), + (req: Request, res: Response) => { + res.send({ + shop_blocks: [], + categories: [], + } as CollectiblesShopResponse); + }, +); + +export default router; diff --git a/src/api/routes/users/@me/collectibles-marketing.ts b/src/api/routes/users/@me/collectibles-marketing.ts new file mode 100644
index 00000000..e0443101 --- /dev/null +++ b/src/api/routes/users/@me/collectibles-marketing.ts
@@ -0,0 +1,49 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 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/>. +*/ + +import { route } from "@spacebar/api"; +import { Request, Response, Router } from "express"; +import { CollectiblesMarketingResponse } from "@spacebar/util"; + +const router = Router(); + +// Unsure what this endpoint does, it seems to only affect the visual style of the shop tab in home +router.get( + "/", + route({ + responses: { + 200: { + body: "CollectiblesMarketingResponse", + }, + 204: {}, + 401: { + body: "APIErrorResponse", + }, + 404: { + body: "APIErrorResponse", + }, + }, + }), + async (req: Request, res: Response) => { + res.send({ + marketings: {}, + } as CollectiblesMarketingResponse); + }, +); + +export default router; diff --git a/src/api/routes/users/@me/collectibles-purchases.ts b/src/api/routes/users/@me/collectibles-purchases.ts new file mode 100644
index 00000000..5c134505 --- /dev/null +++ b/src/api/routes/users/@me/collectibles-purchases.ts
@@ -0,0 +1,46 @@ +/* + Spacebar: A FOSS re-implementation and extension of the Discord.com backend. + Copyright (C) 2025 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/>. +*/ + +import { route } from "@spacebar/api"; +import { Request, Response, Router } from "express"; + +const router = Router(); + +// Unsure what this endpoint does, it seems to only affect the visual style of the shop tab in home +router.get( + "/", + route({ + responses: { + 200: { + // body: "CollectiblesPurchasesResponse", + }, + 204: {}, + 401: { + body: "APIErrorResponse", + }, + 404: { + body: "APIErrorResponse", + }, + }, + }), + async (req: Request, res: Response) => { + res.send([]); + }, +); + +export default router;