-
Notifications
You must be signed in to change notification settings - Fork 624
feat(rtdb, firestore): create values() and dataObjects() Flows #4804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Javadoc Changes:--- /Users/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/database/ktx/package-summary.html 2023-04-03 23:40:05.000000000 +0000
+++ /Users/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/database/ktx/package-summary.html 2023-04-03 23:35:47.000000000 +0000
@@ -90,6 +90,13 @@
<p>Returns the content of the MutableData converted to a POJO.</p>
</td>
</tr>
+ <tr>
+ <td><code>inline <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><T?></code></td>
+ <td>
+ <div><code><T : <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>> <a href="/docs/reference/kotlin/com/google/firebase/database/Query.html">Query</a>.<a href="/docs/reference/kotlin/com/google/firebase/database/ktx/package-summary.html#(com.google.firebase.database.Query).values()">values</a>()</code></div>
+ <p>Starts listening to this query and emits its values converted to a POJO via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
+ </td>
+ </tr>
</tbody>
</table>
</div>
@@ -105,7 +112,7 @@
<td><code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><<a href="/docs/reference/kotlin/com/google/firebase/database/ktx/ChildEvent.html">ChildEvent</a>></code></td>
<td>
<div><code><a href="/docs/reference/kotlin/com/google/firebase/database/Query.html">Query</a>.<a href="/docs/reference/kotlin/com/google/firebase/database/ktx/package-summary.html#(com.google.firebase.database.Query).childEvents()">childEvents</a></code></div>
- <p>Starts listening to this query's child events and emits its values via a Flow.</p>
+ <p>Starts listening to this query's child events and emits its values via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
</td>
</tr>
<tr>
@@ -119,7 +126,7 @@
<td><code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><<a href="/docs/reference/kotlin/com/google/firebase/database/DataSnapshot.html">DataSnapshot</a>></code></td>
<td>
<div><code><a href="/docs/reference/kotlin/com/google/firebase/database/Query.html">Query</a>.<a href="/docs/reference/kotlin/com/google/firebase/database/ktx/package-summary.html#(com.google.firebase.database.Query).snapshots()">snapshots</a></code></div>
- <p>Starts listening to this query and emits its values via a Flow.</p>
+ <p>Starts listening to this query and emits its values via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
</td>
</tr>
</tbody>
@@ -153,11 +160,24 @@
<p>Returns the content of the MutableData converted to a POJO.</p>
<p>Supports generics like List<> or Map<>. Use @JvmSuppressWildcards to force the compiler to use the type <code>T</code>, and not <code>? extends T</code>.</p>
</div>
+ <div class="api-item"><a name="-com.google.firebase.database.Query-.values--"></a><a name="values"></a>
+ <h3 class="api-name" id="(com.google.firebase.database.Query).values()">values</h3>
+ <pre class="api-signature no-pretty-print">inline fun <T : <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>> <a href="/docs/reference/kotlin/com/google/firebase/database/Query.html">Query</a>.<a href="/docs/reference/kotlin/com/google/firebase/database/ktx/package-summary.html#(com.google.firebase.database.Query).values()">values</a>(): <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><T?></pre>
+ <p>Starts listening to this query and emits its values converted to a POJO via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
+ <ul>
+ <li>
+ <p>When the returned flow starts being collected, a <code><a href="/docs/reference/kotlin/com/google/firebase/database/ValueEventListener.html">ValueEventListener</a></code> will be attached.</p>
+ </li>
+ <li>
+ <p>When the flow completes, the listener will be removed.</p>
+ </li>
+ </ul>
+ </div>
<h2>Extension properties</h2>
<div class="api-item"><a name="(com.google.firebase.database.Query).getChildEvents()"></a><a name="(com.google.firebase.database.Query).setChildEvents()"></a><a name="-com.google.firebase.database.Query-.getChildEvents--"></a><a name="-com.google.firebase.database.Query-.setChildEvents--"></a>
<h3 class="api-name" id="(com.google.firebase.database.Query).childEvents()">childEvents</h3>
<pre class="api-signature no-pretty-print">val <a href="/docs/reference/kotlin/com/google/firebase/database/Query.html">Query</a>.<a href="/docs/reference/kotlin/com/google/firebase/database/ktx/package-summary.html#(com.google.firebase.database.Query).childEvents()">childEvents</a>: <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><<a href="/docs/reference/kotlin/com/google/firebase/database/ktx/ChildEvent.html">ChildEvent</a>></pre>
- <p>Starts listening to this query's child events and emits its values via a Flow.</p>
+ <p>Starts listening to this query's child events and emits its values via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
<ul>
<li>
<p>When the returned flow starts being collected, a <code><a href="/docs/reference/kotlin/com/google/firebase/database/ChildEventListener.html">ChildEventListener</a></code> will be attached.</p>
@@ -175,7 +195,7 @@
<div class="api-item"><a name="(com.google.firebase.database.Query).getSnapshots()"></a><a name="(com.google.firebase.database.Query).setSnapshots()"></a><a name="-com.google.firebase.database.Query-.getSnapshots--"></a><a name="-com.google.firebase.database.Query-.setSnapshots--"></a>
<h3 class="api-name" id="(com.google.firebase.database.Query).snapshots()">snapshots</h3>
<pre class="api-signature no-pretty-print">val <a href="/docs/reference/kotlin/com/google/firebase/database/Query.html">Query</a>.<a href="/docs/reference/kotlin/com/google/firebase/database/ktx/package-summary.html#(com.google.firebase.database.Query).snapshots()">snapshots</a>: <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><<a href="/docs/reference/kotlin/com/google/firebase/database/DataSnapshot.html">DataSnapshot</a>></pre>
- <p>Starts listening to this query and emits its values via a Flow.</p>
+ <p>Starts listening to this query and emits its values via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
<ul>
<li>
<p>When the returned flow starts being collected, a <code><a href="/docs/reference/kotlin/com/google/firebase/database/ValueEventListener.html">ValueEventListener</a></code> will be attached.</p> --- /Users/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/firestore/ktx/package-summary.html 2023-04-03 23:40:17.000000000 +0000
+++ /Users/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/firestore/ktx/package-summary.html 2023-04-03 23:35:53.000000000 +0000
@@ -33,6 +33,20 @@
</colgroup>
<tbody class="list">
<tr>
+ <td><code>inline <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><T?></code></td>
+ <td>
+ <div><code><T : <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>> <a href="/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference.html">DocumentReference</a>.<a href="/docs/reference/kotlin/com/google/firebase/firestore/ktx/package-summary.html#(com.google.firebase.firestore.DocumentReference).dataObjects(com.google.firebase.firestore.MetadataChanges)">dataObjects</a>(metadataChanges: <a href="/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges.html">MetadataChanges</a>)</code></div>
+ <p>Starts listening to the document referenced by this <code>DocumentReference</code> with the given options and emits its values converted to a POJO via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
+ </td>
+ </tr>
+ <tr>
+ <td><code>inline <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html">List</a><T>></code></td>
+ <td>
+ <div><code><T : <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>> <a href="/docs/reference/kotlin/com/google/firebase/firestore/Query.html">Query</a>.<a href="/docs/reference/kotlin/com/google/firebase/firestore/ktx/package-summary.html#(com.google.firebase.firestore.Query).dataObjects(com.google.firebase.firestore.MetadataChanges)">dataObjects</a>(metadataChanges: <a href="/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges.html">MetadataChanges</a>)</code></div>
+ <p>Starts listening to this query with the given options and emits its values converted to a POJO via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
+ </td>
+ </tr>
+ <tr>
<td><code><a href="/docs/reference/kotlin/com/google/firebase/firestore/FirebaseFirestore.html">FirebaseFirestore</a></code></td>
<td>
<div><code><a href="/docs/reference/kotlin/com/google/firebase/ktx/Firebase.html">Firebase</a>.<a href="/docs/reference/kotlin/com/google/firebase/firestore/ktx/package-summary.html#(com.google.firebase.ktx.Firebase).firestore(com.google.firebase.FirebaseApp)">firestore</a>(app: <a href="/docs/reference/kotlin/com/google/firebase/FirebaseApp.html">FirebaseApp</a>)</code></div>
@@ -151,6 +165,86 @@
<p>Returns a <code><a href="/docs/reference/kotlin/com/google/firebase/firestore/FirebaseFirestoreSettings.html">FirebaseFirestoreSettings</a></code> instance initialized using the <code><a href="/docs/reference/kotlin/com/google/firebase/firestore/ktx/package-summary.html#firestoreSettings(kotlin.Function1)">init</a></code> function.</p>
</div>
<h2>Extension functions</h2>
+ <div class="api-item"><a name="-com.google.firebase.firestore.DocumentReference-.dataObjects-com.google.firebase.firestore.MetadataChanges-"></a><a name="dataobjects"></a>
+ <h3 class="api-name" id="(com.google.firebase.firestore.DocumentReference).dataObjects(com.google.firebase.firestore.MetadataChanges)">dataObjects</h3>
+ <pre class="api-signature no-pretty-print">inline fun <T : <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>> <a href="/docs/reference/kotlin/com/google/firebase/firestore/DocumentReference.html">DocumentReference</a>.<a href="/docs/reference/kotlin/com/google/firebase/firestore/ktx/package-summary.html#(com.google.firebase.firestore.DocumentReference).dataObjects(com.google.firebase.firestore.MetadataChanges)">dataObjects</a>(<br> metadataChanges: <a href="/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges.html">MetadataChanges</a> = MetadataChanges.EXCLUDE<br>): <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><T?></pre>
+ <p>Starts listening to the document referenced by this <code>DocumentReference</code> with the given options and emits its values converted to a POJO via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
+ <ul>
+ <li>
+ <p>When the returned flow starts being collected, an EventListener will be attached.</p>
+ </li>
+ <li>
+ <p>When the flow completes, the listener will be removed.</p>
+ </li>
+ </ul>
+ <div class="devsite-table-wrapper">
+ <table class="responsive">
+ <colgroup>
+ <col width="40%">
+ <col>
+ </colgroup>
+ <thead>
+ <tr>
+ <th colspan="100%">Parameters</th>
+ </tr>
+ </thead>
+ <tbody class="list">
+ <tr>
+ <td><code><T : <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>></code></td>
+ <td>
+ <p>The type of the object to convert to.</p>
+ </td>
+ </tr>
+ <tr>
+ <td><code>metadataChanges: <a href="/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges.html">MetadataChanges</a> = MetadataChanges.EXCLUDE</code></td>
+ <td>
+ <p>controls metadata-only changes. Default: <code><a href="/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges.EXCLUDE.html">MetadataChanges.EXCLUDE</a></code></p>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <div class="api-item"><a name="-com.google.firebase.firestore.Query-.dataObjects-com.google.firebase.firestore.MetadataChanges-"></a><a name="dataobjects"></a>
+ <h3 class="api-name" id="(com.google.firebase.firestore.Query).dataObjects(com.google.firebase.firestore.MetadataChanges)">dataObjects</h3>
+ <pre class="api-signature no-pretty-print">inline fun <T : <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>> <a href="/docs/reference/kotlin/com/google/firebase/firestore/Query.html">Query</a>.<a href="/docs/reference/kotlin/com/google/firebase/firestore/ktx/package-summary.html#(com.google.firebase.firestore.Query).dataObjects(com.google.firebase.firestore.MetadataChanges)">dataObjects</a>(<br> metadataChanges: <a href="/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges.html">MetadataChanges</a> = MetadataChanges.EXCLUDE<br>): <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a><<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html">List</a><T>></pre>
+ <p>Starts listening to this query with the given options and emits its values converted to a POJO via a <code><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code>.</p>
+ <ul>
+ <li>
+ <p>When the returned flow starts being collected, an EventListener will be attached.</p>
+ </li>
+ <li>
+ <p>When the flow completes, the listener will be removed.</p>
+ </li>
+ </ul>
+ <div class="devsite-table-wrapper">
+ <table class="responsive">
+ <colgroup>
+ <col width="40%">
+ <col>
+ </colgroup>
+ <thead>
+ <tr>
+ <th colspan="100%">Parameters</th>
+ </tr>
+ </thead>
+ <tbody class="list">
+ <tr>
+ <td><code><T : <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>></code></td>
+ <td>
+ <p>The type of the object to convert to.</p>
+ </td>
+ </tr>
+ <tr>
+ <td><code>metadataChanges: <a href="/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges.html">MetadataChanges</a> = MetadataChanges.EXCLUDE</code></td>
+ <td>
+ <p>controls metadata-only changes. Default: <code><a href="/docs/reference/kotlin/com/google/firebase/firestore/MetadataChanges.EXCLUDE.html">MetadataChanges.EXCLUDE</a></code></p>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
<div class="api-item"><a name="-com.google.firebase.ktx.Firebase-.firestore-com.google.firebase.FirebaseApp-"></a><a name="firestore"></a>
<h3 class="api-name" id="(com.google.firebase.ktx.Firebase).firestore(com.google.firebase.FirebaseApp)">firestore</h3>
<pre class="api-signature no-pretty-print">fun <a href="/docs/reference/kotlin/com/google/firebase/ktx/Firebase.html">Firebase</a>.<a href="/docs/reference/kotlin/com/google/firebase/firestore/ktx/package-summary.html#(com.google.firebase.ktx.Firebase).firestore(com.google.firebase.FirebaseApp)">firestore</a>(app: <a href="/docs/reference/kotlin/com/google/firebase/FirebaseApp.html">FirebaseApp</a>): <a href="/docs/reference/kotlin/com/google/firebase/firestore/FirebaseFirestore.html">FirebaseFirestore</a></pre> |
Coverage Report 1Affected Products
Test Logs |
The public api surface has changed for the subproject firebase-firestore_ktx: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
Size Report 1Affected Products
Test Logs |
Startup Time Report 1Note: Layout is sometimes suboptimal due to limited formatting support on GitHub. Please check this report on GCS. Notes
Startup Times
|
@rlazo I updated this PR to make sure the Firestore Changelog matches the current Release Notes. Can you please take a look at the changes? |
LGTM. I've sync'd the release notes of several SDKs in #4844 It should be fine, but please double check there. |
@rlazo Thanks! Just checked and it seems like Firestore's changelog is unchanged there. I'll merge this one |
This PR should add the database Flows approved in go/kotlin-flows-firebase-android-addendum