diff --git a/firestore/pom.xml b/firestore/pom.xml
index e5a0c0576ea..8eeb73aba0a 100644
--- a/firestore/pom.xml
+++ b/firestore/pom.xml
@@ -45,7 +45,7 @@
com.google.cloud
google-cloud-firestore
- 0.32.0-beta
+ 0.33.0-beta
diff --git a/firestore/src/main/java/com/example/firestore/Quickstart.java b/firestore/src/main/java/com/example/firestore/Quickstart.java
index 06316a99155..dd7091b0b68 100644
--- a/firestore/src/main/java/com/example/firestore/Quickstart.java
+++ b/firestore/src/main/java/com/example/firestore/Quickstart.java
@@ -18,15 +18,14 @@
import com.google.api.core.ApiFuture;
import com.google.cloud.firestore.DocumentReference;
-import com.google.cloud.firestore.DocumentSnapshot;
// [START fs_include_dependencies]
import com.google.cloud.firestore.Firestore;
import com.google.cloud.firestore.FirestoreOptions;
// [END fs_include_dependencies]
+import com.google.cloud.firestore.QueryDocumentSnapshot;
import com.google.cloud.firestore.QuerySnapshot;
import com.google.cloud.firestore.WriteResult;
import com.google.common.collect.ImmutableMap;
-
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -126,8 +125,8 @@ void runAQuery() throws Exception {
// ...
// query.get() blocks on response
QuerySnapshot querySnapshot = query.get();
- List documents = querySnapshot.getDocuments();
- for (DocumentSnapshot document : documents) {
+ List documents = querySnapshot.getDocuments();
+ for (QueryDocumentSnapshot document : documents) {
System.out.println("User: " + document.getId());
System.out.println("First: " + document.getString("first"));
if (document.contains("middle")) {
@@ -146,8 +145,8 @@ void retrieveAllDocuments() throws Exception {
// ...
// query.get() blocks on response
QuerySnapshot querySnapshot = query.get();
- List documents = querySnapshot.getDocuments();
- for (DocumentSnapshot document : documents) {
+ List documents = querySnapshot.getDocuments();
+ for (QueryDocumentSnapshot document : documents) {
System.out.println("User: " + document.getId());
System.out.println("First: " + document.getString("first"));
if (document.contains("middle")) {
diff --git a/firestore/src/main/java/com/example/firestore/snippets/ListenDataSnippets.java b/firestore/src/main/java/com/example/firestore/snippets/ListenDataSnippets.java
new file mode 100644
index 00000000000..dc4958737f2
--- /dev/null
+++ b/firestore/src/main/java/com/example/firestore/snippets/ListenDataSnippets.java
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.firestore.snippets;
+
+import com.google.api.core.SettableApiFuture;
+import com.google.cloud.firestore.DocumentChange;
+import com.google.cloud.firestore.DocumentChange.Type;
+import com.google.cloud.firestore.DocumentReference;
+import com.google.cloud.firestore.DocumentSnapshot;
+import com.google.cloud.firestore.EventListener;
+import com.google.cloud.firestore.Firestore;
+import com.google.cloud.firestore.FirestoreException;
+import com.google.cloud.firestore.ListenerRegistration;
+import com.google.cloud.firestore.Query;
+import com.google.cloud.firestore.QuerySnapshot;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Nullable;
+
+/**
+ * Snippets to demonstrate Firestore 'listen' operations.
+ */
+@SuppressWarnings("Convert2Lambda")
+public class ListenDataSnippets {
+
+ private static final long TIMEOUT_SECONDS = 5;
+
+ private final Firestore db;
+
+ ListenDataSnippets(Firestore db) {
+ this.db = db;
+ }
+
+ /**
+ * Listen to a single document, returning data after the first snapshot.
+ */
+ Map listenToDocument() throws Exception {
+ final SettableApiFuture