use of com.google.cloud.firestore.v1.FirestoreClient.ListDocumentsPagedResponse in project beam by apache.
the class FirestoreTestingHelper method listDocumentIds.
Stream<String> listDocumentIds(String collectionPath) {
int index = collectionPath.lastIndexOf('/');
String parent = collectionPath.substring(0, index);
String collectionId = collectionPath.substring(index + 1);
ListDocumentsRequest ldr = ListDocumentsRequest.newBuilder().setParent(parent).setCollectionId(collectionId).setShowMissing(true).build();
// LOGGER.debug("ldr = {}", ldr);
ListDocumentsPagedResponse response = rpc.listDocumentsPagedCallable().call(ldr);
return StreamSupport.stream(response.iteratePages().spliterator(), false).flatMap(page -> page.getResponse().getDocumentsList().stream()).map(Document::getName).filter(s -> !s.isEmpty());
}
Aggregations