/// <summary>Snippet for BatchGetDocuments</summary>
        public async Task BatchGetDocuments()
        {
            // Snippet: BatchGetDocuments(BatchGetDocumentsRequest,CallSettings)
            // Create client
            FirestoreClient firestoreClient = FirestoreClient.Create();
            // Initialize request argument
            BatchGetDocumentsRequest request = new BatchGetDocumentsRequest
            {
                Database  = new DatabaseRootName("[PROJECT]", "[DATABASE]").ToString(),
                Documents = { },
            };

            // Make the request, returning a streaming response
            FirestoreClient.BatchGetDocumentsStream streamingResponse = firestoreClient.BatchGetDocuments(request);

            // Read streaming responses from server until complete
            IAsyncEnumerator <BatchGetDocumentsResponse> responseStream = streamingResponse.ResponseStream;

            while (await responseStream.MoveNext())
            {
                BatchGetDocumentsResponse response = responseStream.Current;
                // Do something with streamed response
            }
            // The response stream has completed
            // End snippet
        }
Ejemplo n.º 2
0
        /// <summary>Snippet for BatchGetDocuments</summary>
        public async Task BatchGetDocumentsRequestObject()
        {
            // Snippet: BatchGetDocuments(BatchGetDocumentsRequest, CallSettings)
            // Create client
            FirestoreClient firestoreClient = FirestoreClient.Create();
            // Initialize request argument(s)
            BatchGetDocumentsRequest request = new BatchGetDocumentsRequest
            {
                Database    = "",
                Documents   = { "", },
                Mask        = new DocumentMask(),
                Transaction = ByteString.Empty,
            };

            // Make the request, returning a streaming response
            FirestoreClient.BatchGetDocumentsStream response = firestoreClient.BatchGetDocuments(request);

            // Read streaming responses from server until complete
            // Note that C# 8 code can use await foreach
            AsyncResponseStream <BatchGetDocumentsResponse> responseStream = response.GetResponseStream();

            while (await responseStream.MoveNextAsync())
            {
                BatchGetDocumentsResponse responseItem = responseStream.Current;
                // Do something with streamed response
            }
            // The response stream has completed
            // End snippet
        }