export type DeleteApiManagementHooksHookIdArgs = {hookId: string}; export type DeleteApiManagementHooksHookIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Webhook * * DELETE /management/hooks/{hookId} */ export const deleteApiManagementHooksHookId = async (args: DeleteApiManagementHooksHookIdArgs, options?: DeleteApiManagementHooksHookIdOptions) => { const {baseUrl = "https://api.paychex.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/management/hooks/${encodeURIComponent(String(args.hookId))}${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 res.blob() };