ShipmentsRepository

Core 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.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val sharedShipments: StateFlow<List<Shipment>>
Link copied to clipboard
abstract val shipments: StateFlow<List<Shipment>>
Link copied to clipboard
abstract val shipmentTrees: StateFlow<List<ShipmentTree>>

Functions

Link copied to clipboard
abstract suspend fun archiveShipment(shipmentId: String): Result<Shipment>

Soft-deletes a shipment, moving it to the archive.

Link copied to clipboard
abstract suspend fun archiveShipments(shipmentIds: List<String>): Result<List<Shipment>>

Batch soft-deletes multiple shipments.

Link copied to clipboard
abstract suspend fun archiveShipmentScan(shipmentScanId: String): Result<ShipmentScan>

Deletes a specific scan record.

Link copied to clipboard
abstract fun clearShipments()
Link copied to clipboard
abstract suspend fun createPickTicketShipmentEntry(shipmentId: String, shipmentScanId: String, jobId: String, fileName: String): Result<ShipmentEntry>

Creates an entry linking a previously uploaded pick ticket to a specific shipment and scan.

Link copied to clipboard
abstract suspend fun createShipment(title: String, metadata: Map<String, Any>? = null): Result<Shipment>

Creates a new shipment.

Link copied to clipboard
abstract suspend fun createShipmentScan(shipmentId: String, title: String, dimensions: Dimensions?, weight: Float?, freightClass: String?, locationData: LocationData?, notes: String?, status: String?, scanType: ShipmentScanType = ShipmentScanType.DOCUMENT): Result<ShipmentScan>

Records a new scan event for a shipment.

Link copied to clipboard
abstract suspend fun fetchAllShipmentData(pollScansEvery: Long? = POLLING_INTERVAL_MS)

Triggers a full refresh of all shipment data, including scans and entries.

Link copied to clipboard
abstract suspend fun fetchMostRecentShipmentEntries(shipmentIds: List<String>): Result<Map<String, List<ShipmentEntry>>>

Fetches the most recent entries for a list of shipments (e.g., latest thumbnail and PLY file).

Link copied to clipboard
abstract suspend fun fetchShipmentAndScans(shipmentId: String): Result<Pair<Shipment, List<ShipmentScan>>>

Fetches both the shipment details and its scans in parallel.

Link copied to clipboard
abstract suspend fun fetchShipmentEntries(shipmentScanId: String): Result<List<ShipmentEntry>>

Fetches all entries (files, images, point clouds) attached to a specific scan.

Link copied to clipboard
abstract suspend fun fetchShipmentScans(shipmentId: String): Result<List<ShipmentScan>>

Fetches all scans associated with a specific shipment.

abstract suspend fun fetchShipmentScans(shipmentIds: List<String>): Result<Map<String, List<ShipmentScan>>>

Fetches scans for multiple shipments in a single request.

Link copied to clipboard
abstract suspend fun fetchShipmentTrees(pollScansEvery: Long? = POLLING_INTERVAL_MS): Result<ShipmentWithSharing>

Fetches the latest shipment hierarchy from the server.

Link copied to clipboard
abstract suspend fun processCloudDimensions(snapshotZipData: ByteArray, shipmentId: String, shipmentScanId: String, progressCallback: (String) -> Unit?, validationResult: SnapshotValidator.ValidationResult? = null): Boolean

Submits captured snapshot data to the cloud for volumetric dimensioning.

Link copied to clipboard
abstract suspend fun renameShipment(shipmentId: String, newTitle: String): Result<Shipment>

Updates the title of an existing shipment.

Link copied to clipboard
abstract suspend fun shareShipment(shipmentId: String, recipientEmail: String, expiration: String? = null): Result<ShipmentSharing>

Shares a shipment with another user via email.

Link copied to clipboard
abstract fun shipmentEntriesOf(shipmentId: String): StateFlow<List<ShipmentEntry>>

Provides a reactive stream of entries for a single shipment.

abstract fun shipmentEntriesOf(shipmentIds: Set<String>): StateFlow<List<List<ShipmentEntry>>>

Provides a reactive stream of entries (files/metadata) for a set of shipment IDs.

Link copied to clipboard
abstract fun shipmentScansOf(shipmentId: String): StateFlow<List<ShipmentScan>>

Provides a reactive stream of scans for a single shipment.

abstract fun shipmentScansOf(shipmentIds: Set<String>): StateFlow<List<List<ShipmentScan>>>

Provides a reactive stream of scans for a specific set of shipment IDs.

Link copied to clipboard
abstract fun shipmentTree(shipmentId: String): Flow<ShipmentTree>

Returns a reactive stream for a specific ShipmentTree.

Link copied to clipboard
abstract suspend fun unarchiveShipment(shipmentId: String): Result<Shipment>

Restores a soft-deleted shipment from the archive.

Link copied to clipboard
abstract suspend fun updateShipmentMetadata(shipmentId: String, metadata: Map<String, Any>): Result<Shipment>

Updates custom metadata for a shipment without overwriting existing fields.

Link copied to clipboard
abstract suspend fun updateShipmentScan(shipmentScanId: String, metadata: Map<String, Any>): Result<ShipmentScan>

Updates raw metadata for a specific scan.

Link copied to clipboard
abstract suspend fun updateShipmentScanManualDimensions(shipmentScanId: String, dimensions: Dimensions): Result<ShipmentScan>

Updates a scan with manually measured dimensions.

Link copied to clipboard
abstract suspend fun updateShipmentScanQualityApprovedByUser(scanId: String, approved: Boolean, currentMetadata: Map<String, Any>): Result<ShipmentScan>

Updates the quality approval status for a scan, usually triggered by manual user review.

Link copied to clipboard
abstract suspend fun updateShipmentScanType(scanId: String, scanType: ShipmentScanType): Result<ShipmentScan>

Changes the classification type of an existing scan.

Link copied to clipboard
abstract suspend fun updateShipmentScanUserDimensions(shipmentScanId: String, dimensions: Dimensions, newCenter: Vector3): Result<ShipmentScan>

Updates the bounding box/user-adjusted dimensions for a 3D scan.

Link copied to clipboard
abstract suspend fun updateShipmentScanWeight(shipmentScanId: String, weight: Float?): Result<ShipmentScan>

Updates the weight of the scanned object.

Link copied to clipboard
abstract suspend fun uploadBarcodes(barcodeData: List<BarcodeData>, shipmentId: String, shipmentScanId: String, progressCallback: (String) -> Unit?): Result<Shipment>

Uploads detected barcode data and associates it with the specified scan.

Link copied to clipboard
abstract suspend fun uploadImages(images: List<ByteArray>, shipmentId: String, shipmentScanId: String, progressCallback: (String) -> Unit?): List<Pair<StorageObject, ShipmentEntry>?>

Uploads a list of images as JPG entries for a specific scan.

Link copied to clipboard
abstract suspend fun uploadLogLines(logList: List<LogEntry>): Result<String>

Uploads SDK/Application logs to the Dockware server for troubleshooting.