export type CreateApi30AutomationsWorkflowIdActionsStartAllEmailsArgs = {workflow_id: string}; export type CreateApi30AutomationsWorkflowIdActionsStartAllEmailsOptions = {baseUrl?: string | undefined, bearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start automation emails * * POST /3.0/automations/{workflow_id}/actions/start-all-emails * * Also accepts auth: oauth2 */ export const createApi30AutomationsWorkflowIdActionsStartAllEmails = async (args: CreateApi30AutomationsWorkflowIdActionsStartAllEmailsArgs, options?: CreateApi30AutomationsWorkflowIdActionsStartAllEmailsOptions) => { 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/automations/${encodeURIComponent(String(args.workflow_id))}/actions/start-all-emails${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 };