fetchShipmentTreesInPages

abstract fun fetchShipmentTreesInPages(updatedAfter: String? = null, updatedBefore: String? = null, chunkSize: Int = DEFAULT_SHIPMENT_TREE_PAGE_SIZE): Flow<Result<List<ShipmentTree>>>

Fetches the shipment hierarchy and emits it as a Flow of ShipmentTree pages, so callers can render results progressively instead of waiting on the entire shipment list.

Shipments are fetched in a single request, then their scans and most recent entries are requested in chunks of up to chunkSize shipment IDs; each chunk's ShipmentTree results are emitted as soon as they're available.

Return

A Flow emitting a Result per page; a failed page does not stop later pages from being emitted.

Parameters

updatedAfter

An ISO formatted date string for fetching shipments updated after a certain date (i.e. "2024-12-31T23:59:59").

updatedBefore

An ISO formatted date string for fetching shipments before after a certain date (i.e. "2024-12-31T23:59:59").

chunkSize

Number of shipments per emitted page. Coerced to at most MAX_SHIPMENT_ID_CHUNK_SIZE.