export type DeleteApi30BatchWebhooksBatchWebhookIdArgs = {batch_webhook_id: string}; export type DeleteApi30BatchWebhooksBatchWebhookIdOptions = {baseUrl?: string | undefined, bearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete batch webhook * * DELETE /3.0/batch-webhooks/{batch_webhook_id} * * Also accepts auth: oauth2 */ export const deleteApi30BatchWebhooksBatchWebhookId = async (args: DeleteApi30BatchWebhooksBatchWebhookIdArgs, options?: DeleteApi30BatchWebhooksBatchWebhookIdOptions) => { const {baseUrl = "https://api.mailchimp.com", fetch: fetchFn = fetch, bearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerToken !== undefined) headers.set('authorization', `Bearer ${bearerToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/3.0/batch-webhooks/${encodeURIComponent(String(args.batch_webhook_id))}${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 };