@google-cloud/firestore-api 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +111 -0
  2. package/build/protos/google/firestore/admin/v1/backup.proto +112 -0
  3. package/build/protos/google/firestore/admin/v1/database.proto +403 -0
  4. package/build/protos/google/firestore/admin/v1/field.proto +154 -0
  5. package/build/protos/google/firestore/admin/v1/firestore_admin.proto +1229 -0
  6. package/build/protos/google/firestore/admin/v1/index.proto +378 -0
  7. package/build/protos/google/firestore/admin/v1/location.proto +30 -0
  8. package/build/protos/google/firestore/admin/v1/operation.proto +330 -0
  9. package/build/protos/google/firestore/admin/v1/realtime_updates.proto +40 -0
  10. package/build/protos/google/firestore/admin/v1/schedule.proto +95 -0
  11. package/build/protos/google/firestore/admin/v1/snapshot.proto +53 -0
  12. package/build/protos/google/firestore/admin/v1/user_creds.proto +86 -0
  13. package/build/protos/google/firestore/v1/aggregation_result.proto +43 -0
  14. package/build/protos/google/firestore/v1/bloom_filter.proto +73 -0
  15. package/build/protos/google/firestore/v1/common.proto +111 -0
  16. package/build/protos/google/firestore/v1/document.proto +247 -0
  17. package/build/protos/google/firestore/v1/explain_stats.proto +41 -0
  18. package/build/protos/google/firestore/v1/firestore.proto +1237 -0
  19. package/build/protos/google/firestore/v1/pipeline.proto +43 -0
  20. package/build/protos/google/firestore/v1/query.proto +600 -0
  21. package/build/protos/google/firestore/v1/query_profile.proto +92 -0
  22. package/build/protos/google/firestore/v1/write.proto +286 -0
  23. package/build/protos/google/firestore/v1beta1/common.proto +82 -0
  24. package/build/protos/google/firestore/v1beta1/document.proto +149 -0
  25. package/build/protos/google/firestore/v1beta1/firestore.proto +900 -0
  26. package/build/protos/google/firestore/v1beta1/query.proto +300 -0
  27. package/build/protos/google/firestore/v1beta1/undeliverable_first_gen_event.proto +75 -0
  28. package/build/protos/google/firestore/v1beta1/write.proto +258 -0
  29. package/build/protos/protos.d.ts +35648 -0
  30. package/build/protos/protos.js +1 -0
  31. package/build/protos/protos.json +1 -0
  32. package/build/src/index.d.ts +13 -0
  33. package/build/src/index.js +30 -0
  34. package/build/src/index.js.map +1 -0
  35. package/build/src/v1/firestore_admin_client.d.ts +1925 -0
  36. package/build/src/v1/firestore_admin_client.js +2734 -0
  37. package/build/src/v1/firestore_admin_client.js.map +1 -0
  38. package/build/src/v1/firestore_admin_client_config.json +172 -0
  39. package/build/src/v1/firestore_admin_proto_list.json +13 -0
  40. package/build/src/v1/firestore_client.d.ts +1204 -0
  41. package/build/src/v1/firestore_client.js +1605 -0
  42. package/build/src/v1/firestore_client.js.map +1 -0
  43. package/build/src/v1/firestore_client_config.json +135 -0
  44. package/build/src/v1/firestore_proto_list.json +12 -0
  45. package/build/src/v1/gapic_metadata.json +351 -0
  46. package/build/src/v1/index.d.ts +2 -0
  47. package/build/src/v1/index.js +25 -0
  48. package/build/src/v1/index.js.map +1 -0
  49. package/build/src/v1beta1/firestore_client.d.ts +930 -0
  50. package/build/src/v1beta1/firestore_client.js +1310 -0
  51. package/build/src/v1beta1/firestore_client.js.map +1 -0
  52. package/build/src/v1beta1/firestore_client_config.json +99 -0
  53. package/build/src/v1beta1/firestore_proto_list.json +8 -0
  54. package/build/src/v1beta1/gapic_metadata.json +165 -0
  55. package/build/src/v1beta1/index.d.ts +1 -0
  56. package/build/src/v1beta1/index.js +23 -0
  57. package/build/src/v1beta1/index.js.map +1 -0
  58. package/package.json +65 -0
