iosMain.dev.gitlive.firebase.firestore.internal.NativeCollectionReferenceWrapper.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of firebase-firestore Show documentation
Show all versions of firebase-firestore Show documentation
The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the Firebase Android SDK Kotlin Extensions but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting iOS, Android or JS.
package dev.gitlive.firebase.firestore.internal
import dev.gitlive.firebase.firestore.NativeCollectionReference
import dev.gitlive.firebase.firestore.await
import dev.gitlive.firebase.internal.EncodedObject
import dev.gitlive.firebase.internal.ios
internal actual class NativeCollectionReferenceWrapper internal actual constructor(actual override val native: NativeCollectionReference) : NativeQueryWrapper(native) {
actual val path: String
get() = native.path
actual val document get() = NativeDocumentReference(native.documentWithAutoID())
actual val parent get() = native.parent?.let { NativeDocumentReference(it) }
actual fun document(documentPath: String) =
NativeDocumentReference(native.documentWithPath(documentPath))
actual suspend fun addEncoded(data: EncodedObject) =
NativeDocumentReference(await { native.addDocumentWithData(data.ios, it) })
}