export type DeleteApiRepositoriesWorkspaceRepoSlugHooksUidArgs = {workspace: string, repo_slug: string, uid: string}; export type DeleteApiRepositoriesWorkspaceRepoSlugHooksUidOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a webhook for a repository * * DELETE /repositories/{workspace}/{repo_slug}/hooks/{uid} * * Also accepts auth: basic, api_key */ export const deleteApiRepositoriesWorkspaceRepoSlugHooksUid = async (args: DeleteApiRepositoriesWorkspaceRepoSlugHooksUidArgs, options?: DeleteApiRepositoriesWorkspaceRepoSlugHooksUidOptions) => { const {baseUrl = "https://api.bitbucket.org/2.0", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/repositories/${encodeURIComponent(String(args.workspace))}/${encodeURIComponent(String(args.repo_slug))}/hooks/${encodeURIComponent(String(args.uid))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };