-
public interface ShipmentsRepositoryCore repository for managing Dockware shipments, scans, and associated entries.
This repository serves as the single source of truth for shipment data, providing reactive streams (StateFlow) for UI observation and suspended functions for data manipulation and API interaction.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classShipmentsRepository.Companion
-
Method Summary
Modifier and Type Method Description abstract Result<List<ShipmentTree>>fetchAllShipmentData(Long pollScansEvery)Triggers a full refresh of all shipment data, including scans and entries. abstract Result<ShipmentWithSharing>fetchShipmentTrees(Long pollScansEvery)Fetches the latest shipment hierarchy from the server. abstract Result<Shipment>createShipment(String title, Map<String, Object> metadata)Creates a new shipment. abstract Result<Shipment>renameShipment(String shipmentId, String newTitle)Updates the title of an existing shipment. abstract Result<Shipment>updateShipmentMetadata(String shipmentId, Map<String, Object> metadata)Updates custom metadata for a shipment without overwriting existing fields. abstract Result<Shipment>archiveShipment(String shipmentId)Soft-deletes a shipment, moving it to the archive. abstract Result<List<Shipment>>archiveShipments(List<String> shipmentIds)Batch soft-deletes multiple shipments. abstract Result<Shipment>unarchiveShipment(String shipmentId)Restores a soft-deleted shipment from the archive. abstract Result<ShipmentScan>createShipmentScan(String shipmentId, String title, Dimensions dimensions, Float weight, String freightClass, LocationData locationData, String notes, String status, ShipmentScanType scanType)Records a new scan event for a shipment. abstract Result<Map<String, List<ShipmentScan>>>fetchShipmentScans(List<String> shipmentIds)Fetches scans for multiple shipments in a single request. abstract Result<List<ShipmentScan>>fetchShipmentScans(String shipmentId)Fetches all scans associated with a specific shipment. abstract Result<Pair<Shipment, List<ShipmentScan>>>fetchShipmentAndScans(String shipmentId)Fetches both the shipment details and its scans in parallel. abstract Result<ShipmentScan>updateShipmentScanQualityApprovedByUser(String scanId, Boolean approved, Map<String, Object> currentMetadata)Updates the quality approval status for a scan, usually triggered by manual user review. abstract Result<ShipmentScan>updateShipmentScanReviewed(String scanId, String shipmentId, Boolean reviewed, Boolean approved, Map<String, Object> currentMetadata)Updates a review status for a scan in the metadata, additionally updating a user approval key. abstract Result<ShipmentScan>updateShipmentScan(String shipmentScanId, Map<String, Object> metadata)Updates raw metadata for a specific scan. abstract Result<ShipmentScan>updateShipmentScanManualDimensions(String shipmentScanId, Dimensions dimensions)Updates a scan with manually measured dimensions. abstract Result<ShipmentScan>updateShipmentScanWeight(String shipmentScanId, Float weight)Updates the weight of the scanned object. abstract Result<ShipmentScan>updateShipmentScanUserDimensions(String shipmentScanId, Dimensions dimensions, Point3 newCenter)Updates the bounding box/user-adjusted dimensions for a 3D scan. abstract Result<ShipmentScan>updateShipmentScanType(String scanId, ShipmentScanType scanType)Changes the classification type of an existing scan. abstract Result<ShipmentScan>archiveShipmentScan(String shipmentScanId)Deletes a specific scan record. abstract Result<List<ShipmentEntry>>fetchShipmentEntries(String shipmentScanId)Fetches all entries (files, images, point clouds) attached to a specific scan. abstract Result<Map<String, List<ShipmentEntry>>>fetchMostRecentShipmentEntries(List<String> shipmentIds)Fetches the most recent entries for a list of shipments (e.g., latest thumbnail and PLY file). abstract Result<ShipmentEntry>createPickTicketShipmentEntry(String shipmentId, String shipmentScanId, String jobId, String fileName)Creates an entry linking a previously uploaded pick ticket to a specific shipment and scan. abstract BooleanprocessCloudDimensions(ByteArray snapshotZipData, String shipmentId, String shipmentScanId, Function1<String, Unit> progressCallback, SnapshotValidation validation)Submits captured snapshot data to the cloud for volumetric dimensioning. abstract Result<Shipment>uploadBarcodes(List<BaseBarcode> barcodeData, String shipmentId, String shipmentScanId, Function1<String, Unit> progressCallback)Uploads detected barcode data and associates it with the specified scan. abstract List<Result<ShipmentStorageEntry>>uploadImages(List<ByteArray> images, String shipmentId, String shipmentScanId, Function1<String, Unit> progressCallback)Uploads a list of images as JPG entries for a specific scan. abstract Result<ByteArray>downloadPLYFile(String storagePath)abstract Result<ByteArray>downloadImageFile(String storagePath)abstract Result<ByteArray>downloadUrl(String url)Downloads the image bytes of a URL. abstract Result<ShipmentSharing>shareShipment(String shipmentId, String recipientEmail, String expiration)Shares a shipment with another user via email. abstract Result<String>uploadLogLines(List<LogEntry> logList)Uploads SDK/Application logs to the Dockware server for troubleshooting. abstract UnitclearShipments()Resets the repository state. Stops all background polling and clears all local StateFlow caches.
abstract StateFlow<List<Shipment>>getShipments()A reactive list of all shipments owned by or directly assigned to the current user.
abstract StateFlow<List<Shipment>>getSharedShipments()A reactive list of shipments that have been shared with the current user by others.
abstract StateFlow<Map<String, List<ShipmentScan>>>getShipmentScans()Reactive lists of ShipmentScan objects mapped by shipment ID.
abstract StateFlow<Map<String, List<ShipmentEntry>>>getShipmentEntries()Reactive lists of ShipmentEntry objects mapped by shipment ID.
abstract StateFlow<List<ShipmentTree>>getShipmentTrees()A unified list of ShipmentTree objects representing the full hierarchy (shipment + recent scans + entries) for all available shipments.
-
-
Method Detail
-
fetchAllShipmentData
abstract Result<List<ShipmentTree>> fetchAllShipmentData(Long pollScansEvery)
Triggers a full refresh of all shipment data, including scans and entries.
- Parameters:
pollScansEvery- If provided, starts background polling for scans in 'processing' status.
-
fetchShipmentTrees
abstract Result<ShipmentWithSharing> fetchShipmentTrees(Long pollScansEvery)
Fetches the latest shipment hierarchy from the server.
-
createShipment
abstract Result<Shipment> createShipment(String title, Map<String, Object> metadata)
Creates a new shipment.
- Parameters:
title- The display name of the shipment.metadata- Optional custom key-value pairs to associate with the shipment.
-
renameShipment
abstract Result<Shipment> renameShipment(String shipmentId, String newTitle)
Updates the title of an existing shipment.
-
updateShipmentMetadata
abstract Result<Shipment> updateShipmentMetadata(String shipmentId, Map<String, Object> metadata)
Updates custom metadata for a shipment without overwriting existing fields.
-
archiveShipment
abstract Result<Shipment> archiveShipment(String shipmentId)
Soft-deletes a shipment, moving it to the archive.
-
archiveShipments
abstract Result<List<Shipment>> archiveShipments(List<String> shipmentIds)
Batch soft-deletes multiple shipments.
-
unarchiveShipment
abstract Result<Shipment> unarchiveShipment(String shipmentId)
Restores a soft-deleted shipment from the archive.
-
createShipmentScan
abstract Result<ShipmentScan> createShipmentScan(String shipmentId, String title, Dimensions dimensions, Float weight, String freightClass, LocationData locationData, String notes, String status, ShipmentScanType scanType)
Records a new scan event for a shipment.
- Parameters:
shipmentId- The parent shipment.locationData- Optional GPS coordinates where the scan occurred.scanType- The category of scan (e.g., DIMENSION, DOCUMENT, PALLET).
-
fetchShipmentScans
abstract Result<Map<String, List<ShipmentScan>>> fetchShipmentScans(List<String> shipmentIds)
Fetches scans for multiple shipments in a single request.
-
fetchShipmentScans
abstract Result<List<ShipmentScan>> fetchShipmentScans(String shipmentId)
Fetches all scans associated with a specific shipment.
-
fetchShipmentAndScans
abstract Result<Pair<Shipment, List<ShipmentScan>>> fetchShipmentAndScans(String shipmentId)
Fetches both the shipment details and its scans in parallel.
-
updateShipmentScanQualityApprovedByUser
abstract Result<ShipmentScan> updateShipmentScanQualityApprovedByUser(String scanId, Boolean approved, Map<String, Object> currentMetadata)
Updates the quality approval status for a scan, usually triggered by manual user review.
-
updateShipmentScanReviewed
abstract Result<ShipmentScan> updateShipmentScanReviewed(String scanId, String shipmentId, Boolean reviewed, Boolean approved, Map<String, Object> currentMetadata)
Updates a review status for a scan in the metadata, additionally updating a user approval key.
-
updateShipmentScan
abstract Result<ShipmentScan> updateShipmentScan(String shipmentScanId, Map<String, Object> metadata)
Updates raw metadata for a specific scan.
-
updateShipmentScanManualDimensions
abstract Result<ShipmentScan> updateShipmentScanManualDimensions(String shipmentScanId, Dimensions dimensions)
Updates a scan with manually measured dimensions.
-
updateShipmentScanWeight
abstract Result<ShipmentScan> updateShipmentScanWeight(String shipmentScanId, Float weight)
Updates the weight of the scanned object.
-
updateShipmentScanUserDimensions
abstract Result<ShipmentScan> updateShipmentScanUserDimensions(String shipmentScanId, Dimensions dimensions, Point3 newCenter)
Updates the bounding box/user-adjusted dimensions for a 3D scan.
-
updateShipmentScanType
abstract Result<ShipmentScan> updateShipmentScanType(String scanId, ShipmentScanType scanType)
Changes the classification type of an existing scan.
-
archiveShipmentScan
abstract Result<ShipmentScan> archiveShipmentScan(String shipmentScanId)
Deletes a specific scan record.
-
fetchShipmentEntries
abstract Result<List<ShipmentEntry>> fetchShipmentEntries(String shipmentScanId)
Fetches all entries (files, images, point clouds) attached to a specific scan.
-
fetchMostRecentShipmentEntries
abstract Result<Map<String, List<ShipmentEntry>>> fetchMostRecentShipmentEntries(List<String> shipmentIds)
Fetches the most recent entries for a list of shipments (e.g., latest thumbnail and PLY file).
-
createPickTicketShipmentEntry
abstract Result<ShipmentEntry> createPickTicketShipmentEntry(String shipmentId, String shipmentScanId, String jobId, String fileName)
Creates an entry linking a previously uploaded pick ticket to a specific shipment and scan.
-
processCloudDimensions
abstract Boolean processCloudDimensions(ByteArray snapshotZipData, String shipmentId, String shipmentScanId, Function1<String, Unit> progressCallback, SnapshotValidation validation)
Submits captured snapshot data to the cloud for volumetric dimensioning.
- Parameters:
snapshotZipData- The raw byte array of the captured frames.progressCallback- A listener to receive string-based status updates during the process.
-
uploadBarcodes
abstract Result<Shipment> uploadBarcodes(List<BaseBarcode> barcodeData, String shipmentId, String shipmentScanId, Function1<String, Unit> progressCallback)
Uploads detected barcode data and associates it with the specified scan.
-
uploadImages
abstract List<Result<ShipmentStorageEntry>> uploadImages(List<ByteArray> images, String shipmentId, String shipmentScanId, Function1<String, Unit> progressCallback)
Uploads a list of images as JPG entries for a specific scan.
-
downloadPLYFile
abstract Result<ByteArray> downloadPLYFile(String storagePath)
-
downloadImageFile
abstract Result<ByteArray> downloadImageFile(String storagePath)
-
downloadUrl
abstract Result<ByteArray> downloadUrl(String url)
Downloads the image bytes of a URL.
-
shareShipment
abstract Result<ShipmentSharing> shareShipment(String shipmentId, String recipientEmail, String expiration)
Shares a shipment with another user via email.
- Parameters:
recipientEmail- The email of the user to share with.expiration- Optional ISO-8601 timestamp for when access should expire.
-
uploadLogLines
abstract Result<String> uploadLogLines(List<LogEntry> logList)
Uploads SDK/Application logs to the Dockware server for troubleshooting.
-
clearShipments
abstract Unit clearShipments()
Resets the repository state. Stops all background polling and clears all local StateFlow caches.
-
getShipments
abstract StateFlow<List<Shipment>> getShipments()
A reactive list of all shipments owned by or directly assigned to the current user.
-
getSharedShipments
abstract StateFlow<List<Shipment>> getSharedShipments()
A reactive list of shipments that have been shared with the current user by others.
-
getShipmentScans
abstract StateFlow<Map<String, List<ShipmentScan>>> getShipmentScans()
Reactive lists of ShipmentScan objects mapped by shipment ID.
-
getShipmentEntries
abstract StateFlow<Map<String, List<ShipmentEntry>>> getShipmentEntries()
Reactive lists of ShipmentEntry objects mapped by shipment ID.
-
getShipmentTrees
abstract StateFlow<List<ShipmentTree>> getShipmentTrees()
A unified list of ShipmentTree objects representing the full hierarchy (shipment + recent scans + entries) for all available shipments.
-
-
-