commonMain.net.folivo.trixnity.client.utils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trixnity-client-jvm Show documentation
Show all versions of trixnity-client-jvm Show documentation
Multiplatform Kotlin SDK for matrix-protocol
package net.folivo.trixnity.client
import io.ktor.http.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.*
import net.folivo.trixnity.client.store.Room
import net.folivo.trixnity.client.store.previousRoomId
import net.folivo.trixnity.core.model.RoomId
import net.folivo.trixnity.core.model.events.m.room.Membership
import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds
fun String.toMxcUri(): Url =
Url(this).also { require(it.protocol.name == "mxc") { "uri protocol was not mxc" } }
/**
* A change of the outer flow results in new collect of the inner flows. Because this is an expensive operation,
* the outer flow is throttled by default.
*/
@OptIn(ExperimentalCoroutinesApi::class)
fun Flow