export type DeleteApi30TemplatesTemplateIdArgs = {template_id: string}; export type DeleteApi30TemplatesTemplateIdOptions = {baseUrl?: string | undefined, bearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete template * * DELETE /3.0/templates/{template_id} * * Also accepts auth: oauth2 */ export const deleteApi30TemplatesTemplateId = async (args: DeleteApi30TemplatesTemplateIdArgs, options?: DeleteApi30TemplatesTemplateIdOptions) => { 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/templates/${encodeURIComponent(String(args.template_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 };