Class FirestoreClientImpl (2.3.0)

public sealed class FirestoreClientImpl : FirestoreClient

Firestore client wrapper implementation, for convenient use.

Inheritance

Object > FirestoreClient > FirestoreClientImpl

Namespace

Google.Cloud.Firestore.V1

Assembly

Google.Cloud.Firestore.V1.dll

Remarks

The Cloud Firestore service.

Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL document database that simplifies storing, syncing, and querying data for your mobile, web, and IoT apps at global scale. Its client libraries provide live synchronization and offline support, while its security features and integrations with Firebase and Google Cloud Platform (GCP) accelerate building truly serverless apps.

Constructors

FirestoreClientImpl(Firestore.FirestoreClient, FirestoreSettings)

public FirestoreClientImpl(Firestore.FirestoreClient grpcClient, FirestoreSettings settings)

Constructs a client wrapper for the Firestore service, with the specified gRPC client and settings.

Parameters
NameDescription
grpcClientFirestore.FirestoreClient

The underlying gRPC client.

settingsFirestoreSettings

The base FirestoreSettings used within this client.

Fields

ResourcePrefixHeader

public const string ResourcePrefixHeader = "google-cloud-resource-prefix"

The name of the header used for efficiently routing requests.

Field Value
TypeDescription
String
Remarks

This should be set to the database resource name ("projects/{projectId}/databases/{databaseId}") for any RPC. For non-streaming calls, FirestoreClientImpl performs this automatically. This cannot be performed automatically for streaming calls due to the separation between initializing the stream and sending requests, so client code should set the value in a CallSettings. Typically this is performed with either the FromHeader(string, string) factory method or the WithHeader(CallSettings, string, string) extension method.

Properties

GrpcClient

public override Firestore.FirestoreClient GrpcClient { get; }

The underlying gRPC Firestore client

Property Value
TypeDescription
Firestore.FirestoreClient
Overrides

Methods

BatchGetDocuments(BatchGetDocumentsRequest, CallSettings)

public override FirestoreClient.BatchGetDocumentsStream BatchGetDocuments(BatchGetDocumentsRequest request, CallSettings callSettings = null)

Gets multiple documents.

Documents returned by this method are not guaranteed to be returned in the same order that they were requested.

Parameters
NameDescription
requestBatchGetDocumentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
FirestoreClient.BatchGetDocumentsStream

The server stream.

Overrides

BatchWrite(BatchWriteRequest, CallSettings)

public override BatchWriteResponse BatchWrite(BatchWriteRequest request, CallSettings callSettings = null)

Applies a batch of write operations.

The BatchWrite method does not apply the write operations atomically and can apply them out of order. Method does not allow more than one write per document. Each write succeeds or fails independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the success status of each write.

If you require an atomically applied set of writes, use [Commit][google.firestore.v1.Firestore.Commit] instead.

Parameters
NameDescription
requestBatchWriteRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BatchWriteResponse

The RPC response.

Overrides

BatchWriteAsync(BatchWriteRequest, CallSettings)

public override Task<BatchWriteResponse> BatchWriteAsync(BatchWriteRequest request, CallSettings callSettings = null)

Applies a batch of write operations.

The BatchWrite method does not apply the write operations atomically and can apply them out of order. Method does not allow more than one write per document. Each write succeeds or fails independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the success status of each write.

If you require an atomically applied set of writes, use [Commit][google.firestore.v1.Firestore.Commit] instead.

Parameters
NameDescription
requestBatchWriteRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<BatchWriteResponse>

A Task containing the RPC response.

Overrides

BeginTransaction(BeginTransactionRequest, CallSettings)

public override BeginTransactionResponse BeginTransaction(BeginTransactionRequest request, CallSettings callSettings = null)

Starts a new transaction.

Parameters
NameDescription
requestBeginTransactionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BeginTransactionResponse

The RPC response.

Overrides

BeginTransactionAsync(BeginTransactionRequest, CallSettings)

public override Task<BeginTransactionResponse> BeginTransactionAsync(BeginTransactionRequest request, CallSettings callSettings = null)

Starts a new transaction.

Parameters
NameDescription
requestBeginTransactionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<BeginTransactionResponse>

A Task containing the RPC response.

Overrides

Commit(CommitRequest, CallSettings)

public override CommitResponse Commit(CommitRequest request, CallSettings callSettings = null)

Commits a transaction, while optionally updating documents.

Parameters
NameDescription
requestCommitRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CommitResponse

The RPC response.

Overrides

CommitAsync(CommitRequest, CallSettings)

public override Task<CommitResponse> CommitAsync(CommitRequest request, CallSettings callSettings = null)

Commits a transaction, while optionally updating documents.

Parameters
NameDescription
requestCommitRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CommitResponse>

A Task containing the RPC response.

Overrides

CreateDocument(CreateDocumentRequest, CallSettings)

public override Document CreateDocument(CreateDocumentRequest request, CallSettings callSettings = null)

Creates a new document.

Parameters
NameDescription
requestCreateDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Document

The RPC response.

Overrides

CreateDocumentAsync(CreateDocumentRequest, CallSettings)

public override Task<Document> CreateDocumentAsync(CreateDocumentRequest request, CallSettings callSettings = null)

Creates a new document.

Parameters
NameDescription
requestCreateDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Document>

A Task containing the RPC response.

Overrides

DeleteDocument(DeleteDocumentRequest, CallSettings)

public override void DeleteDocument(DeleteDocumentRequest request, CallSettings callSettings = null)

Deletes a document.

Parameters
NameDescription
requestDeleteDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Overrides

DeleteDocumentAsync(DeleteDocumentRequest, CallSettings)

public override Task DeleteDocumentAsync(DeleteDocumentRequest request, CallSettings callSettings = null)

Deletes a document.

Parameters
NameDescription
requestDeleteDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Overrides

GetDocument(GetDocumentRequest, CallSettings)

public override Document GetDocument(GetDocumentRequest request, CallSettings callSettings = null)

Gets a single document.

Parameters
NameDescription
requestGetDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Document

The RPC response.

Overrides

GetDocumentAsync(GetDocumentRequest, CallSettings)

public override Task<Document> GetDocumentAsync(GetDocumentRequest request, CallSettings callSettings = null)

Gets a single document.

Parameters
NameDescription
requestGetDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Document>

A Task containing the RPC response.

Overrides

ListCollectionIds(ListCollectionIdsRequest, CallSettings)

public override PagedEnumerable<ListCollectionIdsResponse, string> ListCollectionIds(ListCollectionIdsRequest request, CallSettings callSettings = null)

Lists all the collection IDs underneath a document.

Parameters
NameDescription
requestListCollectionIdsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListCollectionIdsResponse, String>

A pageable sequence of String resources.

Overrides

ListCollectionIdsAsync(ListCollectionIdsRequest, CallSettings)

public override PagedAsyncEnumerable<ListCollectionIdsResponse, string> ListCollectionIdsAsync(ListCollectionIdsRequest request, CallSettings callSettings = null)

Lists all the collection IDs underneath a document.

Parameters
NameDescription
requestListCollectionIdsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListCollectionIdsResponse, String>

A pageable asynchronous sequence of String resources.

Overrides

ListDocuments(ListDocumentsRequest, CallSettings)

public override PagedEnumerable<ListDocumentsResponse, Document> ListDocuments(ListDocumentsRequest request, CallSettings callSettings = null)

Lists documents.

Parameters
NameDescription
requestListDocumentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListDocumentsResponse, Document>

A pageable sequence of Document resources.

Overrides

ListDocumentsAsync(ListDocumentsRequest, CallSettings)

public override PagedAsyncEnumerable<ListDocumentsResponse, Document> ListDocumentsAsync(ListDocumentsRequest request, CallSettings callSettings = null)

Lists documents.

Parameters
NameDescription
requestListDocumentsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListDocumentsResponse, Document>

A pageable asynchronous sequence of Document resources.

Overrides

Listen(CallSettings, BidirectionalStreamingSettings)

public override FirestoreClient.ListenStream Listen(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)

Listens to changes.

Parameters
NameDescription
callSettingsCallSettings

If not null, applies overrides to this RPC call.

streamingSettingsBidirectionalStreamingSettings

If not null, applies streaming overrides to this RPC call.

Returns
TypeDescription
FirestoreClient.ListenStream

The client-server stream.

Overrides

PartitionQuery(PartitionQueryRequest, CallSettings)

public override PagedEnumerable<PartitionQueryResponse, Cursor> PartitionQuery(PartitionQueryRequest request, CallSettings callSettings = null)

Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used by RunQuery as starting/end points for the query results.

Parameters
NameDescription
requestPartitionQueryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<PartitionQueryResponse, Cursor>

A pageable sequence of Cursor resources.

Overrides

PartitionQueryAsync(PartitionQueryRequest, CallSettings)

public override PagedAsyncEnumerable<PartitionQueryResponse, Cursor> PartitionQueryAsync(PartitionQueryRequest request, CallSettings callSettings = null)

Partitions a query by returning partition cursors that can be used to run the query in parallel. The returned partition cursors are split points that can be used by RunQuery as starting/end points for the query results.

Parameters
NameDescription
requestPartitionQueryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<PartitionQueryResponse, Cursor>

A pageable asynchronous sequence of Cursor resources.

Overrides

Rollback(RollbackRequest, CallSettings)

public override void Rollback(RollbackRequest request, CallSettings callSettings = null)

Rolls back a transaction.

Parameters
NameDescription
requestRollbackRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Overrides

RollbackAsync(RollbackRequest, CallSettings)

public override Task RollbackAsync(RollbackRequest request, CallSettings callSettings = null)

Rolls back a transaction.

Parameters
NameDescription
requestRollbackRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Overrides

RunQuery(RunQueryRequest, CallSettings)

public override FirestoreClient.RunQueryStream RunQuery(RunQueryRequest request, CallSettings callSettings = null)

Runs a query.

Parameters
NameDescription
requestRunQueryRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
FirestoreClient.RunQueryStream

The server stream.

Overrides

UpdateDocument(UpdateDocumentRequest, CallSettings)

public override Document UpdateDocument(UpdateDocumentRequest request, CallSettings callSettings = null)

Updates or inserts a document.

Parameters
NameDescription
requestUpdateDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Document

The RPC response.

Overrides

UpdateDocumentAsync(UpdateDocumentRequest, CallSettings)

public override Task<Document> UpdateDocumentAsync(UpdateDocumentRequest request, CallSettings callSettings = null)

Updates or inserts a document.

Parameters
NameDescription
requestUpdateDocumentRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Document>

A Task containing the RPC response.

Overrides

Write(CallSettings, BidirectionalStreamingSettings)

public override FirestoreClient.WriteStream Write(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)

Streams batches of document updates and deletes, in order.

Parameters
NameDescription
callSettingsCallSettings

If not null, applies overrides to this RPC call.

streamingSettingsBidirectionalStreamingSettings

If not null, applies streaming overrides to this RPC call.

Returns
TypeDescription
FirestoreClient.WriteStream

The client-server stream.

Overrides