SyncApiClient

interface SyncApiClient : EventEmitter

Functions

Link copied to clipboard
abstract suspend fun cancel(wait: Boolean = false)
Link copied to clipboard
abstract suspend fun emitEvent(event: Event<*>)
Link copied to clipboard
abstract suspend fun start(filter: String? = null, setPresence: Presence? = null, currentBatchToken: MutableStateFlow<String?> = MutableStateFlow(null), timeout: Long = 30000, withTransaction: suspend (block: suspend () -> Unit) -> Unit = { it() }, asUserId: UserId? = null, wait: Boolean = false, scope: CoroutineScope)
Link copied to clipboard
abstract suspend fun <T> startOnce(filter: String? = null, setPresence: Presence? = null, currentBatchToken: MutableStateFlow<String?> = MutableStateFlow(null), timeout: Long = 0, withTransaction: suspend (block: suspend () -> Unit) -> Unit = { it() }, asUserId: UserId? = null, runOnce: suspend (Sync.Response) -> T): Result<T>
Link copied to clipboard
abstract suspend fun stop(wait: Boolean = false)
Link copied to clipboard
abstract fun <T : EventContent> subscribe(clazz: KClass<T>, subscriber: suspend (Event<T>) -> Unit)
Link copied to clipboard
Link copied to clipboard
abstract fun subscribeAllEvents(subscriber: suspend (Event<EventContent>) -> Unit)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract suspend fun sync(filter: String? = null, since: String? = null, fullState: Boolean = false, setPresence: Presence? = null, timeout: Long = 0, asUserId: UserId? = null): Result<Sync.Response>

This is the plain sync request. If you want to subscribe to events and ore, use start or startOnce.

Link copied to clipboard
abstract fun <T : EventContent> unsubscribe(clazz: KClass<T>, subscriber: suspend (Event<T>) -> Unit)
Link copied to clipboard
abstract fun unsubscribeAllEvents(subscriber: suspend (Event<EventContent>) -> Unit)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard
abstract val currentSyncState: StateFlow<SyncState>

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
suspend fun SyncApiClient.startOnce(filter: String? = null, setPresence: Presence? = null, currentBatchToken: MutableStateFlow<String?> = MutableStateFlow(null), timeout: Long = 0, withTransaction: suspend (block: suspend () -> Unit) -> Unit = { it() }, asUserId: UserId? = null): Result<Unit>