blob: 40404876c2a22e4833e115e3be8e98cee1838ad7 [file] [log] [blame]
import { z } from "zod";
export const GithubRepositorySchema = z.object({
id: z.number(),
name: z.string(),
full_name: z.string(),
html_url: z.string(),
ssh_url: z.string(),
});
export const GithubRepositoriesSchema = z.array(GithubRepositorySchema);
export const DeployKeysSchema = z.array(
z.object({
id: z.number(),
key: z.string(),
}),
);
export const WebhookSchema = z.object({
id: z.number(),
config: z.object({
url: z.string().optional(), // url might not always be present
content_type: z.string().optional(),
}),
events: z.array(z.string()),
active: z.boolean(),
});
export const ListWebhooksResponseSchema = z.array(WebhookSchema);
export type DeployKeys = z.infer<typeof DeployKeysSchema>;
export type Webhook = z.infer<typeof WebhookSchema>;
export type ListWebhooksResponse = z.infer<typeof ListWebhooksResponseSchema>;
export type GithubRepository = z.infer<typeof GithubRepositorySchema>;
export type GithubRepositories = z.infer<typeof GithubRepositoriesSchema>;