@@ -0,0 +1,1237 @@
1
+ // Copyright 2026 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package google.firestore.v1;
18
+
19
+ import "google/api/annotations.proto";
20
+ import "google/api/client.proto";
21
+ import "google/api/field_behavior.proto";
22
+ import "google/api/routing.proto";
23
+ import "google/firestore/v1/aggregation_result.proto";
24
+ import "google/firestore/v1/common.proto";
25
+ import "google/firestore/v1/document.proto";
26
+ import "google/firestore/v1/explain_stats.proto";
27
+ import "google/firestore/v1/pipeline.proto";
28
+ import "google/firestore/v1/query.proto";
29
+ import "google/firestore/v1/query_profile.proto";
30
+ import "google/firestore/v1/write.proto";
31
+ import "google/protobuf/empty.proto";
32
+ import "google/protobuf/timestamp.proto";
33
+ import "google/protobuf/wrappers.proto";
34
+ import "google/rpc/status.proto";
35
+
36
+ option csharp_namespace = "Google.Cloud.Firestore.V1";
37
+ option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
38
+ option java_multiple_files = true;
39
+ option java_outer_classname = "FirestoreProto";
40
+ option java_package = "com.google.firestore.v1";
41
+ option php_namespace = "Google\\Cloud\\Firestore\\V1";
42
+ option ruby_package = "Google::Cloud::Firestore::V1";
43
+
44
+ // Specification of the Firestore API.
45
+
46
+ // The Cloud Firestore service.
47
+ //
48
+ // Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL
49
+ // document database that simplifies storing, syncing, and querying data for
50
+ // your mobile, web, and IoT apps at global scale. Its client libraries provide
51
+ // live synchronization and offline support, while its security features and
52
+ // integrations with Firebase and Google Cloud Platform accelerate building
53
+ // truly serverless apps.
54
+ service Firestore {
55
+ option (google.api.default_host) = "firestore.googleapis.com";
56
+ option (google.api.oauth_scopes) =
57
+ "https://www.googleapis.com/auth/cloud-platform,"
58
+ "https://www.googleapis.com/auth/datastore";
59
+
60
+ // Gets a single document.
61
+ rpc GetDocument(GetDocumentRequest) returns (Document) {
62
+ option (google.api.http) = {
63
+ get: "/v1/{name=projects/*/databases/*/documents/*/**}"
64
+ };
65
+ }
66
+
67
+ // Lists documents.
68
+ rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) {
69
+ option (google.api.http) = {
70
+ get: "/v1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}"
71
+ additional_bindings {
72
+ get: "/v1/{parent=projects/*/databases/*/documents}/{collection_id}"
73
+ }
74
+ };
75
+ }
76
+
77
+ // Updates or inserts a document.
78
+ rpc UpdateDocument(UpdateDocumentRequest) returns (Document) {
79
+ option (google.api.http) = {
80
+ patch: "/v1/{document.name=projects/*/databases/*/documents/*/**}"
81
+ body: "document"
82
+ };
83
+ option (google.api.method_signature) = "document,update_mask";
84
+ }
85
+
86
+ // Deletes a document.
87
+ rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) {
88
+ option (google.api.http) = {
89
+ delete: "/v1/{name=projects/*/databases/*/documents/*/**}"
90
+ };
91
+ option (google.api.method_signature) = "name";
92
+ }
93
+
94
+ // Gets multiple documents.
95
+ //
96
+ // Documents returned by this method are not guaranteed to be returned in the
97
+ // same order that they were requested.
98
+ rpc BatchGetDocuments(BatchGetDocumentsRequest)
99
+ returns (stream BatchGetDocumentsResponse) {
100
+ option (google.api.http) = {
101
+ post: "/v1/{database=projects/*/databases/*}/documents:batchGet"
102
+ body: "*"
103
+ };
104
+ }
105
+
106
+ // Starts a new transaction.
107
+ rpc BeginTransaction(BeginTransactionRequest)
108
+ returns (BeginTransactionResponse) {
109
+ option (google.api.http) = {
110
+ post: "/v1/{database=projects/*/databases/*}/documents:beginTransaction"
111
+ body: "*"
112
+ };
113
+ option (google.api.method_signature) = "database";
114
+ }
115
+
116
+ // Commits a transaction, while optionally updating documents.
117
+ rpc Commit(CommitRequest) returns (CommitResponse) {
118
+ option (google.api.http) = {
119
+ post: "/v1/{database=projects/*/databases/*}/documents:commit"
120
+ body: "*"
121
+ };
122
+ option (google.api.method_signature) = "database,writes";
123
+ }
124
+
125
+ // Rolls back a transaction.
126
+ rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) {
127
+ option (google.api.http) = {
128
+ post: "/v1/{database=projects/*/databases/*}/documents:rollback"
129
+ body: "*"
130
+ };
131
+ option (google.api.method_signature) = "database,transaction";
132
+ }
133
+
134
+ // Runs a query.
135
+ rpc RunQuery(RunQueryRequest) returns (stream RunQueryResponse) {
136
+ option (google.api.http) = {
137
+ post: "/v1/{parent=projects/*/databases/*/documents}:runQuery"
138
+ body: "*"
139
+ additional_bindings {
140
+ post: "/v1/{parent=projects/*/databases/*/documents/*/**}:runQuery"
141
+ body: "*"
142
+ }
143
+ };
144
+ }
145
+
146
+ // Executes a pipeline query.
147
+ rpc ExecutePipeline(ExecutePipelineRequest)
148
+ returns (stream ExecutePipelineResponse) {
149
+ option (google.api.http) = {
150
+ post: "/v1/{database=projects/*/databases/*}/documents:executePipeline"
151
+ body: "*"
152
+ };
153
+ option (google.api.routing) = {
154
+ routing_parameters {
155
+ field: "database"
156
+ path_template: "projects/{project_id=*}/**"
157
+ }
158
+ routing_parameters {
159
+ field: "database"
160
+ path_template: "projects/*/databases/{database_id=*}/**"
161
+ }
162
+ };
163
+ }
164
+
165
+ // Runs an aggregation query.
166
+ //
167
+ // Rather than producing [Document][google.firestore.v1.Document] results like
168
+ // [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery], this API
169
+ // allows running an aggregation to produce a series of
170
+ // [AggregationResult][google.firestore.v1.AggregationResult] server-side.
171
+ //
172
+ // High-Level Example:
173
+ //
174
+ // ```
175
+ // -- Return the number of documents in table given a filter.
176
+ // SELECT COUNT(*) FROM ( SELECT * FROM k where a = true );
177
+ // ```
178
+ rpc RunAggregationQuery(RunAggregationQueryRequest)
179
+ returns (stream RunAggregationQueryResponse) {
180
+ option (google.api.http) = {
181
+ post: "/v1/{parent=projects/*/databases/*/documents}:runAggregationQuery"
182
+ body: "*"
183
+ additional_bindings {
184
+ post: "/v1/{parent=projects/*/databases/*/documents/*/**}:runAggregationQuery"
185
+ body: "*"
186
+ }
187
+ };
188
+ }
189
+
190
+ // Partitions a query by returning partition cursors that can be used to run
191
+ // the query in parallel. The returned partition cursors are split points that
192
+ // can be used by RunQuery as starting/end points for the query results.
193
+ rpc PartitionQuery(PartitionQueryRequest) returns (PartitionQueryResponse) {
194
+ option (google.api.http) = {
195
+ post: "/v1/{parent=projects/*/databases/*/documents}:partitionQuery"
196
+ body: "*"
197
+ additional_bindings {
198
+ post: "/v1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery"
199
+ body: "*"
200
+ }
201
+ };
202
+ }
203
+
204
+ // Streams batches of document updates and deletes, in order. This method is
205
+ // only available via gRPC or WebChannel (not REST).
206
+ rpc Write(stream WriteRequest) returns (stream WriteResponse) {
207
+ option (google.api.http) = {
208
+ post: "/v1/{database=projects/*/databases/*}/documents:write"
209
+ body: "*"
210
+ };
211
+ }
212
+
213
+ // Listens to changes. This method is only available via gRPC or WebChannel
214
+ // (not REST).
215
+ rpc Listen(stream ListenRequest) returns (stream ListenResponse) {
216
+ option (google.api.http) = {
217
+ post: "/v1/{database=projects/*/databases/*}/documents:listen"
218
+ body: "*"
219
+ };
220
+ }
221
+
222
+ // Lists all the collection IDs underneath a document.
223
+ rpc ListCollectionIds(ListCollectionIdsRequest)
224
+ returns (ListCollectionIdsResponse) {
225
+ option (google.api.http) = {
226
+ post: "/v1/{parent=projects/*/databases/*/documents}:listCollectionIds"
227
+ body: "*"
228
+ additional_bindings {
229
+ post: "/v1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds"
230
+ body: "*"
231
+ }
232
+ };
233
+ option (google.api.method_signature) = "parent";
234
+ }
235
+
236
+ // Applies a batch of write operations.
237
+ //
238
+ // The BatchWrite method does not apply the write operations atomically
239
+ // and can apply them out of order. Method does not allow more than one write
240
+ // per document. Each write succeeds or fails independently. See the
241
+ // [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
242
+ // success status of each write.
243
+ //
244
+ // If you require an atomically applied set of writes, use
245
+ // [Commit][google.firestore.v1.Firestore.Commit] instead.
246
+ rpc BatchWrite(BatchWriteRequest) returns (BatchWriteResponse) {
247
+ option (google.api.http) = {
248
+ post: "/v1/{database=projects/*/databases/*}/documents:batchWrite"
249
+ body: "*"
250
+ };
251
+ }
252
+
253
+ // Creates a new document.
254
+ rpc CreateDocument(CreateDocumentRequest) returns (Document) {
255
+ option (google.api.http) = {
256
+ post: "/v1/{parent=projects/*/databases/*/documents/**}/{collection_id}"
257
+ body: "document"
258
+ };
259
+ }
260
+ }
261
+
262
+ // The request for
263
+ // [Firestore.GetDocument][google.firestore.v1.Firestore.GetDocument].
264
+ message GetDocumentRequest {
265
+ // Required. The resource name of the Document to get. In the format:
266
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
267
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
268
+
269
+ // The fields to return. If not set, returns all fields.
270
+ //
271
+ // If the document has a field that is not present in this mask, that field
272
+ // will not be returned in the response.
273
+ DocumentMask mask = 2;
274
+
275
+ // The consistency mode for this transaction.
276
+ // If not set, defaults to strong consistency.
277
+ oneof consistency_selector {
278
+ // Reads the document in a transaction.
279
+ bytes transaction = 3;
280
+
281
+ // Reads the version of the document at the given time.
282
+ //
283
+ // This must be a microsecond precision timestamp within the past one hour,
284
+ // or if Point-in-Time Recovery is enabled, can additionally be a whole
285
+ // minute timestamp within the past 7 days.
286
+ google.protobuf.Timestamp read_time = 5;
287
+ }
288
+ }
289
+
290
+ // The request for
291
+ // [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments].
292
+ message ListDocumentsRequest {
293
+ // Required. The parent resource name. In the format:
294
+ // `projects/{project_id}/databases/{database_id}/documents` or
295
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
296
+ //
297
+ // For example:
298
+ // `projects/my-project/databases/my-database/documents` or
299
+ // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
300
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
301
+
302
+ // Optional. The collection ID, relative to `parent`, to list.
303
+ //
304
+ // For example: `chatrooms` or `messages`.
305
+ //
306
+ // This is optional, and when not provided, Firestore will list documents
307
+ // from all collections under the provided `parent`.
308
+ string collection_id = 2 [(google.api.field_behavior) = OPTIONAL];
309
+
310
+ // Optional. The maximum number of documents to return in a single response.
311
+ //
312
+ // Firestore may return fewer than this value.
313
+ int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];
314
+
315
+ // Optional. A page token, received from a previous `ListDocuments` response.
316
+ //
317
+ // Provide this to retrieve the subsequent page. When paginating, all other
318
+ // parameters (with the exception of `page_size`) must match the values set
319
+ // in the request that generated the page token.
320
+ string page_token = 4 [(google.api.field_behavior) = OPTIONAL];
321
+
322
+ // Optional. The optional ordering of the documents to return.
323
+ //
324
+ // For example: `priority desc, __name__ desc`.
325
+ //
326
+ // This mirrors the [`ORDER BY`][google.firestore.v1.StructuredQuery.order_by]
327
+ // used in Firestore queries but in a string representation. When absent,
328
+ // documents are ordered based on `__name__ ASC`.
329
+ string order_by = 6 [(google.api.field_behavior) = OPTIONAL];
330
+
331
+ // Optional. The fields to return. If not set, returns all fields.
332
+ //
333
+ // If a document has a field that is not present in this mask, that field
334
+ // will not be returned in the response.
335
+ DocumentMask mask = 7 [(google.api.field_behavior) = OPTIONAL];
336
+
337
+ // The consistency mode for this transaction.
338
+ // If not set, defaults to strong consistency.
339
+ oneof consistency_selector {
340
+ // Perform the read as part of an already active transaction.
341
+ bytes transaction = 8;
342
+
343
+ // Perform the read at the provided time.
344
+ //
345
+ // This must be a microsecond precision timestamp within the past one hour,
346
+ // or if Point-in-Time Recovery is enabled, can additionally be a whole
347
+ // minute timestamp within the past 7 days.
348
+ google.protobuf.Timestamp read_time = 10;
349
+ }
350
+
351
+ // If the list should show missing documents.
352
+ //
353
+ // A document is missing if it does not exist, but there are sub-documents
354
+ // nested underneath it. When true, such missing documents will be returned
355
+ // with a key but will not have fields,
356
+ // [`create_time`][google.firestore.v1.Document.create_time], or
357
+ // [`update_time`][google.firestore.v1.Document.update_time] set.
358
+ //
359
+ // Requests with `show_missing` may not specify `where` or `order_by`.
360
+ bool show_missing = 12;
361
+ }
362
+
363
+ // The response for
364
+ // [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments].
365
+ message ListDocumentsResponse {
366
+ // The Documents found.
367
+ repeated Document documents = 1;
368
+
369
+ // A token to retrieve the next page of documents.
370
+ //
371
+ // If this field is omitted, there are no subsequent pages.
372
+ string next_page_token = 2;
373
+ }
374
+
375
+ // The request for
376
+ // [Firestore.CreateDocument][google.firestore.v1.Firestore.CreateDocument].
377
+ message CreateDocumentRequest {
378
+ // Required. The parent resource. For example:
379
+ // `projects/{project_id}/databases/{database_id}/documents` or
380
+ // `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
381
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
382
+
383
+ // Required. The collection ID, relative to `parent`, to list. For example:
384
+ // `chatrooms`.
385
+ string collection_id = 2 [(google.api.field_behavior) = REQUIRED];
386
+
387
+ // The client-assigned document ID to use for this document.
388
+ //
389
+ // Optional. If not specified, an ID will be assigned by the service.
390
+ string document_id = 3;
391
+
392
+ // Required. The document to create. `name` must not be set.
393
+ Document document = 4 [(google.api.field_behavior) = REQUIRED];
394
+
395
+ // The fields to return. If not set, returns all fields.
396
+ //
397
+ // If the document has a field that is not present in this mask, that field
398
+ // will not be returned in the response.
399
+ DocumentMask mask = 5;
400
+ }
401
+
402
+ // The request for
403
+ // [Firestore.UpdateDocument][google.firestore.v1.Firestore.UpdateDocument].
404
+ message UpdateDocumentRequest {
405
+ // Required. The updated document.
406
+ // Creates the document if it does not already exist.
407
+ Document document = 1 [(google.api.field_behavior) = REQUIRED];
408
+
409
+ // The fields to update.
410
+ // None of the field paths in the mask may contain a reserved name.
411
+ //
412
+ // If the document exists on the server and has fields not referenced in the
413
+ // mask, they are left unchanged.
414
+ // Fields referenced in the mask, but not present in the input document, are
415
+ // deleted from the document on the server.
416
+ DocumentMask update_mask = 2;
417
+
418
+ // The fields to return. If not set, returns all fields.
419
+ //
420
+ // If the document has a field that is not present in this mask, that field
421
+ // will not be returned in the response.
422
+ DocumentMask mask = 3;
423
+
424
+ // An optional precondition on the document.
425
+ // The request will fail if this is set and not met by the target document.
426
+ Precondition current_document = 4;
427
+ }
428
+
429
+ // The request for
430
+ // [Firestore.DeleteDocument][google.firestore.v1.Firestore.DeleteDocument].
431
+ message DeleteDocumentRequest {
432
+ // Required. The resource name of the Document to delete. In the format:
433
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
434
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
435
+
436
+ // An optional precondition on the document.
437
+ // The request will fail if this is set and not met by the target document.
438
+ Precondition current_document = 2;
439
+ }
440
+
441
+ // The request for
442
+ // [Firestore.BatchGetDocuments][google.firestore.v1.Firestore.BatchGetDocuments].
443
+ message BatchGetDocumentsRequest {
444
+ // Required. The database name. In the format:
445
+ // `projects/{project_id}/databases/{database_id}`.
446
+ string database = 1 [(google.api.field_behavior) = REQUIRED];
447
+
448
+ // The names of the documents to retrieve. In the format:
449
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
450
+ // The request will fail if any of the document is not a child resource of the
451
+ // given `database`. Duplicate names will be elided.
452
+ repeated string documents = 2;
453
+
454
+ // The fields to return. If not set, returns all fields.
455
+ //
456
+ // If a document has a field that is not present in this mask, that field will
457
+ // not be returned in the response.
458
+ DocumentMask mask = 3;
459
+
460
+ // The consistency mode for this transaction.
461
+ // If not set, defaults to strong consistency.
462
+ oneof consistency_selector {
463
+ // Reads documents in a transaction.
464
+ bytes transaction = 4;
465
+
466
+ // Starts a new transaction and reads the documents.
467
+ // Defaults to a read-only transaction.
468
+ // The new transaction ID will be returned as the first response in the
469
+ // stream.
470
+ TransactionOptions new_transaction = 5;
471
+
472
+ // Reads documents as they were at the given time.
473
+ //
474
+ // This must be a microsecond precision timestamp within the past one hour,
475
+ // or if Point-in-Time Recovery is enabled, can additionally be a whole
476
+ // minute timestamp within the past 7 days.
477
+ google.protobuf.Timestamp read_time = 7;
478
+ }
479
+ }
480
+
481
+ // The streamed response for
482
+ // [Firestore.BatchGetDocuments][google.firestore.v1.Firestore.BatchGetDocuments].
483
+ message BatchGetDocumentsResponse {
484
+ // A single result.
485
+ // This can be empty if the server is just returning a transaction.
486
+ oneof result {
487
+ // A document that was requested.
488
+ Document found = 1;
489
+
490
+ // A document name that was requested but does not exist. In the format:
491
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
492
+ string missing = 2;
493
+ }
494
+
495
+ // The transaction that was started as part of this request.
496
+ // Will only be set in the first response, and only if
497
+ // [BatchGetDocumentsRequest.new_transaction][google.firestore.v1.BatchGetDocumentsRequest.new_transaction]
498
+ // was set in the request.
499
+ bytes transaction = 3;
500
+
501
+ // The time at which the document was read.
502
+ // This may be monotically increasing, in this case the previous documents in
503
+ // the result stream are guaranteed not to have changed between their
504
+ // read_time and this one.
505
+ google.protobuf.Timestamp read_time = 4;
506
+ }
507
+
508
+ // The request for
509
+ // [Firestore.BeginTransaction][google.firestore.v1.Firestore.BeginTransaction].
510
+ message BeginTransactionRequest {
511
+ // Required. The database name. In the format:
512
+ // `projects/{project_id}/databases/{database_id}`.
513
+ string database = 1 [(google.api.field_behavior) = REQUIRED];
514
+
515
+ // The options for the transaction.
516
+ // Defaults to a read-write transaction.
517
+ TransactionOptions options = 2;
518
+ }
519
+
520
+ // The response for
521
+ // [Firestore.BeginTransaction][google.firestore.v1.Firestore.BeginTransaction].
522
+ message BeginTransactionResponse {
523
+ // The transaction that was started.
524
+ bytes transaction = 1;
525
+ }
526
+
527
+ // The request for [Firestore.Commit][google.firestore.v1.Firestore.Commit].
528
+ message CommitRequest {
529
+ // Required. The database name. In the format:
530
+ // `projects/{project_id}/databases/{database_id}`.
531
+ string database = 1 [(google.api.field_behavior) = REQUIRED];
532
+
533
+ // The writes to apply.
534
+ //
535
+ // Always executed atomically and in order.
536
+ repeated Write writes = 2;
537
+
538
+ // If set, applies all writes in this transaction, and commits it.
539
+ bytes transaction = 3;
540
+ }
541
+
542
+ // The response for [Firestore.Commit][google.firestore.v1.Firestore.Commit].
543
+ message CommitResponse {
544
+ // The result of applying the writes.
545
+ //
546
+ // This i-th write result corresponds to the i-th write in the
547
+ // request.
548
+ repeated WriteResult write_results = 1;
549
+
550
+ // The time at which the commit occurred. Any read with an equal or greater
551
+ // `read_time` is guaranteed to see the effects of the commit.
552
+ google.protobuf.Timestamp commit_time = 2;
553
+ }
554
+
555
+ // The request for [Firestore.Rollback][google.firestore.v1.Firestore.Rollback].
556
+ message RollbackRequest {
557
+ // Required. The database name. In the format:
558
+ // `projects/{project_id}/databases/{database_id}`.
559
+ string database = 1 [(google.api.field_behavior) = REQUIRED];
560
+
561
+ // Required. The transaction to roll back.
562
+ bytes transaction = 2 [(google.api.field_behavior) = REQUIRED];
563
+ }
564
+
565
+ // The request for [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery].
566
+ message RunQueryRequest {
567
+ // Required. The parent resource name. In the format:
568
+ // `projects/{project_id}/databases/{database_id}/documents` or
569
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
570
+ // For example:
571
+ // `projects/my-project/databases/my-database/documents` or
572
+ // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
573
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
574
+
575
+ // The query to run.
576
+ oneof query_type {
577
+ // A structured query.
578
+ StructuredQuery structured_query = 2;
579
+ }
580
+
581
+ // The consistency mode for this transaction.
582
+ // If not set, defaults to strong consistency.
583
+ oneof consistency_selector {
584
+ // Run the query within an already active transaction.
585
+ //
586
+ // The value here is the opaque transaction ID to execute the query in.
587
+ bytes transaction = 5;
588
+
589
+ // Starts a new transaction and reads the documents.
590
+ // Defaults to a read-only transaction.
591
+ // The new transaction ID will be returned as the first response in the
592
+ // stream.
593
+ TransactionOptions new_transaction = 6;
594
+
595
+ // Reads documents as they were at the given time.
596
+ //
597
+ // This must be a microsecond precision timestamp within the past one hour,
598
+ // or if Point-in-Time Recovery is enabled, can additionally be a whole
599
+ // minute timestamp within the past 7 days.
600
+ google.protobuf.Timestamp read_time = 7;
601
+ }
602
+
603
+ // Optional. Explain options for the query. If set, additional query
604
+ // statistics will be returned. If not, only query results will be returned.
605
+ ExplainOptions explain_options = 10 [(google.api.field_behavior) = OPTIONAL];
606
+ }
607
+
608
+ // The response for
609
+ // [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery].
610
+ message RunQueryResponse {
611
+ // The transaction that was started as part of this request.
612
+ // Can only be set in the first response, and only if
613
+ // [RunQueryRequest.new_transaction][google.firestore.v1.RunQueryRequest.new_transaction]
614
+ // was set in the request. If set, no other fields will be set in this
615
+ // response.
616
+ bytes transaction = 2;
617
+
618
+ // A query result, not set when reporting partial progress.
619
+ Document document = 1;
620
+
621
+ // The time at which the document was read. This may be monotonically
622
+ // increasing; in this case, the previous documents in the result stream are
623
+ // guaranteed not to have changed between their `read_time` and this one.
624
+ //
625
+ // If the query returns no results, a response with `read_time` and no
626
+ // `document` will be sent, and this represents the time at which the query
627
+ // was run.
628
+ google.protobuf.Timestamp read_time = 3;
629
+
630
+ // The number of results that have been skipped due to an offset between
631
+ // the last response and the current response.
632
+ int32 skipped_results = 4;
633
+
634
+ // The continuation mode for the query. If present, it indicates the current
635
+ // query response stream has finished. This can be set with or without a
636
+ // `document` present, but when set, no more results are returned.
637
+ oneof continuation_selector {
638
+ // If present, Firestore has completely finished the request and no more
639
+ // documents will be returned.
640
+ bool done = 6;
641
+ }
642
+
643
+ // Query explain metrics. This is only present when the
644
+ // [RunQueryRequest.explain_options][google.firestore.v1.RunQueryRequest.explain_options]
645
+ // is provided, and it is sent only once with the last response in the stream.
646
+ ExplainMetrics explain_metrics = 11;
647
+ }
648
+
649
+ // The request for
650
+ // [Firestore.ExecutePipeline][google.firestore.v1.Firestore.ExecutePipeline].
651
+ message ExecutePipelineRequest {
652
+ // Required. Database identifier, in the form
653
+ // `projects/{project}/databases/{database}`.
654
+ string database = 1 [(google.api.field_behavior) = REQUIRED];
655
+
656
+ oneof pipeline_type {
657
+ // A pipelined operation.
658
+ StructuredPipeline structured_pipeline = 2;
659
+ }
660
+
661
+ // Optional consistency arguments, defaults to strong consistency.
662
+ oneof consistency_selector {
663
+ // Run the query within an already active transaction.
664
+ //
665
+ // The value here is the opaque transaction ID to execute the query in.
666
+ bytes transaction = 5;
667
+
668
+ // Execute the pipeline in a new transaction.
669
+ //
670
+ // The identifier of the newly created transaction will be returned in the
671
+ // first response on the stream. This defaults to a read-only transaction.
672
+ TransactionOptions new_transaction = 6;
673
+
674
+ // Execute the pipeline in a snapshot transaction at the given time.
675
+ //
676
+ // This must be a microsecond precision timestamp within the past one hour,
677
+ // or if Point-in-Time Recovery is enabled, can additionally be a whole
678
+ // minute timestamp within the past 7 days.
679
+ google.protobuf.Timestamp read_time = 7;
680
+ }
681
+
682
+ // Optional. Automatically commits the transaction after the pipeline has been
683
+ // executed. Only permitted in combination with `transaction` or
684
+ // `new_transaction`.
685
+ bool auto_commit_transaction = 9 [(google.api.field_behavior) = OPTIONAL];
686
+ }
687
+
688
+ // The response for [Firestore.Execute][].
689
+ message ExecutePipelineResponse {
690
+ // Newly created transaction identifier.
691
+ //
692
+ // This field is only specified as part of the first response from the server,
693
+ // alongside the `results` field when the original request specified
694
+ // [ExecuteRequest.new_transaction][].
695
+ bytes transaction = 1;
696
+
697
+ // An ordered batch of results returned executing a pipeline.
698
+ //
699
+ // The batch size is variable, and can even be zero for when only a partial
700
+ // progress message is returned.
701
+ //
702
+ // The fields present in the returned documents are only those that were
703
+ // explicitly requested in the pipeline, this includes those like
704
+ // [`__name__`][google.firestore.v1.Document.name] and
705
+ // [`__update_time__`][google.firestore.v1.Document.update_time]. This is
706
+ // explicitly a divergence from `Firestore.RunQuery` / `Firestore.GetDocument`
707
+ // RPCs which always return such fields even when they are not specified in
708
+ // the [`mask`][google.firestore.v1.DocumentMask].
709
+ repeated Document results = 2;
710
+
711
+ // The time at which the results are valid.
712
+ //
713
+ // This is a (not strictly) monotonically increasing value across multiple
714
+ // responses in the same stream. The API guarantees that all previously
715
+ // returned results are still valid at the latest `execution_time`. This
716
+ // allows the API consumer to treat the query if it ran at the latest
717
+ // `execution_time` returned.
718
+ //
719
+ // If the query returns no results, a response with `execution_time` and no
720
+ // `results` will be sent, and this represents the time at which the operation
721
+ // was run.
722
+ google.protobuf.Timestamp execution_time = 3;
723
+
724
+ // Query explain stats.
725
+ //
726
+ // This is present on the **last** response if the request configured explain
727
+ // to run in 'analyze' or 'explain' mode in the pipeline options. If the query
728
+ // does not return any results, a response with `explain_stats` and no
729
+ // `results` will still be sent.
730
+ ExplainStats explain_stats = 4;
731
+ }
732
+
733
+ // The request for
734
+ // [Firestore.RunAggregationQuery][google.firestore.v1.Firestore.RunAggregationQuery].
735
+ message RunAggregationQueryRequest {
736
+ // Required. The parent resource name. In the format:
737
+ // `projects/{project_id}/databases/{database_id}/documents` or
738
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
739
+ // For example:
740
+ // `projects/my-project/databases/my-database/documents` or
741
+ // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
742
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
743
+
744
+ // The query to run.
745
+ oneof query_type {
746
+ // An aggregation query.
747
+ StructuredAggregationQuery structured_aggregation_query = 2;
748
+ }
749
+
750
+ // The consistency mode for the query, defaults to strong consistency.
751
+ oneof consistency_selector {
752
+ // Run the aggregation within an already active transaction.
753
+ //
754
+ // The value here is the opaque transaction ID to execute the query in.
755
+ bytes transaction = 4;
756
+
757
+ // Starts a new transaction as part of the query, defaulting to read-only.
758
+ //
759
+ // The new transaction ID will be returned as the first response in the
760
+ // stream.
761
+ TransactionOptions new_transaction = 5;
762
+
763
+ // Executes the query at the given timestamp.
764
+ //
765
+ // This must be a microsecond precision timestamp within the past one hour,
766
+ // or if Point-in-Time Recovery is enabled, can additionally be a whole
767
+ // minute timestamp within the past 7 days.
768
+ google.protobuf.Timestamp read_time = 6;
769
+ }
770
+
771
+ // Optional. Explain options for the query. If set, additional query
772
+ // statistics will be returned. If not, only query results will be returned.
773
+ ExplainOptions explain_options = 8 [(google.api.field_behavior) = OPTIONAL];
774
+ }
775
+
776
+ // The response for
777
+ // [Firestore.RunAggregationQuery][google.firestore.v1.Firestore.RunAggregationQuery].
778
+ message RunAggregationQueryResponse {
779
+ // A single aggregation result.
780
+ //
781
+ // Not present when reporting partial progress.
782
+ AggregationResult result = 1;
783
+
784
+ // The transaction that was started as part of this request.
785
+ //
786
+ // Only present on the first response when the request requested to start
787
+ // a new transaction.
788
+ bytes transaction = 2;
789
+
790
+ // The time at which the aggregate result was computed. This is always
791
+ // monotonically increasing; in this case, the previous AggregationResult in
792
+ // the result stream are guaranteed not to have changed between their
793
+ // `read_time` and this one.
794
+ //
795
+ // If the query returns no results, a response with `read_time` and no
796
+ // `result` will be sent, and this represents the time at which the query
797
+ // was run.
798
+ google.protobuf.Timestamp read_time = 3;
799
+
800
+ // Query explain metrics. This is only present when the
801
+ // [RunAggregationQueryRequest.explain_options][google.firestore.v1.RunAggregationQueryRequest.explain_options]
802
+ // is provided, and it is sent only once with the last response in the stream.
803
+ ExplainMetrics explain_metrics = 10;
804
+ }
805
+
806
+ // The request for
807
+ // [Firestore.PartitionQuery][google.firestore.v1.Firestore.PartitionQuery].
808
+ message PartitionQueryRequest {
809
+ // Required. The parent resource name. In the format:
810
+ // `projects/{project_id}/databases/{database_id}/documents`.
811
+ // Document resource names are not supported; only database resource names
812
+ // can be specified.
813
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
814
+
815
+ // The query to partition.
816
+ oneof query_type {
817
+ // A structured query.
818
+ // Query must specify collection with all descendants and be ordered by name
819
+ // ascending. Other filters, order bys, limits, offsets, and start/end
820
+ // cursors are not supported.
821
+ StructuredQuery structured_query = 2;
822
+ }
823
+
824
+ // The desired maximum number of partition points.
825
+ // The partitions may be returned across multiple pages of results.
826
+ // The number must be positive. The actual number of partitions
827
+ // returned may be fewer.
828
+ //
829
+ // For example, this may be set to one fewer than the number of parallel
830
+ // queries to be run, or in running a data pipeline job, one fewer than the
831
+ // number of workers or compute instances available.
832
+ int64 partition_count = 3;
833
+
834
+ // The `next_page_token` value returned from a previous call to
835
+ // PartitionQuery that may be used to get an additional set of results.
836
+ // There are no ordering guarantees between sets of results. Thus, using
837
+ // multiple sets of results will require merging the different result sets.
838
+ //
839
+ // For example, two subsequent calls using a page_token may return:
840
+ //
841
+ // * cursor B, cursor M, cursor Q
842
+ // * cursor A, cursor U, cursor W
843
+ //
844
+ // To obtain a complete result set ordered with respect to the results of the
845
+ // query supplied to PartitionQuery, the results sets should be merged:
846
+ // cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W
847
+ string page_token = 4;
848
+
849
+ // The maximum number of partitions to return in this call, subject to
850
+ // `partition_count`.
851
+ //
852
+ // For example, if `partition_count` = 10 and `page_size` = 8, the first call
853
+ // to PartitionQuery will return up to 8 partitions and a `next_page_token`
854
+ // if more results exist. A second call to PartitionQuery will return up to
855
+ // 2 partitions, to complete the total of 10 specified in `partition_count`.
856
+ int32 page_size = 5;
857
+
858
+ // The consistency mode for this request.
859
+ // If not set, defaults to strong consistency.
860
+ oneof consistency_selector {
861
+ // Reads documents as they were at the given time.
862
+ //
863
+ // This must be a microsecond precision timestamp within the past one hour,
864
+ // or if Point-in-Time Recovery is enabled, can additionally be a whole
865
+ // minute timestamp within the past 7 days.
866
+ google.protobuf.Timestamp read_time = 6;
867
+ }
868
+ }
869
+
870
+ // The response for
871
+ // [Firestore.PartitionQuery][google.firestore.v1.Firestore.PartitionQuery].
872
+ message PartitionQueryResponse {
873
+ // Partition results.
874
+ // Each partition is a split point that can be used by RunQuery as a starting
875
+ // or end point for the query results. The RunQuery requests must be made with
876
+ // the same query supplied to this PartitionQuery request. The partition
877
+ // cursors will be ordered according to same ordering as the results of the
878
+ // query supplied to PartitionQuery.
879
+ //
880
+ // For example, if a PartitionQuery request returns partition cursors A and B,
881
+ // running the following three queries will return the entire result set of
882
+ // the original query:
883
+ //
884
+ // * query, end_at A
885
+ // * query, start_at A, end_at B
886
+ // * query, start_at B
887
+ //
888
+ // An empty result may indicate that the query has too few results to be
889
+ // partitioned, or that the query is not yet supported for partitioning.
890
+ repeated Cursor partitions = 1;
891
+
892
+ // A page token that may be used to request an additional set of results, up
893
+ // to the number specified by `partition_count` in the PartitionQuery request.
894
+ // If blank, there are no more results.
895
+ string next_page_token = 2;
896
+ }
897
+
898
+ // The request for [Firestore.Write][google.firestore.v1.Firestore.Write].
899
+ //
900
+ // The first request creates a stream, or resumes an existing one from a token.
901
+ //
902
+ // When creating a new stream, the server replies with a response containing
903
+ // only an ID and a token, to use in the next request.
904
+ //
905
+ // When resuming a stream, the server first streams any responses later than the
906
+ // given token, then a response containing only an up-to-date token, to use in
907
+ // the next request.
908
+ message WriteRequest {
909
+ // Required. The database name. In the format:
910
+ // `projects/{project_id}/databases/{database_id}`.
911
+ // This is only required in the first message.
912
+ string database = 1 [(google.api.field_behavior) = REQUIRED];
913
+
914
+ // The ID of the write stream to resume.
915
+ // This may only be set in the first message. When left empty, a new write
916
+ // stream will be created.
917
+ string stream_id = 2;
918
+
919
+ // The writes to apply.
920
+ //
921
+ // Always executed atomically and in order.
922
+ // This must be empty on the first request.
923
+ // This may be empty on the last request.
924
+ // This must not be empty on all other requests.
925
+ repeated Write writes = 3;
926
+
927
+ // A stream token that was previously sent by the server.
928
+ //
929
+ // The client should set this field to the token from the most recent
930
+ // [WriteResponse][google.firestore.v1.WriteResponse] it has received. This
931
+ // acknowledges that the client has received responses up to this token. After
932
+ // sending this token, earlier tokens may not be used anymore.
933
+ //
934
+ // The server may close the stream if there are too many unacknowledged
935
+ // responses.
936
+ //
937
+ // Leave this field unset when creating a new stream. To resume a stream at
938
+ // a specific point, set this field and the `stream_id` field.
939
+ //
940
+ // Leave this field unset when creating a new stream.
941
+ bytes stream_token = 4;
942
+
943
+ // Labels associated with this write request.
944
+ map<string, string> labels = 5;
945
+ }
946
+
947
+ // The response for [Firestore.Write][google.firestore.v1.Firestore.Write].
948
+ message WriteResponse {
949
+ // The ID of the stream.
950
+ // Only set on the first message, when a new stream was created.
951
+ string stream_id = 1;
952
+
953
+ // A token that represents the position of this response in the stream.
954
+ // This can be used by a client to resume the stream at this point.
955
+ //
956
+ // This field is always set.
957
+ bytes stream_token = 2;
958
+
959
+ // The result of applying the writes.
960
+ //
961
+ // This i-th write result corresponds to the i-th write in the
962
+ // request.
963
+ repeated WriteResult write_results = 3;
964
+
965
+ // The time at which the commit occurred. Any read with an equal or greater
966
+ // `read_time` is guaranteed to see the effects of the write.
967
+ google.protobuf.Timestamp commit_time = 4;
968
+ }
969
+
970
+ // A request for [Firestore.Listen][google.firestore.v1.Firestore.Listen]
971
+ message ListenRequest {
972
+ // Required. The database name. In the format:
973
+ // `projects/{project_id}/databases/{database_id}`.
974
+ string database = 1 [(google.api.field_behavior) = REQUIRED];
975
+
976
+ // The supported target changes.
977
+ oneof target_change {
978
+ // A target to add to this stream.
979
+ Target add_target = 2;
980
+
981
+ // The ID of a target to remove from this stream.
982
+ int32 remove_target = 3;
983
+ }
984
+
985
+ // Labels associated with this target change.
986
+ map<string, string> labels = 4;
987
+ }
988
+
989
+ // The response for [Firestore.Listen][google.firestore.v1.Firestore.Listen].
990
+ message ListenResponse {
991
+ // The supported responses.
992
+ oneof response_type {
993
+ // Targets have changed.
994
+ TargetChange target_change = 2;
995
+
996
+ // A [Document][google.firestore.v1.Document] has changed.
997
+ DocumentChange document_change = 3;
998
+
999
+ // A [Document][google.firestore.v1.Document] has been deleted.
1000
+ DocumentDelete document_delete = 4;
1001
+
1002
+ // A [Document][google.firestore.v1.Document] has been removed from a target
1003
+ // (because it is no longer relevant to that target).
1004
+ DocumentRemove document_remove = 6;
1005
+
1006
+ // A filter to apply to the set of documents previously returned for the
1007
+ // given target.
1008
+ //
1009
+ // Returned when documents may have been removed from the given target, but
1010
+ // the exact documents are unknown.
1011
+ ExistenceFilter filter = 5;
1012
+ }
1013
+ }
1014
+
1015
+ // A specification of a set of documents to listen to.
1016
+ message Target {
1017
+ // A target specified by a set of documents names.
1018
+ message DocumentsTarget {
1019
+ // The names of the documents to retrieve. In the format:
1020
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
1021
+ // The request will fail if any of the document is not a child resource of
1022
+ // the given `database`. Duplicate names will be elided.
1023
+ repeated string documents = 2;
1024
+ }
1025
+
1026
+ // A target specified by a query.
1027
+ message QueryTarget {
1028
+ // The parent resource name. In the format:
1029
+ // `projects/{project_id}/databases/{database_id}/documents` or
1030
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
1031
+ // For example:
1032
+ // `projects/my-project/databases/my-database/documents` or
1033
+ // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
1034
+ string parent = 1;
1035
+
1036
+ // The query to run.
1037
+ oneof query_type {
1038
+ // A structured query.
1039
+ StructuredQuery structured_query = 2;
1040
+ }
1041
+ }
1042
+
1043
+ // The type of target to listen to.
1044
+ oneof target_type {
1045
+ // A target specified by a query.
1046
+ QueryTarget query = 2;
1047
+
1048
+ // A target specified by a set of document names.
1049
+ DocumentsTarget documents = 3;
1050
+ }
1051
+
1052
+ // When to start listening.
1053
+ //
1054
+ // If specified, only the matching Documents that have been updated AFTER the
1055
+ // `resume_token` or `read_time` will be returned. Otherwise, all matching
1056
+ // Documents are returned before any subsequent changes.
1057
+ oneof resume_type {
1058
+ // A resume token from a prior
1059
+ // [TargetChange][google.firestore.v1.TargetChange] for an identical target.
1060
+ //
1061
+ // Using a resume token with a different target is unsupported and may fail.
1062
+ bytes resume_token = 4;
1063
+
1064
+ // Start listening after a specific `read_time`.
1065
+ //
1066
+ // The client must know the state of matching documents at this time.
1067
+ google.protobuf.Timestamp read_time = 11;
1068
+ }
1069
+
1070
+ // The target ID that identifies the target on the stream. Must be a positive
1071
+ // number and non-zero.
1072
+ //
1073
+ // If `target_id` is 0 (or unspecified), the server will assign an ID for this
1074
+ // target and return that in a `TargetChange::ADD` event. Once a target with
1075
+ // `target_id=0` is added, all subsequent targets must also have
1076
+ // `target_id=0`. If an `AddTarget` request with `target_id != 0` is
1077
+ // sent to the server after a target with `target_id=0` is added, the server
1078
+ // will immediately send a response with a `TargetChange::Remove` event.
1079
+ //
1080
+ // Note that if the client sends multiple `AddTarget` requests
1081
+ // without an ID, the order of IDs returned in `TargetChange.target_ids` are
1082
+ // undefined. Therefore, clients should provide a target ID instead of relying
1083
+ // on the server to assign one.
1084
+ //
1085
+ // If `target_id` is non-zero, there must not be an existing active target on
1086
+ // this stream with the same ID.
1087
+ int32 target_id = 5;
1088
+
1089
+ // If the target should be removed once it is current and consistent.
1090
+ bool once = 6;
1091
+
1092
+ // The number of documents that last matched the query at the resume token or
1093
+ // read time.
1094
+ //
1095
+ // This value is only relevant when a `resume_type` is provided. This value
1096
+ // being present and greater than zero signals that the client wants
1097
+ // `ExistenceFilter.unchanged_names` to be included in the response.
1098
+ google.protobuf.Int32Value expected_count = 12;
1099
+ }
1100
+
1101
+ // Targets being watched have changed.
1102
+ message TargetChange {
1103
+ // The type of change.
1104
+ enum TargetChangeType {
1105
+ // No change has occurred. Used only to send an updated `resume_token`.
1106
+ NO_CHANGE = 0;
1107
+
1108
+ // The targets have been added.
1109
+ ADD = 1;
1110
+
1111
+ // The targets have been removed.
1112
+ REMOVE = 2;
1113
+
1114
+ // The targets reflect all changes committed before the targets were added
1115
+ // to the stream.
1116
+ //
1117
+ // This will be sent after or with a `read_time` that is greater than or
1118
+ // equal to the time at which the targets were added.
1119
+ //
1120
+ // Listeners can wait for this change if read-after-write semantics
1121
+ // are desired.
1122
+ CURRENT = 3;
1123
+
1124
+ // The targets have been reset, and a new initial state for the targets
1125
+ // will be returned in subsequent changes.
1126
+ //
1127
+ // After the initial state is complete, `CURRENT` will be returned even
1128
+ // if the target was previously indicated to be `CURRENT`.
1129
+ RESET = 4;
1130
+ }
1131
+
1132
+ // The type of change that occurred.
1133
+ TargetChangeType target_change_type = 1;
1134
+
1135
+ // The target IDs of targets that have changed.
1136
+ //
1137
+ // If empty, the change applies to all targets.
1138
+ //
1139
+ // The order of the target IDs is not defined.
1140
+ repeated int32 target_ids = 2;
1141
+
1142
+ // The error that resulted in this change, if applicable.
1143
+ google.rpc.Status cause = 3;
1144
+
1145
+ // A token that can be used to resume the stream for the given `target_ids`,
1146
+ // or all targets if `target_ids` is empty.
1147
+ //
1148
+ // Not set on every target change.
1149
+ bytes resume_token = 4;
1150
+
1151
+ // The consistent `read_time` for the given `target_ids` (omitted when the
1152
+ // target_ids are not at a consistent snapshot).
1153
+ //
1154
+ // The stream is guaranteed to send a `read_time` with `target_ids` empty
1155
+ // whenever the entire stream reaches a new consistent snapshot. ADD,
1156
+ // CURRENT, and RESET messages are guaranteed to (eventually) result in a
1157
+ // new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
1158
+ //
1159
+ // For a given stream, `read_time` is guaranteed to be monotonically
1160
+ // increasing.
1161
+ google.protobuf.Timestamp read_time = 6;
1162
+ }
1163
+
1164
+ // The request for
1165
+ // [Firestore.ListCollectionIds][google.firestore.v1.Firestore.ListCollectionIds].
1166
+ message ListCollectionIdsRequest {
1167
+ // Required. The parent document. In the format:
1168
+ // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
1169
+ // For example:
1170
+ // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
1171
+ //
1172
+ // Use `projects/{project_id}/databases/{database_id}/documents` to list
1173
+ // top-level collections.
1174
+ string parent = 1 [(google.api.field_behavior) = REQUIRED];
1175
+
1176
+ // The maximum number of results to return.
1177
+ int32 page_size = 2;
1178
+
1179
+ // A page token. Must be a value from
1180
+ // [ListCollectionIdsResponse][google.firestore.v1.ListCollectionIdsResponse].
1181
+ string page_token = 3;
1182
+
1183
+ // The consistency mode for this request.
1184
+ // If not set, defaults to strong consistency.
1185
+ oneof consistency_selector {
1186
+ // Reads documents as they were at the given time.
1187
+ //
1188
+ // This must be a microsecond precision timestamp within the past one hour,
1189
+ // or if Point-in-Time Recovery is enabled, can additionally be a whole
1190
+ // minute timestamp within the past 7 days.
1191
+ google.protobuf.Timestamp read_time = 4;
1192
+ }
1193
+ }
1194
+
1195
+ // The response from
1196
+ // [Firestore.ListCollectionIds][google.firestore.v1.Firestore.ListCollectionIds].
1197
+ message ListCollectionIdsResponse {
1198
+ // The collection ids.
1199
+ repeated string collection_ids = 1;
1200
+
1201
+ // A page token that may be used to continue the list.
1202
+ string next_page_token = 2;
1203
+ }
1204
+
1205
+ // The request for
1206
+ // [Firestore.BatchWrite][google.firestore.v1.Firestore.BatchWrite].
1207
+ message BatchWriteRequest {
1208
+ // Required. The database name. In the format:
1209
+ // `projects/{project_id}/databases/{database_id}`.
1210
+ string database = 1 [(google.api.field_behavior) = REQUIRED];
1211
+
1212
+ // The writes to apply.
1213
+ //
1214
+ // Method does not apply writes atomically and does not guarantee ordering.
1215
+ // Each write succeeds or fails independently. You cannot write to the same
1216
+ // document more than once per request.
1217
+ repeated Write writes = 2;
1218
+
1219
+ // Labels associated with this batch write.
1220
+ map<string, string> labels = 3;
1221
+ }
1222
+
1223
+ // The response from
1224
+ // [Firestore.BatchWrite][google.firestore.v1.Firestore.BatchWrite].
1225
+ message BatchWriteResponse {
1226
+ // The result of applying the writes.
1227
+ //
1228
+ // This i-th write result corresponds to the i-th write in the
1229
+ // request.
1230
+ repeated WriteResult write_results = 1;
1231
+
1232
+ // The status of applying the writes.
1233
+ //
1234
+ // This i-th write status corresponds to the i-th write in the
1235
+ // request.
1236
+ repeated google.rpc.Status status = 2;
1237
+ }