// TODO: Consider names of GetDocumentSnapshotAsync/GetQuerySnapshotAsync. // Perhaps just SnapshotDocumentAsync and SnapshotQueryAsync? // Just using SnapshotAsync overloads feels like a bad idea as they do quite different things. /// <summary> /// Fetch a snapshot of the document specified by <paramref name="documentReference"/>, with respect to this transaction. /// This method cannot be called after any write operations have been created. /// </summary> /// <param name="documentReference">The document reference to fetch. Must not be null.</param> /// <param name="cancellationToken">A cancellation token to monitor for the asynchronous operation.</param> /// <returns>A snapshot of the given document with respect to this transaction.</returns> public Task <DocumentSnapshot> GetDocumentSnapshotAsync(DocumentReference documentReference, CancellationToken cancellationToken = default) { GaxPreconditions.CheckNotNull(documentReference, nameof(documentReference)); GaxPreconditions.CheckState(_writes.IsEmpty, "Firestore transactions require all reads to be executed before all writes."); CancellationToken effectiveToken = GetEffectiveCancellationToken(cancellationToken); return(documentReference.SnapshotAsync(TransactionId, effectiveToken)); }