export type DeleteApiV2InvoicingTemplatesTemplateIdArgs = {template_id: string}; export type DeleteApiV2InvoicingTemplatesTemplateIdOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete template * * DELETE /v2/invoicing/templates/{template_id} */ export const deleteApiV2InvoicingTemplatesTemplateId = async (args: DeleteApiV2InvoicingTemplatesTemplateIdArgs, options?: DeleteApiV2InvoicingTemplatesTemplateIdOptions) => { const {baseUrl = "https://api-m.paypal.com", fetch: fetchFn = fetch, Oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/invoicing/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 };