AssetDataSource

internal class AssetDataSource(assetApi: AssetApi, assetDao: AssetDAO, selfUserId: UserId, assetMapper: AssetMapper = MapperProvider.assetMapper(), assetAuditLog: Lazy<AssetAuditFeatureHandler>, kaliumFileSystem: KaliumFileSystem) : AssetRepository

Constructors

Link copied to clipboard
constructor(assetApi: AssetApi, assetDao: AssetDAO, selfUserId: UserId, assetMapper: AssetMapper = MapperProvider.assetMapper(), assetAuditLog: Lazy<AssetAuditFeatureHandler>, kaliumFileSystem: KaliumFileSystem)

Functions

Link copied to clipboard
open suspend override fun deleteAsset(assetId: String, assetDomain: String?, assetToken: String?): Either<CoreFailure, Unit>

Method used to delete asset locally and externally

Link copied to clipboard
open suspend override fun deleteAssetLocally(assetId: String): Either<CoreFailure, Unit>

Method used to delete asset only locally

open suspend override fun deleteAssetLocally(assetId: String, assetDomain: String?): Either<CoreFailure, Unit>

Delete only the cached asset matching the normalized remote domain.

Link copied to clipboard
Link copied to clipboard
open suspend override fun downloadPublicAsset(assetId: String, assetDomain: String?): Either<CoreFailure, FetchedAssetData>

Method used to download and persist to local memory a public asset

Link copied to clipboard
open suspend override fun fetchDecodedAsset(assetId: String): Either<CoreFailure, Path>
Link copied to clipboard
open suspend override fun fetchPreviewAsset(preview: AssetContent.Preview): Either<CoreFailure, FetchedAssetData>

Fetches an optional preview with independent transfer, decoded-file and cached-file size limits.

Link copied to clipboard
open suspend override fun fetchPrivateDecodedAsset(assetId: String, assetDomain: String?, assetName: String, mimeType: String?, assetToken: String?, encryptionKey: AES256Key, assetSHA256Key: SHA256Key, downloadIfNeeded: Boolean = true): Either<CoreFailure, FetchedAssetData>

Method used to fetch the Path of a decoded private asset

Link copied to clipboard
open suspend override fun persistAsset(assetId: String, assetDomain: String?, decodedDataPath: Path, assetDataSize: Long, extension: String?): Either<CoreFailure, Path>

Method used to persist to local memory the decoded asset

Link copied to clipboard
open suspend override fun persistPreviewAsset(assetId: String, sourcePath: Path, assetDataSize: Long, extension: String?): Either<CoreFailure, Path>

Copies a caller-owned preview into the cache without ever deleting the source.

Link copied to clipboard
open suspend override fun uploadAndPersistPrivateAsset(mimeType: String, assetDataPath: Path, otrKey: AES256Key, extension: String?, conversationId: ConversationId? = null, filename: String? = null, filetype: String? = null, retainSource: Boolean = false): Either<CoreFailure, Pair<UploadedAssetId, SHA256Key>>

Method used to upload the encrypted data and persist to local memory the already decoded asset

Link copied to clipboard
open suspend override fun uploadAndPersistPublicAsset(mimeType: String, assetDataPath: Path, assetDataSize: Long, conversationId: ConversationId? = null, filename: String? = null, filetype: String? = null): Either<CoreFailure, UploadedAssetId>

Method used to upload and persist to local memory a public asset

Link copied to clipboard

Optional previews fail open; cancellation still propagates from repository calls.