export type CreateApiInvoiceInvoiceIdPaypalOrderOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /invoice/{invoiceId}/paypal/order */ export const createApiInvoiceInvoiceIdPaypalOrder = async (options?: CreateApiInvoiceInvoiceIdPaypalOrderOptions) => { const {baseUrl = "https://core.hivelocity.net/api/v2", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("X-API-KEY", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/invoice/${encodeURIComponent(String(args.invoiceId))}/paypal/order${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 };