MosaicRepository

Functions

Link copied to clipboard
abstract suspend fun deleteFile(fileName: String): Result<Unit>
Link copied to clipboard
abstract suspend fun deletePlainData(dataKey: String): Result<Unit>
Link copied to clipboard
abstract suspend fun deletePlainDataByIds(dataKeys: List<String>): Result<Unit>
Link copied to clipboard
abstract suspend fun deleteSegmentedData(segmentKey: String, dataKey: String): Result<Unit>
Link copied to clipboard
abstract suspend fun deleteSegmentedDataByIds(segmentKey: String, dataKeys: List<String>): Result<Unit>
Link copied to clipboard
abstract suspend fun downloadFile(url: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, targetFileName: String, mimeType: String?, onProgress: suspend (Float) -> Unit = {}, onDownloadFinished: suspend () -> Unit = {}, onDownloadFailure: suspend (Throwable) -> Unit = {}): Result<Unit>

Downloads a file into the device's public/general storage (system Downloads location). See dev.catbit.mosaic.core.data.schemas.event.events.networking.DownloadFileEventSchema for the full per-platform behavior contract.

Link copied to clipboard
abstract suspend fun downloadFileToDisk(url: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, targetFileName: String, onProgress: suspend (Float) -> Unit = {}, onDownloadFinished: suspend () -> Unit = {}, onDownloadFailure: suspend (Throwable) -> Unit = {}): Result<Unit>
Link copied to clipboard
abstract suspend fun downloadFileToMemory(url: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, onProgress: suspend (Float) -> Unit = {}, onDownloadFinished: suspend (ByteArray) -> Unit = {}, onDownloadFailure: suspend (Throwable) -> Unit = {}): Result<Unit>
Link copied to clipboard
abstract suspend fun dropCaches(dropScreensCache: Boolean, dropInitialGraphCache: Boolean, dropVersionCache: Boolean): Result<Unit>
Link copied to clipboard
abstract suspend fun fileExists(fileName: String): Result<Boolean>
Link copied to clipboard
abstract suspend fun getAllPlainData(): Result<Map<String, Any>>
Link copied to clipboard
abstract suspend fun getAllSegmentedData(segmentKey: String): Result<Map<String, Any>>
Link copied to clipboard
abstract suspend fun getFile(fileName: String): Result<ByteArray?>
Link copied to clipboard
abstract suspend fun getFilePlatformFile(fileName: String): Result<PlatformFile?>
Link copied to clipboard
abstract suspend fun getFileStreaming(fileName: String): Result<Flow<ByteArray>?>
Link copied to clipboard
abstract suspend fun getInitialGraph(): Result<GraphModel>
Link copied to clipboard
abstract suspend fun getPlainData(dataKey: String): Result<Any>
Link copied to clipboard
abstract suspend fun getPlainDataByIds(dataKeys: List<String>): Result<Map<String, Any>>
Link copied to clipboard
abstract suspend fun getScreen(screenId: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, timeoutMillis: Long? = null): Result<ScreenModel>
Link copied to clipboard
abstract suspend fun getSegmentedData(segmentKey: String, dataKey: String): Result<Any>
Link copied to clipboard
abstract suspend fun getSegmentedDataByIds(segmentKey: String, dataKeys: List<String>): Result<Map<String, Any>>
Link copied to clipboard
abstract suspend fun getVersion(): Result<Unit>

Checks the backend's cache-busting version against the locally stored one, wiping the graph/screens cache when the remote version is newer. Never blocks the caller for long (offline or any failure is captured in the returned Result rather than thrown).

Link copied to clipboard
abstract suspend fun saveFile(fileName: String, data: ByteArray): Result<Unit>
Link copied to clipboard
abstract suspend fun savePlainData(dataKey: String, data: Any): Result<Unit>
Link copied to clipboard
abstract suspend fun saveSegmentedData(segmentKey: String, dataKey: String, data: Any): Result<Unit>
Link copied to clipboard
abstract suspend fun sendHttpRequest(url: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, timeoutMillis: Long? = null): Result<HttpResponse>
Link copied to clipboard
abstract suspend fun uploadFile(url: String?, headers: Map<String, String>?, httpMethod: HttpMethod, contentType: String?, platformFile: PlatformFile, onProgress: suspend (Float) -> Unit = {}): Result<UploadResult>
Link copied to clipboard
abstract suspend fun wipePlainData(): Result<Unit>
Link copied to clipboard
abstract suspend fun wipeSegmentedData(segmentKey: String): Result<Unit>