| gio | 9b7421a | 2025-06-18 12:31:13 +0000 | [diff] [blame] | 1 | import { z } from "zod"; |
| 2 | |
| 3 | export const GithubRepositorySchema = z.object({ |
| 4 | id: z.number(), |
| 5 | name: z.string(), |
| 6 | full_name: z.string(), |
| 7 | html_url: z.string(), |
| 8 | ssh_url: z.string(), |
| 9 | }); |
| 10 | |
| 11 | export const GithubRepositoriesSchema = z.array(GithubRepositorySchema); |
| 12 | |
| 13 | export const DeployKeysSchema = z.array( |
| 14 | z.object({ |
| 15 | id: z.number(), |
| 16 | key: z.string(), |
| 17 | }), |
| 18 | ); |
| 19 | |
| 20 | export const WebhookSchema = z.object({ |
| 21 | id: z.number(), |
| 22 | config: z.object({ |
| 23 | url: z.string().optional(), // url might not always be present |
| 24 | content_type: z.string().optional(), |
| 25 | }), |
| 26 | events: z.array(z.string()), |
| 27 | active: z.boolean(), |
| 28 | }); |
| 29 | |
| 30 | export const ListWebhooksResponseSchema = z.array(WebhookSchema); |
| 31 | export type DeployKeys = z.infer<typeof DeployKeysSchema>; |
| 32 | export type Webhook = z.infer<typeof WebhookSchema>; |
| 33 | export type ListWebhooksResponse = z.infer<typeof ListWebhooksResponseSchema>; |
| 34 | export type GithubRepository = z.infer<typeof GithubRepositorySchema>; |
| 35 | export type GithubRepositories = z.infer<typeof GithubRepositoriesSchema>; |