export type GetApiApiV1OrdersOrderNumberInvoicesArgs = {order_number: string}; export type GetApiApiV1OrdersOrderNumberInvoicesOptions = {baseUrl: string, APIKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Order Invoices * * GET /api/v1/orders/{order_number}/invoices */ export const getApiApiV1OrdersOrderNumberInvoices = async (args: GetApiApiV1OrdersOrderNumberInvoicesArgs, options: GetApiApiV1OrdersOrderNumberInvoicesOptions) => { const {baseUrl, fetch: fetchFn = fetch, APIKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/zip") if (APIKeyAuth !== undefined) headers.set("X-API-Key", APIKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/orders/${encodeURIComponent(String(args.order_number))}/invoices${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };