aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Protos/protos/google/firestore/v1beta1/firestore.proto
blob: c7e85610e1dfcfcacd913876de33cc6269730232 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.firestore.v1beta1;

import "google/api/annotations.proto";
import "google/firestore/v1beta1/common.proto";
import "google/firestore/v1beta1/document.proto";
import "google/firestore/v1beta1/query.proto";
import "google/firestore/v1beta1/write.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";

option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1beta1;firestore";
option java_multiple_files = true;
option java_outer_classname = "FirestoreProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";

// Specification of the Firestore API.



// The Cloud Firestore service.
//
// This service exposes several types of comparable timestamps:
//
// *    `create_time` - The time at which a document was created. Changes only
//      when a document is deleted, then re-created. Increases in a strict
//       monotonic fashion.
// *    `update_time` - The time at which a document was last updated. Changes
//      every time a document is modified. Does not change when a write results
//      in no modifications. Increases in a strict monotonic fashion.
// *    `read_time` - The time at which a particular state was observed. Used
//      to denote a consistent snapshot of the database or the time at which a
//      Document was observed to not exist.
// *    `commit_time` - The time at which the writes in a transaction were
//      committed. Any read with an equal or greater `read_time` is guaranteed
//      to see the effects of the transaction.
service Firestore {
  // Gets a single document.
  rpc GetDocument(GetDocumentRequest) returns (Document) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/databases/*/documents/*/**}"
    };
  }

  // Lists documents.
  rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}"
    };
  }

  // Creates a new document.
  rpc CreateDocument(CreateDocumentRequest) returns (Document) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}"
      body: "document"
    };
  }

  // Updates or inserts a document.
  rpc UpdateDocument(UpdateDocumentRequest) returns (Document) {
    option (google.api.http) = {
      patch: "/v1beta1/{document.name=projects/*/databases/*/documents/*/**}"
      body: "document"
    };
  }

  // Deletes a document.
  rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1beta1/{name=projects/*/databases/*/documents/*/**}"
    };
  }

  // Gets multiple documents.
  //
  // Documents returned by this method are not guaranteed to be returned in the
  // same order that they were requested.
  rpc BatchGetDocuments(BatchGetDocumentsRequest) returns (stream BatchGetDocumentsResponse) {
    option (google.api.http) = {
      post: "/v1beta1/{database=projects/*/databases/*}/documents:batchGet"
      body: "*"
    };
  }

  // Starts a new transaction.
  rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse) {
    option (google.api.http) = {
      post: "/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction"
      body: "*"
    };
  }

  // Commits a transaction, while optionally updating documents.
  rpc Commit(CommitRequest) returns (CommitResponse) {
    option (google.api.http) = {
      post: "/v1beta1/{database=projects/*/databases/*}/documents:commit"
      body: "*"
    };
  }

  // Rolls back a transaction.
  rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      post: "/v1beta1/{database=projects/*/databases/*}/documents:rollback"
      body: "*"
    };
  }

  // Runs a query.
  rpc RunQuery(RunQueryRequest) returns (stream RunQueryResponse) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/databases/*/documents}:runQuery"
      body: "*"
      additional_bindings {
        post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:runQuery"
        body: "*"
      }
    };
  }

  // Streams batches of document updates and deletes, in order.
  rpc Write(stream WriteRequest) returns (stream WriteResponse) {
    option (google.api.http) = {
      post: "/v1beta1/{database=projects/*/databases/*}/documents:write"
      body: "*"
    };
  }

  // Listens to changes.
  rpc Listen(stream ListenRequest) returns (stream ListenResponse) {
    option (google.api.http) = {
      post: "/v1beta1/{database=projects/*/databases/*}/documents:listen"
      body: "*"
    };
  }

  // Lists all the collection IDs underneath a document.
  rpc ListCollectionIds(ListCollectionIdsRequest) returns (ListCollectionIdsResponse) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds"
      body: "*"
      additional_bindings {
        post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds"
        body: "*"
      }
    };
  }
}

