export type GetApiTerminalsOrdersArgs = {Authorization: string, created_before?: string | undefined, created_after?: string | undefined, order_type?: ('boarding_only' | 'boarding_shipping') | undefined, order_status?: ('created' | 'submitted' | 'completed') | undefined, sub_account_id?: string | undefined}; export type GetApiTerminalsOrdersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * List Terminal Orders * * GET /terminals/orders */ export const getApiTerminalsOrders = async (args: GetApiTerminalsOrdersArgs, options?: GetApiTerminalsOrdersOptions) => { const {baseUrl = "https://api.justifi.ai/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args.created_before != null) query.append("created_before", String(args.created_before)) if (args.created_after != null) query.append("created_after", String(args.created_after)) if (args.order_type != null) query.append("order_type", String(args.order_type)) if (args.order_status != null) query.append("order_status", String(args.order_status)) if (args.sub_account_id != null) query.append("sub_account_id", String(args.sub_account_id)) const url = `${baseUrl.replace(/\/+$/, '')}/terminals/orders${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 undefined };