export type CreateApi30CampaignsCampaignIdActionsCancelSendArgs = {campaign_id: string}; export type CreateApi30CampaignsCampaignIdActionsCancelSendOptions = {baseUrl?: string | undefined, bearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel campaign * * POST /3.0/campaigns/{campaign_id}/actions/cancel-send * * Also accepts auth: oauth2 */ export const createApi30CampaignsCampaignIdActionsCancelSend = async (args: CreateApi30CampaignsCampaignIdActionsCancelSendArgs, options?: CreateApi30CampaignsCampaignIdActionsCancelSendOptions) => { 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/campaigns/${encodeURIComponent(String(args.campaign_id))}/actions/cancel-send${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 };