// The request for [Firestore.GetDocument][google.firestore.v1beta1.Firestore.GetDocument].
message GetDocumentRequest {
  // The resource name of the Document to get. In the format:
  // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  string name = 1;

  // The fields to return. If not set, returns all fields.
  //
  // If the document has a field that is not present in this mask, that field
  // will not be returned in the response.
  DocumentMask mask = 2;

  // The consistency mode for this transaction.
  // If not set, defaults to strong consistency.
  oneof consistency_selector {
    // Reads the document in a transaction.
    bytes transaction = 3;

    // Reads the version of the document at the given time.
    // This may not be older than 60 seconds.
    google.protobuf.Timestamp read_time = 5;
  }
}

// The request for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments].
message ListDocumentsRequest {
  // The parent resource name. In the format:
  // `projects/{project_id}/databases/{database_id}/documents` or
  // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  // For example:
  // `projects/my-project/databases/my-database/documents` or
  // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
  string parent = 1;

  // The collection ID, relative to `parent`, to list. For example: `chatrooms`
  // or `messages`.
  string collection_id = 2;

  // The maximum number of documents to return.
  int32 page_size = 3;

  // The `next_page_token` value returned from a previous List request, if any.
  string page_token = 4;

  // The order to sort results by. For example: `priority desc, name`.
  string order_by = 6;

  // The fields to return. If not set, returns all fields.
  //
  // If a document has a field that is not present in this mask, that field
  // will not be returned in the response.
  DocumentMask mask = 7;

  // The consistency mode for this transaction.
  // If not set, defaults to strong consistency.
  oneof consistency_selector {
    // Reads documents in a transaction.
    bytes transaction = 8;

    // Reads documents as they were at the given time.
    // This may not be older than 60 seconds.
    google.protobuf.Timestamp read_time = 10;
  }

  // If the list should show missing documents. A missing document is a
  // document that does not exist but has sub-documents. These documents will
  // be returned with a key but will not have fields, [Document.create_time][google.firestore.v1beta1.Document.create_time],
  // or [Document.update_time][google.firestore.v1beta1.Document.update_time] set.
  //
  // Requests with `show_missing` may not specify `where` or
  // `order_by`.
  bool show_missing = 12;
}

// The response for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments].
message ListDocumentsResponse {
  // The Documents found.
  repeated Document documents = 1;

  // The next page token.
  string next_page_token = 2;
}

// The request for [Firestore.CreateDocument][google.firestore.v1beta1.Firestore.CreateDocument].
message CreateDocumentRequest {
  // The parent resource. For example:
  // `projects/{project_id}/databases/{database_id}/documents` or
  // `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
  string parent = 1;

  // The collection ID, relative to `parent`, to list. For example: `chatrooms`.
  string collection_id = 2;

  // The client-assigned document ID to use for this document.
  //
  // Optional. If not specified, an ID will be assigned by the service.
  string document_id = 3;

  // The document to create. `name` must not be set.
  Document document = 4;

  // The fields to return. If not set, returns all fields.
  //
  // If the document has a field that is not present in this mask, that field
  // will not be returned in the response.
  DocumentMask mask = 5;
}

// The request for [Firestore.UpdateDocument][google.firestore.v1beta1.Firestore.UpdateDocument].
message UpdateDocumentRequest {
  // The updated document.
  // Creates the document if it does not already exist.
  Document document = 1;

  // The fields to update.
  // None of the field paths in the mask may contain a reserved name.
  //
  // If the document exists on the server and has fields not referenced in the
  // mask, they are left unchanged.
  // Fields referenced in the mask, but not present in the input document, are
  // deleted from the document on the server.
  DocumentMask update_mask = 2;

  // The fields to return. If not set, returns all fields.
  //
  // If the document has a field that is not present in this mask, that field
  // will not be returned in the response.
  DocumentMask mask = 3;

  // An optional precondition on the document.
  // The request will fail if this is set and not met by the target document.
  Precondition current_document = 4;
}

// The request for [Firestore.DeleteDocument][google.firestore.v1beta1.Firestore.DeleteDocument].
message DeleteDocumentRequest {
  // The resource name of the Document to delete. In the format:
  // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  string name = 1;

  // An optional precondition on the document.
  // The request will fail if this is set and not met by the target document.
  Precondition current_document = 2;
}

// The request for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments].
message BatchGetDocumentsRequest {
  // The database name. In the format:
  // `projects/{project_id}/databases/{database_id}`.
  string database = 1;

  // The names of the documents to retrieve. In the format:
  // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  // The request will fail if any of the document is not a child resource of the
  // given `database`. Duplicate names will be elided.
  repeated string documents = 2;

  // The fields to return. If not set, returns all fields.
  //
  // If a document has a field that is not present in this mask, that field will
  // not be returned in the response.
  DocumentMask mask = 3;

  // The consistency mode for this transaction.
  // If not set, defaults to strong consistency.
  oneof consistency_selector {
    // Reads documents in a transaction.
    bytes transaction = 4;

    // Starts a new transaction and reads the documents.
    // Defaults to a read-only transaction.
    // The new transaction ID will be returned as the first response in the
    // stream.
    TransactionOptions new_transaction = 5;

    // Reads documents as they were at the given time.
    // This may not be older than 60 seconds.
    google.protobuf.Timestamp read_time = 7;
  }
}

// The streamed response for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments].
message BatchGetDocumentsResponse {
  // A single result.
  // This can be empty if the server is just returning a transaction.
  oneof result {
    // A document that was requested.
    Document found = 1;

    // A document name that was requested but does not exist. In the format:
    // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
    string missing = 2;
  }

  // The transaction that was started as part of this request.
  // Will only be set in the first response, and only if
  // [BatchGetDocumentsRequest.new_transaction][google.firestore.v1beta1.BatchGetDocumentsRequest.new_transaction] was set in the request.
  bytes transaction = 3;

  // The time at which the document was read.
  // This may be monotically increasing, in this case the previous documents in
  // the result stream are guaranteed not to have changed between their
  // read_time and this one.
  google.protobuf.Timestamp read_time = 4;
}

// The request for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction].
message BeginTransactionRequest {
  // The database name. In the format:
  // `projects/{project_id}/databases/{database_id}`.
  string database = 1;

  // The options for the transaction.
  // Defaults to a read-write transaction.
  TransactionOptions options = 2;
}

// The response for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction].
message BeginTransactionResponse {
  // The transaction that was started.
  bytes transaction = 1;
}

// The request for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit].
message CommitRequest {
  // The database name. In the format:
  // `projects/{project_id}/databases/{database_id}`.
  string database = 1;

  // The writes to apply.
  //
  // Always executed atomically and in order.
  repeated Write writes = 2;

  // If set, applies all writes in this transaction, and commits it.
  bytes transaction = 3;
}

// The response for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit].
message CommitResponse {
  // The result of applying the writes.
  //
  // This i-th write result corresponds to the i-th write in the
  // request.
  repeated WriteResult write_results = 1;

  // The time at which the commit occurred.
  google.protobuf.Timestamp commit_time = 2;
}

// The request for [Firestore.Rollback][google.firestore.v1beta1.Firestore.Rollback].
message RollbackRequest {
  // The database name. In the format:
  // `projects/{project_id}/databases/{database_id}`.
  string database = 1;

  // The transaction to roll back.
  bytes transaction = 2;
}

// The request for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery].
message RunQueryRequest {
  // The parent resource name. In the format:
  // `projects/{project_id}/databases/{database_id}/documents` or
  // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  // For example:
  // `projects/my-project/databases/my-database/documents` or
  // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
  string parent = 1;

  // The query to run.
  oneof query_type {
    // A structured query.
    StructuredQuery structured_query = 2;
  }

  // The consistency mode for this transaction.
  // If not set, defaults to strong consistency.
  oneof consistency_selector {
    // Reads documents in a transaction.
    bytes transaction = 5;

    // Starts a new transaction and reads the documents.
    // Defaults to a read-only transaction.
    // The new transaction ID will be returned as the first response in the
    // stream.
    TransactionOptions new_transaction = 6;

    // Reads documents as they were at the given time.
    // This may not be older than 60 seconds.
    google.protobuf.Timestamp read_time = 7;
  }
}

// The response for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery].
message RunQueryResponse {
  // The transaction that was started as part of this request.
  // Can only be set in the first response, and only if
  // [RunQueryRequest.new_transaction][google.firestore.v1beta1.RunQueryRequest.new_transaction] was set in the request.
  // If set, no other fields will be set in this response.
  bytes transaction = 2;

  // A query result.
  // Not set when reporting partial progress.
  Document document = 1;

  // The time at which the document was read. This may be monotonically
  // increasing; in this case, the previous documents in the result stream are
  // guaranteed not to have changed between their `read_time` and this one.
  //
  // If the query returns no results, a response with `read_time` and no
  // `document` will be sent, and this represents the time at which the query
  // was run.
  google.protobuf.Timestamp read_time = 3;

  // The number of results that have been skipped due to an offset between
  // the last response and the current response.
  int32 skipped_results = 4;
}

// The request for [Firestore.Write][google.firestore.v1beta1.Firestore.Write].
//
// The first request creates a stream, or resumes an existing one from a token.
//
// When creating a new stream, the server replies with a response containing
// only an ID and a token, to use in the next request.
//
// When resuming a stream, the server first streams any responses later than the
// given token, then a response containing only an up-to-date token, to use in
// the next request.
message WriteRequest {
  // The database name. In the format:
  // `projects/{project_id}/databases/{database_id}`.
  // This is only required in the first message.
  string database = 1;

  // The ID of the write stream to resume.
  // This may only be set in the first message. When left empty, a new write
  // stream will be created.
  string stream_id = 2;

  // The writes to apply.
  //
  // Always executed atomically and in order.
  // This must be empty on the first request.
  // This may be empty on the last request.
  // This must not be empty on all other requests.
  repeated Write writes = 3;

  // A stream token that was previously sent by the server.
  //
  // The client should set this field to the token from the most recent
  // [WriteResponse][google.firestore.v1beta1.WriteResponse] it has received. This acknowledges that the client has
  // received responses up to this token. After sending this token, earlier
  // tokens may not be used anymore.
  //
  // The server may close the stream if there are too many unacknowledged
  // responses.
  //
  // Leave this field unset when creating a new stream. To resume a stream at
  // a specific point, set this field and the `stream_id` field.
  //
  // Leave this field unset when creating a new stream.
  bytes stream_token = 4;

  // Labels associated with this write request.
  map<string, string> labels = 5;
}

// The response for [Firestore.Write][google.firestore.v1beta1.Firestore.Write].
message WriteResponse {
  // The ID of the stream.
  // Only set on the first message, when a new stream was created.
  string stream_id = 1;

  // A token that represents the position of this response in the stream.
  // This can be used by a client to resume the stream at this point.
  //
  // This field is always set.
  bytes stream_token = 2;

  // The result of applying the writes.
  //
  // This i-th write result corresponds to the i-th write in the
  // request.
  repeated WriteResult write_results = 3;

  // The time at which the commit occurred.
  google.protobuf.Timestamp commit_time = 4;
}

// A request for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen]
message ListenRequest {
  // The database name. In the format:
  // `projects/{project_id}/databases/{database_id}`.
  string database = 1;

  // The supported target changes.
  oneof target_change {
    // A target to add to this stream.
    Target add_target = 2;

    // The ID of a target to remove from this stream.
    int32 remove_target = 3;
  }

  // Labels associated with this target change.
  map<string, string> labels = 4;
}

// The response for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen].
message ListenResponse {
  // The supported responses.
  oneof response_type {
    // Targets have changed.
    TargetChange target_change = 2;

    // A [Document][google.firestore.v1beta1.Document] has changed.
    DocumentChange document_change = 3;

    // A [Document][google.firestore.v1beta1.Document] has been deleted.
    DocumentDelete document_delete = 4;

    // A [Document][google.firestore.v1beta1.Document] has been removed from a target (because it is no longer
    // relevant to that target).
    DocumentRemove document_remove = 6;

    // A filter to apply to the set of documents previously returned for the
    // given target.
    //
    // Returned when documents may have been removed from the given target, but
    // the exact documents are unknown.
    ExistenceFilter filter = 5;
  }
}

// A specification of a set of documents to listen to.
message Target {
  // A target specified by a set of documents names.
  message DocumentsTarget {
    // The names of the documents to retrieve. In the format:
    // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
    // The request will fail if any of the document is not a child resource of
    // the given `database`. Duplicate names will be elided.
    repeated string documents = 2;
  }

  // A target specified by a query.
  message QueryTarget {
    // The parent resource name. In the format:
    // `projects/{project_id}/databases/{database_id}/documents` or
    // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
    // For example:
    // `projects/my-project/databases/my-database/documents` or
    // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
    string parent = 1;

    // The query to run.
    oneof query_type {
      // A structured query.
      StructuredQuery structured_query = 2;
    }
  }

  // The type of target to listen to.
  oneof target_type {
    // A target specified by a query.
    QueryTarget query = 2;

    // A target specified by a set of document names.
    DocumentsTarget documents = 3;
  }

  // When to start listening.
  //
  // If not specified, all matching Documents are returned before any
  // subsequent changes.
  oneof resume_type {
    // A resume token from a prior [TargetChange][google.firestore.v1beta1.TargetChange] for an identical target.
    //
    // Using a resume token with a different target is unsupported and may fail.
    bytes resume_token = 4;

    // Start listening after a specific `read_time`.
    //
    // The client must know the state of matching documents at this time.
    google.protobuf.Timestamp read_time = 11;
  }

  // A client provided target ID.
  //
  // If not set, the server will assign an ID for the target.
  //
  // Used for resuming a target without changing IDs. The IDs can either be
  // client-assigned or be server-assigned in a previous stream. All targets
  // with client provided IDs must be added before adding a target that needs
  // a server-assigned id.
  int32 target_id = 5;

  // If the target should be removed once it is current and consistent.
  bool once = 6;
}

// Targets being watched have changed.
message TargetChange {
  // The type of change.
  enum TargetChangeType {
    // No change has occurred. Used only to send an updated `resume_token`.
    NO_CHANGE = 0;

    // The targets have been added.
    ADD = 1;

    // The targets have been removed.
    REMOVE = 2;

    // The targets reflect all changes committed before the targets were added
    // to the stream.
    //
    // This will be sent after or with a `read_time` that is greater than or
    // equal to the time at which the targets were added.
    //
    // Listeners can wait for this change if read-after-write semantics
    // are desired.
    CURRENT = 3;

    // The targets have been reset, and a new initial state for the targets
    // will be returned in subsequent changes.
    //
    // After the initial state is complete, `CURRENT` will be returned even
    // if the target was previously indicated to be `CURRENT`.
    RESET = 4;
  }

  // The type of change that occurred.
  TargetChangeType target_change_type = 1;

  // The target IDs of targets that have changed.
  //
  // If empty, the change applies to all targets.
  //
  // For `target_change_type=ADD`, the order of the target IDs matches the order
  // of the requests to add the targets. This allows clients to unambiguously
  // associate server-assigned target IDs with added targets.
  //
  // For other states, the order of the target IDs is not defined.
  repeated int32 target_ids = 2;

  // The error that resulted in this change, if applicable.
  google.rpc.Status cause = 3;

  // A token that can be used to resume the stream for the given `target_ids`,
  // or all targets if `target_ids` is empty.
  //
  // Not set on every target change.
  bytes resume_token = 4;

  // The consistent `read_time` for the given `target_ids` (omitted when the
  // target_ids are not at a consistent snapshot).
  //
  // The stream is guaranteed to send a `read_time` with `target_ids` empty
  // whenever the entire stream reaches a new consistent snapshot. ADD,
  // CURRENT, and RESET messages are guaranteed to (eventually) result in a
  // new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
  //
  // For a given stream, `read_time` is guaranteed to be monotonically
  // increasing.
  google.protobuf.Timestamp read_time = 6;
}

// The request for [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds].
message ListCollectionIdsRequest {
  // The parent document. In the format:
  // `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
  // For example:
  // `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
  string parent = 1;

  // The maximum number of results to return.
  int32 page_size = 2;

  // A page token. Must be a value from
  // [ListCollectionIdsResponse][google.firestore.v1beta1.ListCollectionIdsResponse].
  string page_token = 3;
}

// The response from [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds].
message ListCollectionIdsResponse {
  // The collection ids.
  repeated string collection_ids = 1;

  // A page token that may be used to continue the list.
  string next_page_token = 2;
}