export type UpdateApiReposOwnerRepoUnsubscribeArgs = {owner: string, repo: string}; export type UpdateApiReposOwnerRepoUnsubscribeOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Unsubscribe the repository updates * * PUT /repos/{owner}/{repo}/unsubscribe/ */ export const updateApiReposOwnerRepoUnsubscribe = async (args: UpdateApiReposOwnerRepoUnsubscribeArgs, options: UpdateApiReposOwnerRepoUnsubscribeOptions) => { const {baseUrl, 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))}/unsubscribe/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };