blob: 40404876c2a22e4833e115e3be8e98cee1838ad7 [file] [log] [blame]
gio9b7421a2025-06-18 12:31:13 +00001import { z } from "zod";
2
3export 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
11export const GithubRepositoriesSchema = z.array(GithubRepositorySchema);
12
13export const DeployKeysSchema = z.array(
14 z.object({
15 id: z.number(),
16 key: z.string(),
17 }),
18);
19
20export 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
30export const ListWebhooksResponseSchema = z.array(WebhookSchema);
31export type DeployKeys = z.infer<typeof DeployKeysSchema>;
32export type Webhook = z.infer<typeof WebhookSchema>;
33export type ListWebhooksResponse = z.infer<typeof ListWebhooksResponseSchema>;
34export type GithubRepository = z.infer<typeof GithubRepositorySchema>;
35export type GithubRepositories = z.infer<typeof GithubRepositoriesSchema>;