From 984f4cfa24ee7e421bb1fbdf5907ae60375cf9ef Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 29 Jul 2024 04:53:25 -0400 Subject: use github contents api for image urls + summer cleaning (#253) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * nix: alejandra -> nixfmt-rfc-style * nix: pre-commit-hooks -> treefmt-nix * nix: use corepack * ci: cleanup workflows * ci: use better dependabot scopes * gitignore: extend with github templates * remove teawie-archive submodule * pnpm: 8.8.0 -> 9.6.0 * nix: add nrr to shell * nix: add node lsps to shell * use github contents api for image urls * ci: cleanup workflows * nix: add ci shell * `octokit` -> `fetch` & cache responses * nix: use nixpkgs wrangler * nix: update flake.lock Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/d9c0b9d611277e42e6db055636ba0409c59db6d2' (2024-07-05) → 'github:NixOS/nixpkgs/038fb464fcfa79b4f08131b07f2d8c9a6bcc4160' (2024-07-28) * tsconfig: use strictest * adopt openapi * package.json: rename to teawie-api * nix: add treefmt to ci shell * ci: add release gate --- src/schemas.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/schemas.ts') diff --git a/src/schemas.ts b/src/schemas.ts index 1b858ff..669674a 100644 --- a/src/schemas.ts +++ b/src/schemas.ts @@ -1,6 +1,18 @@ -import { z } from "zod"; +import { z } from "@hono/zod-openapi"; -export const list = z.object({ +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() @@ -8,5 +20,15 @@ export const list = z.object({ .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; -- cgit v1.2.3