export type GetApiPublicV1ReportsSalesByUserArgs = {'status[]'?: (Array<'PENDING' | 'PROCESSING' | 'READY_TO_SHIP' | 'DELIVERING' | 'DELIVERED' | 'COMPLETED' | 'CANCELED'>) | undefined, order_datetime?: string | undefined, search?: string | undefined, 'user_ids[]'?: Array | undefined}; export type GetApiPublicV1ReportsSalesByUserOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the Sales By User report * * GET /public/v1/reports/sales-by-user */ export const getApiPublicV1ReportsSalesByUser = async (args: GetApiPublicV1ReportsSalesByUserArgs, options?: GetApiPublicV1ReportsSalesByUserOptions) => { const {baseUrl = "https://app.distru.com", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") for (const item of args['status[]'] ?? []) query.append("status[]", String(item)) if (args.order_datetime != null) query.append("order_datetime", String(args.order_datetime)) if (args.search != null) query.append("search", String(args.search)) for (const item of args['user_ids[]'] ?? []) query.append("user_ids[]", String(item)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/reports/sales-by-user${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() };