oapi: sticker packs

This commit is contained in:
Puyodead1 2023-03-25 12:48:09 -04:00
parent a1d8869271
commit ad5f5cb90d
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
5 changed files with 3802 additions and 7 deletions

View File

@ -6503,6 +6503,12 @@
"location" "location"
] ]
}, },
"StickerPacksResponse": {
"type": "array",
"items": {
"$ref": "#/components/schemas/StickerPack"
}
},
"TenorTrendingResponse": { "TenorTrendingResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -7904,8 +7910,15 @@
} }
], ],
"responses": { "responses": {
"default": { "200": {
"description": "No description available" "description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StickerPacksResponse"
}
}
}
} }
}, },
"tags": [ "tags": [

File diff suppressed because it is too large Load Diff

View File

@ -16,16 +16,28 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Request, Response, Router } from "express";
import { route } from "@spacebar/api"; import { route } from "@spacebar/api";
import { StickerPack } from "@spacebar/util"; import { StickerPack } from "@spacebar/util";
import { Request, Response, Router } from "express";
const router: Router = Router(); const router: Router = Router();
router.get("/", route({}), async (req: Request, res: Response) => { router.get(
const sticker_packs = await StickerPack.find({ relations: ["stickers"] }); "/",
route({
res.json({ sticker_packs }); responses: {
200: {
body: "StickerPacksResponse",
},
},
}),
async (req: Request, res: Response) => {
const sticker_packs = await StickerPack.find({
relations: ["stickers"],
}); });
res.json({ sticker_packs });
},
);
export default router; export default router;

View File

@ -0,0 +1,3 @@
import { StickerPack } from "../../entities";
export type StickerPacksResponse = StickerPack[];

View File

@ -36,6 +36,7 @@ export * from "./LimitsConfigurationResponse";
export * from "./LocationMetadataResponse"; export * from "./LocationMetadataResponse";
export * from "./MemberJoinGuildResponse"; export * from "./MemberJoinGuildResponse";
export * from "./OAuthAuthorizeResponse"; export * from "./OAuthAuthorizeResponse";
export * from "./StickerPacksResponse";
export * from "./Tenor"; export * from "./Tenor";
export * from "./TokenResponse"; export * from "./TokenResponse";
export * from "./UserProfileResponse"; export * from "./UserProfileResponse";