export type DeleteApiV2InvoicingInvoicesInvoiceIdArgs = {invoice_id: string}; export type DeleteApiV2InvoicingInvoicesInvoiceIdOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete invoice * * DELETE /v2/invoicing/invoices/{invoice_id} */ export const deleteApiV2InvoicingInvoicesInvoiceId = async (args: DeleteApiV2InvoicingInvoicesInvoiceIdArgs, options?: DeleteApiV2InvoicingInvoicesInvoiceIdOptions) => { 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/invoices/${encodeURIComponent(String(args.invoice_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 };