export type CreateApiReposOwnerRepoPagesDeploymentsPagesDeploymentIdCancelArgs = {owner: string, repo: string, pages_deployment_id: number | string}; export type CreateApiReposOwnerRepoPagesDeploymentsPagesDeploymentIdCancelOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel a GitHub Pages deployment * * POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel */ export const createApiReposOwnerRepoPagesDeploymentsPagesDeploymentIdCancel = async (args: CreateApiReposOwnerRepoPagesDeploymentsPagesDeploymentIdCancelArgs, options?: CreateApiReposOwnerRepoPagesDeploymentsPagesDeploymentIdCancelOptions) => { const {baseUrl = "https://api.github.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/repos/${encodeURIComponent(String(args.owner))}/${encodeURIComponent(String(args.repo))}/pages/deployments/${encodeURIComponent(String(args.pages_deployment_id))}/cancel${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };