public sealed class FirestoreClientImpl : FirestoreClient
Reference documentation and code samples for the Firestore v1 API class FirestoreClientImpl.
Firestore client wrapper implementation, for convenient use.
Namespace
Google.Cloud.Firestore.V1Assembly
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 accelerate building truly serverless apps.
Constructors
FirestoreClientImpl(FirestoreClient, FirestoreSettings, ILogger)
public FirestoreClientImpl(Firestore.FirestoreClient grpcClient, FirestoreSettings settings, ILogger logger)
Constructs a client wrapper for the Firestore service, with the specified gRPC client and settings.
Parameters | |
---|---|
Name | Description |
grpcClient | FirestoreFirestoreClient The underlying gRPC client. |
settings | FirestoreSettings The base FirestoreSettings used within this client. |
logger | ILogger Optional ILogger to use 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 | |
---|---|
Type | Description |
string |
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 | |
---|---|
Type | Description |
FirestoreFirestoreClient |
LocationsClient
public override LocationsClient LocationsClient { get; }
The LocationsClient associated with this client.
Property Value | |
---|---|
Type | Description |
LocationsClient |
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 | |
---|---|
Name | Description |
request | BatchGetDocumentsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
FirestoreClientBatchGetDocumentsStream | The server stream. |
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 | |
---|---|
Name | Description |
request | BatchWriteRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
BatchWriteResponse | The RPC response. |
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 | |
---|---|
Name | Description |
request | BatchWriteRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskBatchWriteResponse | A Task containing the RPC response. |
BeginTransaction(BeginTransactionRequest, CallSettings)
public override BeginTransactionResponse BeginTransaction(BeginTransactionRequest request, CallSettings callSettings = null)
Starts a new transaction.
Parameters | |
---|---|
Name | Description |
request | BeginTransactionRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
BeginTransactionResponse | The RPC response. |
BeginTransactionAsync(BeginTransactionRequest, CallSettings)
public override Task<BeginTransactionResponse> BeginTransactionAsync(BeginTransactionRequest request, CallSettings callSettings = null)
Starts a new transaction.
Parameters | |
---|---|
Name | Description |
request | BeginTransactionRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskBeginTransactionResponse | A Task containing the RPC response. |
Commit(CommitRequest, CallSettings)
public override CommitResponse Commit(CommitRequest request, CallSettings callSettings = null)
Commits a transaction, while optionally updating documents.
Parameters | |
---|---|
Name | Description |
request | CommitRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
CommitResponse | The RPC response. |
CommitAsync(CommitRequest, CallSettings)
public override Task<CommitResponse> CommitAsync(CommitRequest request, CallSettings callSettings = null)
Commits a transaction, while optionally updating documents.
Parameters | |
---|---|
Name | Description |
request | CommitRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskCommitResponse | A Task containing the RPC response. |
CreateDocument(CreateDocumentRequest, CallSettings)
public override Document CreateDocument(CreateDocumentRequest request, CallSettings callSettings = null)
Creates a new document.
Parameters | |
---|---|
Name | Description |
request | CreateDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Document | The RPC response. |
CreateDocumentAsync(CreateDocumentRequest, CallSettings)
public override Task<Document> CreateDocumentAsync(CreateDocumentRequest request, CallSettings callSettings = null)
Creates a new document.
Parameters | |
---|---|
Name | Description |
request | CreateDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskDocument | A Task containing the RPC response. |
DeleteDocument(DeleteDocumentRequest, CallSettings)
public override void DeleteDocument(DeleteDocumentRequest request, CallSettings callSettings = null)
Deletes a document.
Parameters | |
---|---|
Name | Description |
request | DeleteDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
DeleteDocumentAsync(DeleteDocumentRequest, CallSettings)
public override Task DeleteDocumentAsync(DeleteDocumentRequest request, CallSettings callSettings = null)
Deletes a document.
Parameters | |
---|---|
Name | Description |
request | DeleteDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
GetDocument(GetDocumentRequest, CallSettings)
public override Document GetDocument(GetDocumentRequest request, CallSettings callSettings = null)
Gets a single document.
Parameters | |
---|---|
Name | Description |
request | GetDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Document | The RPC response. |
GetDocumentAsync(GetDocumentRequest, CallSettings)
public override Task<Document> GetDocumentAsync(GetDocumentRequest request, CallSettings callSettings = null)
Gets a single document.
Parameters | |
---|---|
Name | Description |
request | GetDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskDocument | A Task containing the RPC response. |
ListCollectionIds(ListCollectionIdsRequest, CallSettings)
public override PagedEnumerable<ListCollectionIdsResponse, string> ListCollectionIds(ListCollectionIdsRequest request, CallSettings callSettings = null)
Lists all the collection IDs underneath a document.
Parameters | |
---|---|
Name | Description |
request | ListCollectionIdsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListCollectionIdsResponsestring | A pageable sequence of string resources. |
ListCollectionIdsAsync(ListCollectionIdsRequest, CallSettings)
public override PagedAsyncEnumerable<ListCollectionIdsResponse, string> ListCollectionIdsAsync(ListCollectionIdsRequest request, CallSettings callSettings = null)
Lists all the collection IDs underneath a document.
Parameters | |
---|---|
Name | Description |
request | ListCollectionIdsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListCollectionIdsResponsestring | A pageable asynchronous sequence of string resources. |
ListDocuments(ListDocumentsRequest, CallSettings)
public override PagedEnumerable<ListDocumentsResponse, Document> ListDocuments(ListDocumentsRequest request, CallSettings callSettings = null)
Lists documents.
Parameters | |
---|---|
Name | Description |
request | ListDocumentsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListDocumentsResponseDocument | A pageable sequence of Document resources. |
ListDocumentsAsync(ListDocumentsRequest, CallSettings)
public override PagedAsyncEnumerable<ListDocumentsResponse, Document> ListDocumentsAsync(ListDocumentsRequest request, CallSettings callSettings = null)
Lists documents.
Parameters | |
---|---|
Name | Description |
request | ListDocumentsRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListDocumentsResponseDocument | A pageable asynchronous sequence of Document resources. |
Listen(CallSettings, BidirectionalStreamingSettings)
public override FirestoreClient.ListenStream Listen(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)
Listens to changes. This method is only available via gRPC or WebChannel (not REST).
Parameters | |
---|---|
Name | Description |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
streamingSettings | BidirectionalStreamingSettings If not null, applies streaming overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
FirestoreClientListenStream | The client-server stream. |
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 | |
---|---|
Name | Description |
request | PartitionQueryRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerablePartitionQueryResponseCursor | A pageable sequence of Cursor resources. |
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 | |
---|---|
Name | Description |
request | PartitionQueryRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerablePartitionQueryResponseCursor | A pageable asynchronous sequence of Cursor resources. |
Rollback(RollbackRequest, CallSettings)
public override void Rollback(RollbackRequest request, CallSettings callSettings = null)
Rolls back a transaction.
Parameters | |
---|---|
Name | Description |
request | RollbackRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
RollbackAsync(RollbackRequest, CallSettings)
public override Task RollbackAsync(RollbackRequest request, CallSettings callSettings = null)
Rolls back a transaction.
Parameters | |
---|---|
Name | Description |
request | RollbackRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
RunAggregationQuery(RunAggregationQueryRequest, CallSettings)
public override FirestoreClient.RunAggregationQueryStream RunAggregationQuery(RunAggregationQueryRequest request, CallSettings callSettings = null)
Runs an aggregation query.
Rather than producing [Document][google.firestore.v1.Document] results like [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery], this API allows running an aggregation to produce a series of [AggregationResult][google.firestore.v1.AggregationResult] server-side.
High-Level Example:
-- Return the number of documents in table given a filter.
SELECT COUNT(*) FROM ( SELECT * FROM k where a = true );
Parameters | |
---|---|
Name | Description |
request | RunAggregationQueryRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
FirestoreClientRunAggregationQueryStream | The server stream. |
RunQuery(RunQueryRequest, CallSettings)
public override FirestoreClient.RunQueryStream RunQuery(RunQueryRequest request, CallSettings callSettings = null)
Runs a query.
Parameters | |
---|---|
Name | Description |
request | RunQueryRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
FirestoreClientRunQueryStream | The server stream. |
UpdateDocument(UpdateDocumentRequest, CallSettings)
public override Document UpdateDocument(UpdateDocumentRequest request, CallSettings callSettings = null)
Updates or inserts a document.
Parameters | |
---|---|
Name | Description |
request | UpdateDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Document | The RPC response. |
UpdateDocumentAsync(UpdateDocumentRequest, CallSettings)
public override Task<Document> UpdateDocumentAsync(UpdateDocumentRequest request, CallSettings callSettings = null)
Updates or inserts a document.
Parameters | |
---|---|
Name | Description |
request | UpdateDocumentRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskDocument | A Task containing the RPC response. |
Write(CallSettings, BidirectionalStreamingSettings)
public override FirestoreClient.WriteStream Write(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)
Streams batches of document updates and deletes, in order. This method is only available via gRPC or WebChannel (not REST).
Parameters | |
---|---|
Name | Description |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
streamingSettings | BidirectionalStreamingSettings If not null, applies streaming overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
FirestoreClientWriteStream | The client-server stream. |