diff options
Diffstat (limited to 'lib/types')
| -rw-r--r-- | lib/types/api/links.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/types/api/links.ts b/lib/types/api/links.ts new file mode 100644 index 00000000..81cde053 --- /dev/null +++ b/lib/types/api/links.ts @@ -0,0 +1,26 @@ +import { z } from "zod"; + +export const ZBookmarkedLink = z.object({ + id: z.string(), + url: z.string().url(), + createdAt: z.coerce.date(), + + details: z.object({ + title: z.string(), + description: z.string(), + imageUrl: z.string().url(), + }).nullish(), + +}); +export type ZBookmarkedLink = z.infer<typeof ZBookmarkedLink>; + + +// POST /v1/links +export const ZNewBookmarkedLinkRequest = ZBookmarkedLink.pick({ url: true }); + + +// GET /v1/links +export const ZGetLinksResponse = z.object({ + links: z.array(ZBookmarkedLink), +}); +export type ZGetLinksResponse = z.infer<typeof ZGetLinksResponse>; |
