summaryrefslogtreecommitdiff
path: root/lib/schemas.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/schemas.ts')
-rw-r--r--lib/schemas.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/schemas.ts b/lib/schemas.ts
new file mode 100644
index 0000000..669674a
--- /dev/null
+++ b/lib/schemas.ts
@@ -0,0 +1,34 @@
+import { z } from "@hono/zod-openapi";
+
+const ErrorResponse = z.string().optional().openapi({
+ description: "Error message reported by server",
+});
+
+const TeawieURLResponse = z.object({
+ url: z.string().url().optional().openapi({
+ description: "URL to Teawie",
+ }),
+
+ error: ErrorResponse,
+});
+
+export const ListTeawiesParams = z.object({
+ limit: z
+ .string()
+ .optional()
+ .default("5")
+ .refine((data) => {
+ const parsed = parseInt(data);
+ return !isNaN(parsed);
+ })
+ .openapi({
+ description: "Maximum number of Teawie URLs to be returned",
+ }),
+});
+
+export const ListTeawiesResponse = z.object({
+ urls: z.array(z.string().url()).optional(),
+ error: ErrorResponse,
+});
+
+export const RandomTeawiesResponse = TeawieURLResponse;