Skip to content

Commit 0563844

Browse files
committed
add DocumentReference.path
1 parent 977268a commit 0563844

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

firebase-firestore/src/androidMain/kotlin/dev/teamhub/firebase/firestore/firestore.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ actual suspend fun DocumentReference.awaitDelete() = delete().await().run { Unit
8484
actual val DocumentReference.id: String
8585
get() = id
8686

87+
actual val DocumentReference.path: String
88+
get() = path
89+
8790
actual typealias WriteBatch = com.google.firebase.firestore.WriteBatch
8891

8992
actual suspend fun WriteBatch.awaitCommit() = commit().await().run { Unit }

firebase-firestore/src/commonMain/kotlin/dev/teamhub/firebase/firestore/firestore.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ expect fun DocumentReference.addSnapshotListener(listener: EventListener<Documen
7777

7878
expect val DocumentReference.id: String
7979

80+
expect val DocumentReference.path: String
81+
8082
expect fun DocumentReference.addSnapshotListener(listener: (snapshot: DocumentSnapshot?, exception: FirebaseFirestoreException?) -> Unit): ListenerRegistration
8183

8284
expect suspend fun DocumentReference.awaitGet(): DocumentSnapshot

firebase-firestore/src/jsMain/kotlin/dev/teamhub/firebase/firestore/externals.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ external object firebase {
5555

5656
open class DocumentReference {
5757
val id: String
58+
val path: String
5859

5960
fun get(options: Any? = definedExternally): Promise<DocumentSnapshot>
6061
fun set(data: Any, options: Any? = definedExternally): Promise<Unit>

firebase-firestore/src/jsMain/kotlin/dev/teamhub/firebase/firestore/firestore.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ actual fun mergeSetOptions() = rethrow { NewOptions() }
132132
actual val DocumentReference.id: String
133133
get() = rethrow { id }
134134

135+
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
136+
actual val DocumentReference.path: String
137+
get() = rethrow { path }
138+
135139
actual fun DocumentReference.addSnapshotListener(listener: (snapshot: DocumentSnapshot?, exception: FirebaseFirestoreException?) -> Unit) = rethrow {
136140
onSnapshot({ listener(it, undefined) }, { listener(undefined, FirebaseFirestoreException(it.message as String, FirestoreExceptionCode.UNKNOWN)) })
137141
.also { it.asDynamic().remove = { it() } }

0 commit comments

Comments
 (0)