export type GetApiV0ReportsArgs = {tz?: string | undefined}; export type GetApiV0ReportsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * download order report * * GET /v0/reports */ export const getApiV0Reports = async (args: GetApiV0ReportsArgs, options?: GetApiV0ReportsOptions) => { const {baseUrl = "https://api.pixxel.space", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.tz != null) query.append("tz", String(args.tz)) if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v0/reports${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 };