export type EmailAddress = unknown; export type EmailAddressList = Array; export type Notification = {subject?: string | undefined, note?: string | undefined, send_to_invoicer?: boolean | undefined, send_to_recipient?: boolean | undefined, additional_recipients?: EmailAddressList | undefined}; export type CreateApiV2InvoicingInvoicesInvoiceIdRemindArgs = {invoice_id: string, body: Notification}; export type CreateApiV2InvoicingInvoicesInvoiceIdRemindOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send invoice reminder * * POST /v2/invoicing/invoices/{invoice_id}/remind */ export const createApiV2InvoicingInvoicesInvoiceIdRemind = async (args: CreateApiV2InvoicingInvoicesInvoiceIdRemindArgs, options?: CreateApiV2InvoicingInvoicesInvoiceIdRemindOptions) => { const {baseUrl = "https://api-m.paypal.com", fetch: fetchFn = fetch, Oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/invoicing/invoices/${encodeURIComponent(String(args.invoice_id))}/remind${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };