diff --git a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt index 1d3a895d..883eca27 100644 --- a/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt +++ b/STCore/src/commonMain/kotlin/com/infomaniak/multiplatform_swisstransfer/managers/UploadManager.kt @@ -80,6 +80,26 @@ class UploadManager( return@withContext uploadController.getLastUpload() } + /** + * Retrieves an `UploadSession` by its UUID. + * + * @param uuid The UUID of the upload session to retrieve. + * + * @return The `UploadSession` with the specified UUID. + * + * @throws RealmException If an error occurs during database interaction. + * @throws CancellationException If the operation is cancelled. + * @throws NotFoundException If no upload session with the given UUID is found in the database. + */ + @Throws( + RealmException::class, + CancellationException::class, + NotFoundException::class, + ) + fun getUploadByUUID(uuid: String): UploadSession { + return uploadController.getUploadByUUID(uuid) ?: throw NotFoundException("No uploadSession found in DB") + } + /** * Retrieves the total number of uploads in the database. *