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