export type GetApiApiCustomerInvoicesCardMaskArgs = {cardMask: string, page?: number | undefined, size?: number | undefined, sort?: Array | undefined}; export type GetApiApiCustomerInvoicesCardMaskOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * invoices * * GET /api/customer/invoices/{cardMask} */ export const getApiApiCustomerInvoicesCardMask = async (args: GetApiApiCustomerInvoicesCardMaskArgs, options: GetApiApiCustomerInvoicesCardMaskOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.page != null) query.append("page", String(args.page)) if (args.size != null) query.append("size", String(args.size)) for (const item of args.sort ?? []) query.append("sort", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/api/customer/invoices/${encodeURIComponent(String(args.cardMask))}${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() };