export type GetApiOrderListArgs = {page?: number | undefined, page_size?: number | undefined, currency?: string | undefined, status?: string | undefined, 'X-API-Key-ID': string, 'X-API-Timestamp': string, 'X-API-Nonce': string, Digest: string, Authorization: string}; export type GetApiOrderListOptions = {baseUrl?: string | undefined, Ed25519?: string | undefined, fetch?: typeof fetch | undefined}; /** * List orders * * GET /order/list */ export const getApiOrderList = async (args: GetApiOrderListArgs, options?: GetApiOrderListOptions) => { const {baseUrl = "https://openapi.infini.money/v2/acquiring", fetch: fetchFn = fetch, Ed25519} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.page != null) query.append("page", String(args.page)) if (args.page_size != null) query.append("page_size", String(args.page_size)) if (args.currency != null) query.append("currency", String(args.currency)) if (args.status != null) query.append("status", String(args.status)) if (args['X-API-Key-ID'] != null) headers.set("X-API-Key-ID", String(args['X-API-Key-ID'])) if (args['X-API-Timestamp'] != null) headers.set("X-API-Timestamp", String(args['X-API-Timestamp'])) if (args['X-API-Nonce'] != null) headers.set("X-API-Nonce", String(args['X-API-Nonce'])) if (args.Digest != null) headers.set("Digest", String(args.Digest)) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (Ed25519 !== undefined) headers.set("Authorization", Ed25519) const url = `${baseUrl.replace(/\/+$/, '')}/order/list${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 };