MosaicNetwork

interface MosaicNetwork

Inheritors

Functions

Link copied to clipboard
abstract suspend fun downloadFile(url: String, headers: Map<String, String>? = null, body: Any?, httpMethod: HttpMethod, targetFileName: String, mimeType: String? = null, 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). Behavior is platform-specific — see dev.catbit.mosaic.core.data.schemas.event.events.networking.DownloadFileEventSchema.

Link copied to clipboard
abstract suspend fun downloadFileToDisk(url: String, headers: Map<String, String>? = null, body: Any?, httpMethod: HttpMethod, targetFileName: String, onProgress: suspend (Float) -> Unit = {}, onDownloadFinished: suspend () -> Unit = {}, onDownloadFailure: suspend (Throwable) -> Unit = {}): Result<Unit>

Streams the response body straight to targetFileName, without ever holding the full file in memory.

Link copied to clipboard
abstract suspend fun downloadFileToMemory(url: String, headers: Map<String, String>? = null, 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 getInitialGraph(): Result<GraphResponse>
Link copied to clipboard
abstract suspend fun getScreen(screenId: String, headers: Map<String, String>?, body: Any?, httpMethod: HttpMethod, timeoutMillis: Long? = null): Result<ScreenResponse>
Link copied to clipboard
abstract suspend fun getVersion(): Result<VersionResponse>

Short-timeout version check meant to run before getInitialGraph at startup without blocking it.

Link copied to clipboard
abstract suspend fun hasInternetConnection(): Boolean

Probes whether the device currently has an active internet connection by issuing a lightweight GET to a captive-portal-style endpoint. Any exception (no connection, DNS failure, timeout) is treated as "no connection" rather than propagated.

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