google-cloud-firestore 0.24.2 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CHANGELOG.md +26 -0
  4. data/EMULATOR.md +49 -0
  5. data/lib/google-cloud-firestore.rb +6 -1
  6. data/lib/google/cloud/firestore.rb +36 -8
  7. data/lib/google/cloud/firestore/batch.rb +1 -1
  8. data/lib/google/cloud/firestore/client.rb +152 -4
  9. data/lib/google/cloud/firestore/collection_reference.rb +1 -1
  10. data/lib/google/cloud/firestore/commit_response.rb +1 -1
  11. data/lib/google/cloud/firestore/convert.rb +53 -38
  12. data/lib/google/cloud/firestore/credentials.rb +2 -2
  13. data/lib/google/cloud/firestore/document_reference.rb +2 -1
  14. data/lib/google/cloud/firestore/document_snapshot.rb +5 -5
  15. data/lib/google/cloud/firestore/field_path.rb +2 -2
  16. data/lib/google/cloud/firestore/field_value.rb +139 -9
  17. data/lib/google/cloud/firestore/query.rb +21 -15
  18. data/lib/google/cloud/firestore/query_snapshot.rb +1 -1
  19. data/lib/google/cloud/firestore/service.rb +31 -13
  20. data/lib/google/cloud/firestore/transaction.rb +39 -5
  21. data/lib/google/cloud/firestore/v1.rb +152 -0
  22. data/lib/google/cloud/firestore/v1/credentials.rb +42 -0
  23. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/common.rb +64 -0
  24. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/document.rb +136 -0
  25. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/firestore.rb +574 -0
  26. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/query.rb +219 -0
  27. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/write.rb +237 -0
  28. data/lib/google/cloud/firestore/v1/doc/google/protobuf/any.rb +130 -0
  29. data/lib/google/cloud/firestore/v1/doc/google/protobuf/empty.rb +29 -0
  30. data/lib/google/cloud/firestore/v1/doc/google/protobuf/timestamp.rb +109 -0
  31. data/lib/google/cloud/firestore/v1/doc/google/protobuf/wrappers.rb +26 -0
  32. data/lib/google/cloud/firestore/v1/doc/google/rpc/status.rb +84 -0
  33. data/lib/google/cloud/firestore/v1/firestore_client.rb +1044 -0
  34. data/lib/google/cloud/firestore/v1/firestore_client_config.json +100 -0
  35. data/lib/google/cloud/firestore/v1beta1.rb +1 -1
  36. data/lib/google/cloud/firestore/v1beta1/credentials.rb +1 -1
  37. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/common.rb +1 -1
  38. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/document.rb +1 -1
  39. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/firestore.rb +1 -1
  40. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/query.rb +1 -1
  41. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/write.rb +41 -1
  42. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/any.rb +1 -1
  43. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/empty.rb +1 -1
  44. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/timestamp.rb +1 -1
  45. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/wrappers.rb +1 -65
  46. data/lib/google/cloud/firestore/v1beta1/doc/google/rpc/status.rb +1 -1
  47. data/lib/google/cloud/firestore/v1beta1/firestore_client.rb +1 -1
  48. data/lib/google/cloud/firestore/v1beta1/firestore_client_config.json +1 -1
  49. data/lib/google/cloud/firestore/version.rb +1 -1
  50. data/lib/google/cloud/firestore/watch/enumerator_queue.rb +0 -2
  51. data/lib/google/cloud/firestore/watch/inventory.rb +2 -2
  52. data/lib/google/cloud/firestore/watch/listener.rb +16 -17
  53. data/lib/google/cloud/firestore/watch/order.rb +1 -1
  54. data/lib/google/firestore/v1/common_pb.rb +45 -0
  55. data/lib/google/firestore/v1/document_pb.rb +50 -0
  56. data/lib/google/firestore/v1/firestore_pb.rb +220 -0
  57. data/lib/google/firestore/v1/firestore_services_pb.rb +87 -0
  58. data/lib/google/firestore/v1/query_pb.rb +105 -0
  59. data/lib/google/firestore/v1/write_pb.rb +79 -0
  60. data/lib/google/firestore/v1beta1/firestore_services_pb.rb +2 -1
  61. data/lib/google/firestore/v1beta1/write_pb.rb +3 -0
  62. metadata +26 -5
@@ -0,0 +1,574 @@
1
+ # Copyright 2019 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
+ # https://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
+
16
+ module Google
17
+ module Firestore
18
+ module V1
19
+ # The request for {Google::Firestore::V1::Firestore::GetDocument Firestore::GetDocument}.
20
+ # @!attribute [rw] name
21
+ # @return [String]
22
+ # The resource name of the Document to get. In the format:
23
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
24
+ # @!attribute [rw] mask
25
+ # @return [Google::Firestore::V1::DocumentMask]
26
+ # The fields to return. If not set, returns all fields.
27
+ #
28
+ # If the document has a field that is not present in this mask, that field
29
+ # will not be returned in the response.
30
+ # @!attribute [rw] transaction
31
+ # @return [String]
32
+ # Reads the document in a transaction.
33
+ # @!attribute [rw] read_time
34
+ # @return [Google::Protobuf::Timestamp]
35
+ # Reads the version of the document at the given time.
36
+ # This may not be older than 60 seconds.
37
+ class GetDocumentRequest; end
38
+
39
+ # The request for {Google::Firestore::V1::Firestore::ListDocuments Firestore::ListDocuments}.
40
+ # @!attribute [rw] parent
41
+ # @return [String]
42
+ # The parent resource name. In the format:
43
+ # `projects/{project_id}/databases/{database_id}/documents` or
44
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
45
+ # For example:
46
+ # `projects/my-project/databases/my-database/documents` or
47
+ # `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
48
+ # @!attribute [rw] collection_id
49
+ # @return [String]
50
+ # The collection ID, relative to `parent`, to list. For example: `chatrooms`
51
+ # or `messages`.
52
+ # @!attribute [rw] page_size
53
+ # @return [Integer]
54
+ # The maximum number of documents to return.
55
+ # @!attribute [rw] page_token
56
+ # @return [String]
57
+ # The `next_page_token` value returned from a previous List request, if any.
58
+ # @!attribute [rw] order_by
59
+ # @return [String]
60
+ # The order to sort results by. For example: `priority desc, name`.
61
+ # @!attribute [rw] mask
62
+ # @return [Google::Firestore::V1::DocumentMask]
63
+ # The fields to return. If not set, returns all fields.
64
+ #
65
+ # If a document has a field that is not present in this mask, that field
66
+ # will not be returned in the response.
67
+ # @!attribute [rw] transaction
68
+ # @return [String]
69
+ # Reads documents in a transaction.
70
+ # @!attribute [rw] read_time
71
+ # @return [Google::Protobuf::Timestamp]
72
+ # Reads documents as they were at the given time.
73
+ # This may not be older than 60 seconds.
74
+ # @!attribute [rw] show_missing
75
+ # @return [true, false]
76
+ # If the list should show missing documents. A missing document is a
77
+ # document that does not exist but has sub-documents. These documents will
78
+ # be returned with a key but will not have fields, {Google::Firestore::V1::Document#create_time Document#create_time},
79
+ # or {Google::Firestore::V1::Document#update_time Document#update_time} set.
80
+ #
81
+ # Requests with `show_missing` may not specify `where` or
82
+ # `order_by`.
83
+ class ListDocumentsRequest; end
84
+
85
+ # The response for {Google::Firestore::V1::Firestore::ListDocuments Firestore::ListDocuments}.
86
+ # @!attribute [rw] documents
87
+ # @return [Array<Google::Firestore::V1::Document>]
88
+ # The Documents found.
89
+ # @!attribute [rw] next_page_token
90
+ # @return [String]
91
+ # The next page token.
92
+ class ListDocumentsResponse; end
93
+
94
+ # The request for {Google::Firestore::V1::Firestore::CreateDocument Firestore::CreateDocument}.
95
+ # @!attribute [rw] parent
96
+ # @return [String]
97
+ # The parent resource. For example:
98
+ # `projects/{project_id}/databases/{database_id}/documents` or
99
+ # `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
100
+ # @!attribute [rw] collection_id
101
+ # @return [String]
102
+ # The collection ID, relative to `parent`, to list. For example: `chatrooms`.
103
+ # @!attribute [rw] document_id
104
+ # @return [String]
105
+ # The client-assigned document ID to use for this document.
106
+ #
107
+ # Optional. If not specified, an ID will be assigned by the service.
108
+ # @!attribute [rw] document
109
+ # @return [Google::Firestore::V1::Document]
110
+ # The document to create. `name` must not be set.
111
+ # @!attribute [rw] mask
112
+ # @return [Google::Firestore::V1::DocumentMask]
113
+ # The fields to return. If not set, returns all fields.
114
+ #
115
+ # If the document has a field that is not present in this mask, that field
116
+ # will not be returned in the response.
117
+ class CreateDocumentRequest; end
118
+
119
+ # The request for {Google::Firestore::V1::Firestore::UpdateDocument Firestore::UpdateDocument}.
120
+ # @!attribute [rw] document
121
+ # @return [Google::Firestore::V1::Document]
122
+ # The updated document.
123
+ # Creates the document if it does not already exist.
124
+ # @!attribute [rw] update_mask
125
+ # @return [Google::Firestore::V1::DocumentMask]
126
+ # The fields to update.
127
+ # None of the field paths in the mask may contain a reserved name.
128
+ #
129
+ # If the document exists on the server and has fields not referenced in the
130
+ # mask, they are left unchanged.
131
+ # Fields referenced in the mask, but not present in the input document, are
132
+ # deleted from the document on the server.
133
+ # @!attribute [rw] mask
134
+ # @return [Google::Firestore::V1::DocumentMask]
135
+ # The fields to return. If not set, returns all fields.
136
+ #
137
+ # If the document has a field that is not present in this mask, that field
138
+ # will not be returned in the response.
139
+ # @!attribute [rw] current_document
140
+ # @return [Google::Firestore::V1::Precondition]
141
+ # An optional precondition on the document.
142
+ # The request will fail if this is set and not met by the target document.
143
+ class UpdateDocumentRequest; end
144
+
145
+ # The request for {Google::Firestore::V1::Firestore::DeleteDocument Firestore::DeleteDocument}.
146
+ # @!attribute [rw] name
147
+ # @return [String]
148
+ # The resource name of the Document to delete. In the format:
149
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
150
+ # @!attribute [rw] current_document
151
+ # @return [Google::Firestore::V1::Precondition]
152
+ # An optional precondition on the document.
153
+ # The request will fail if this is set and not met by the target document.
154
+ class DeleteDocumentRequest; end
155
+
156
+ # The request for {Google::Firestore::V1::Firestore::BatchGetDocuments Firestore::BatchGetDocuments}.
157
+ # @!attribute [rw] database
158
+ # @return [String]
159
+ # The database name. In the format:
160
+ # `projects/{project_id}/databases/{database_id}`.
161
+ # @!attribute [rw] documents
162
+ # @return [Array<String>]
163
+ # The names of the documents to retrieve. In the format:
164
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
165
+ # The request will fail if any of the document is not a child resource of the
166
+ # given `database`. Duplicate names will be elided.
167
+ # @!attribute [rw] mask
168
+ # @return [Google::Firestore::V1::DocumentMask]
169
+ # The fields to return. If not set, returns all fields.
170
+ #
171
+ # If a document has a field that is not present in this mask, that field will
172
+ # not be returned in the response.
173
+ # @!attribute [rw] transaction
174
+ # @return [String]
175
+ # Reads documents in a transaction.
176
+ # @!attribute [rw] new_transaction
177
+ # @return [Google::Firestore::V1::TransactionOptions]
178
+ # Starts a new transaction and reads the documents.
179
+ # Defaults to a read-only transaction.
180
+ # The new transaction ID will be returned as the first response in the
181
+ # stream.
182
+ # @!attribute [rw] read_time
183
+ # @return [Google::Protobuf::Timestamp]
184
+ # Reads documents as they were at the given time.
185
+ # This may not be older than 60 seconds.
186
+ class BatchGetDocumentsRequest; end
187
+
188
+ # The streamed response for {Google::Firestore::V1::Firestore::BatchGetDocuments Firestore::BatchGetDocuments}.
189
+ # @!attribute [rw] found
190
+ # @return [Google::Firestore::V1::Document]
191
+ # A document that was requested.
192
+ # @!attribute [rw] missing
193
+ # @return [String]
194
+ # A document name that was requested but does not exist. In the format:
195
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
196
+ # @!attribute [rw] transaction
197
+ # @return [String]
198
+ # The transaction that was started as part of this request.
199
+ # Will only be set in the first response, and only if
200
+ # {Google::Firestore::V1::BatchGetDocumentsRequest#new_transaction BatchGetDocumentsRequest#new_transaction} was set in the request.
201
+ # @!attribute [rw] read_time
202
+ # @return [Google::Protobuf::Timestamp]
203
+ # The time at which the document was read.
204
+ # This may be monotically increasing, in this case the previous documents in
205
+ # the result stream are guaranteed not to have changed between their
206
+ # read_time and this one.
207
+ class BatchGetDocumentsResponse; end
208
+
209
+ # The request for {Google::Firestore::V1::Firestore::BeginTransaction Firestore::BeginTransaction}.
210
+ # @!attribute [rw] database
211
+ # @return [String]
212
+ # The database name. In the format:
213
+ # `projects/{project_id}/databases/{database_id}`.
214
+ # @!attribute [rw] options
215
+ # @return [Google::Firestore::V1::TransactionOptions]
216
+ # The options for the transaction.
217
+ # Defaults to a read-write transaction.
218
+ class BeginTransactionRequest; end
219
+
220
+ # The response for {Google::Firestore::V1::Firestore::BeginTransaction Firestore::BeginTransaction}.
221
+ # @!attribute [rw] transaction
222
+ # @return [String]
223
+ # The transaction that was started.
224
+ class BeginTransactionResponse; end
225
+
226
+ # The request for {Google::Firestore::V1::Firestore::Commit Firestore::Commit}.
227
+ # @!attribute [rw] database
228
+ # @return [String]
229
+ # The database name. In the format:
230
+ # `projects/{project_id}/databases/{database_id}`.
231
+ # @!attribute [rw] writes
232
+ # @return [Array<Google::Firestore::V1::Write>]
233
+ # The writes to apply.
234
+ #
235
+ # Always executed atomically and in order.
236
+ # @!attribute [rw] transaction
237
+ # @return [String]
238
+ # If set, applies all writes in this transaction, and commits it.
239
+ class CommitRequest; end
240
+
241
+ # The response for {Google::Firestore::V1::Firestore::Commit Firestore::Commit}.
242
+ # @!attribute [rw] write_results
243
+ # @return [Array<Google::Firestore::V1::WriteResult>]
244
+ # The result of applying the writes.
245
+ #
246
+ # This i-th write result corresponds to the i-th write in the
247
+ # request.
248
+ # @!attribute [rw] commit_time
249
+ # @return [Google::Protobuf::Timestamp]
250
+ # The time at which the commit occurred.
251
+ class CommitResponse; end
252
+
253
+ # The request for {Google::Firestore::V1::Firestore::Rollback Firestore::Rollback}.
254
+ # @!attribute [rw] database
255
+ # @return [String]
256
+ # The database name. In the format:
257
+ # `projects/{project_id}/databases/{database_id}`.
258
+ # @!attribute [rw] transaction
259
+ # @return [String]
260
+ # The transaction to roll back.
261
+ class RollbackRequest; end
262
+
263
+ # The request for {Google::Firestore::V1::Firestore::RunQuery Firestore::RunQuery}.
264
+ # @!attribute [rw] parent
265
+ # @return [String]
266
+ # The parent resource name. In the format:
267
+ # `projects/{project_id}/databases/{database_id}/documents` or
268
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
269
+ # For example:
270
+ # `projects/my-project/databases/my-database/documents` or
271
+ # `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
272
+ # @!attribute [rw] structured_query
273
+ # @return [Google::Firestore::V1::StructuredQuery]
274
+ # A structured query.
275
+ # @!attribute [rw] transaction
276
+ # @return [String]
277
+ # Reads documents in a transaction.
278
+ # @!attribute [rw] new_transaction
279
+ # @return [Google::Firestore::V1::TransactionOptions]
280
+ # Starts a new transaction and reads the documents.
281
+ # Defaults to a read-only transaction.
282
+ # The new transaction ID will be returned as the first response in the
283
+ # stream.
284
+ # @!attribute [rw] read_time
285
+ # @return [Google::Protobuf::Timestamp]
286
+ # Reads documents as they were at the given time.
287
+ # This may not be older than 60 seconds.
288
+ class RunQueryRequest; end
289
+
290
+ # The response for {Google::Firestore::V1::Firestore::RunQuery Firestore::RunQuery}.
291
+ # @!attribute [rw] transaction
292
+ # @return [String]
293
+ # The transaction that was started as part of this request.
294
+ # Can only be set in the first response, and only if
295
+ # {Google::Firestore::V1::RunQueryRequest#new_transaction RunQueryRequest#new_transaction} was set in the request.
296
+ # If set, no other fields will be set in this response.
297
+ # @!attribute [rw] document
298
+ # @return [Google::Firestore::V1::Document]
299
+ # A query result.
300
+ # Not set when reporting partial progress.
301
+ # @!attribute [rw] read_time
302
+ # @return [Google::Protobuf::Timestamp]
303
+ # The time at which the document was read. This may be monotonically
304
+ # increasing; in this case, the previous documents in the result stream are
305
+ # guaranteed not to have changed between their `read_time` and this one.
306
+ #
307
+ # If the query returns no results, a response with `read_time` and no
308
+ # `document` will be sent, and this represents the time at which the query
309
+ # was run.
310
+ # @!attribute [rw] skipped_results
311
+ # @return [Integer]
312
+ # The number of results that have been skipped due to an offset between
313
+ # the last response and the current response.
314
+ class RunQueryResponse; end
315
+
316
+ # The request for {Google::Firestore::V1::Firestore::Write Firestore::Write}.
317
+ #
318
+ # The first request creates a stream, or resumes an existing one from a token.
319
+ #
320
+ # When creating a new stream, the server replies with a response containing
321
+ # only an ID and a token, to use in the next request.
322
+ #
323
+ # When resuming a stream, the server first streams any responses later than the
324
+ # given token, then a response containing only an up-to-date token, to use in
325
+ # the next request.
326
+ # @!attribute [rw] database
327
+ # @return [String]
328
+ # The database name. In the format:
329
+ # `projects/{project_id}/databases/{database_id}`.
330
+ # This is only required in the first message.
331
+ # @!attribute [rw] stream_id
332
+ # @return [String]
333
+ # The ID of the write stream to resume.
334
+ # This may only be set in the first message. When left empty, a new write
335
+ # stream will be created.
336
+ # @!attribute [rw] writes
337
+ # @return [Array<Google::Firestore::V1::Write>]
338
+ # The writes to apply.
339
+ #
340
+ # Always executed atomically and in order.
341
+ # This must be empty on the first request.
342
+ # This may be empty on the last request.
343
+ # This must not be empty on all other requests.
344
+ # @!attribute [rw] stream_token
345
+ # @return [String]
346
+ # A stream token that was previously sent by the server.
347
+ #
348
+ # The client should set this field to the token from the most recent
349
+ # {Google::Firestore::V1::WriteResponse WriteResponse} it has received. This acknowledges that the client has
350
+ # received responses up to this token. After sending this token, earlier
351
+ # tokens may not be used anymore.
352
+ #
353
+ # The server may close the stream if there are too many unacknowledged
354
+ # responses.
355
+ #
356
+ # Leave this field unset when creating a new stream. To resume a stream at
357
+ # a specific point, set this field and the `stream_id` field.
358
+ #
359
+ # Leave this field unset when creating a new stream.
360
+ # @!attribute [rw] labels
361
+ # @return [Hash{String => String}]
362
+ # Labels associated with this write request.
363
+ class WriteRequest; end
364
+
365
+ # The response for {Google::Firestore::V1::Firestore::Write Firestore::Write}.
366
+ # @!attribute [rw] stream_id
367
+ # @return [String]
368
+ # The ID of the stream.
369
+ # Only set on the first message, when a new stream was created.
370
+ # @!attribute [rw] stream_token
371
+ # @return [String]
372
+ # A token that represents the position of this response in the stream.
373
+ # This can be used by a client to resume the stream at this point.
374
+ #
375
+ # This field is always set.
376
+ # @!attribute [rw] write_results
377
+ # @return [Array<Google::Firestore::V1::WriteResult>]
378
+ # The result of applying the writes.
379
+ #
380
+ # This i-th write result corresponds to the i-th write in the
381
+ # request.
382
+ # @!attribute [rw] commit_time
383
+ # @return [Google::Protobuf::Timestamp]
384
+ # The time at which the commit occurred.
385
+ class WriteResponse; end
386
+
387
+ # A request for {Google::Firestore::V1::Firestore::Listen Firestore::Listen}
388
+ # @!attribute [rw] database
389
+ # @return [String]
390
+ # The database name. In the format:
391
+ # `projects/{project_id}/databases/{database_id}`.
392
+ # @!attribute [rw] add_target
393
+ # @return [Google::Firestore::V1::Target]
394
+ # A target to add to this stream.
395
+ # @!attribute [rw] remove_target
396
+ # @return [Integer]
397
+ # The ID of a target to remove from this stream.
398
+ # @!attribute [rw] labels
399
+ # @return [Hash{String => String}]
400
+ # Labels associated with this target change.
401
+ class ListenRequest; end
402
+
403
+ # The response for {Google::Firestore::V1::Firestore::Listen Firestore::Listen}.
404
+ # @!attribute [rw] target_change
405
+ # @return [Google::Firestore::V1::TargetChange]
406
+ # Targets have changed.
407
+ # @!attribute [rw] document_change
408
+ # @return [Google::Firestore::V1::DocumentChange]
409
+ # A {Google::Firestore::V1::Document Document} has changed.
410
+ # @!attribute [rw] document_delete
411
+ # @return [Google::Firestore::V1::DocumentDelete]
412
+ # A {Google::Firestore::V1::Document Document} has been deleted.
413
+ # @!attribute [rw] document_remove
414
+ # @return [Google::Firestore::V1::DocumentRemove]
415
+ # A {Google::Firestore::V1::Document Document} has been removed from a target (because it is no longer
416
+ # relevant to that target).
417
+ # @!attribute [rw] filter
418
+ # @return [Google::Firestore::V1::ExistenceFilter]
419
+ # A filter to apply to the set of documents previously returned for the
420
+ # given target.
421
+ #
422
+ # Returned when documents may have been removed from the given target, but
423
+ # the exact documents are unknown.
424
+ class ListenResponse; end
425
+
426
+ # A specification of a set of documents to listen to.
427
+ # @!attribute [rw] query
428
+ # @return [Google::Firestore::V1::Target::QueryTarget]
429
+ # A target specified by a query.
430
+ # @!attribute [rw] documents
431
+ # @return [Google::Firestore::V1::Target::DocumentsTarget]
432
+ # A target specified by a set of document names.
433
+ # @!attribute [rw] resume_token
434
+ # @return [String]
435
+ # A resume token from a prior {Google::Firestore::V1::TargetChange TargetChange} for an identical target.
436
+ #
437
+ # Using a resume token with a different target is unsupported and may fail.
438
+ # @!attribute [rw] read_time
439
+ # @return [Google::Protobuf::Timestamp]
440
+ # Start listening after a specific `read_time`.
441
+ #
442
+ # The client must know the state of matching documents at this time.
443
+ # @!attribute [rw] target_id
444
+ # @return [Integer]
445
+ # A client provided target ID.
446
+ #
447
+ # If not set, the server will assign an ID for the target.
448
+ #
449
+ # Used for resuming a target without changing IDs. The IDs can either be
450
+ # client-assigned or be server-assigned in a previous stream. All targets
451
+ # with client provided IDs must be added before adding a target that needs
452
+ # a server-assigned id.
453
+ # @!attribute [rw] once
454
+ # @return [true, false]
455
+ # If the target should be removed once it is current and consistent.
456
+ class Target
457
+ # A target specified by a set of documents names.
458
+ # @!attribute [rw] documents
459
+ # @return [Array<String>]
460
+ # The names of the documents to retrieve. In the format:
461
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
462
+ # The request will fail if any of the document is not a child resource of
463
+ # the given `database`. Duplicate names will be elided.
464
+ class DocumentsTarget; end
465
+
466
+ # A target specified by a query.
467
+ # @!attribute [rw] parent
468
+ # @return [String]
469
+ # The parent resource name. In the format:
470
+ # `projects/{project_id}/databases/{database_id}/documents` or
471
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
472
+ # For example:
473
+ # `projects/my-project/databases/my-database/documents` or
474
+ # `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
475
+ # @!attribute [rw] structured_query
476
+ # @return [Google::Firestore::V1::StructuredQuery]
477
+ # A structured query.
478
+ class QueryTarget; end
479
+ end
480
+
481
+ # Targets being watched have changed.
482
+ # @!attribute [rw] target_change_type
483
+ # @return [Google::Firestore::V1::TargetChange::TargetChangeType]
484
+ # The type of change that occurred.
485
+ # @!attribute [rw] target_ids
486
+ # @return [Array<Integer>]
487
+ # The target IDs of targets that have changed.
488
+ #
489
+ # If empty, the change applies to all targets.
490
+ #
491
+ # For `target_change_type=ADD`, the order of the target IDs matches the order
492
+ # of the requests to add the targets. This allows clients to unambiguously
493
+ # associate server-assigned target IDs with added targets.
494
+ #
495
+ # For other states, the order of the target IDs is not defined.
496
+ # @!attribute [rw] cause
497
+ # @return [Google::Rpc::Status]
498
+ # The error that resulted in this change, if applicable.
499
+ # @!attribute [rw] resume_token
500
+ # @return [String]
501
+ # A token that can be used to resume the stream for the given `target_ids`,
502
+ # or all targets if `target_ids` is empty.
503
+ #
504
+ # Not set on every target change.
505
+ # @!attribute [rw] read_time
506
+ # @return [Google::Protobuf::Timestamp]
507
+ # The consistent `read_time` for the given `target_ids` (omitted when the
508
+ # target_ids are not at a consistent snapshot).
509
+ #
510
+ # The stream is guaranteed to send a `read_time` with `target_ids` empty
511
+ # whenever the entire stream reaches a new consistent snapshot. ADD,
512
+ # CURRENT, and RESET messages are guaranteed to (eventually) result in a
513
+ # new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
514
+ #
515
+ # For a given stream, `read_time` is guaranteed to be monotonically
516
+ # increasing.
517
+ class TargetChange
518
+ # The type of change.
519
+ module TargetChangeType
520
+ # No change has occurred. Used only to send an updated `resume_token`.
521
+ NO_CHANGE = 0
522
+
523
+ # The targets have been added.
524
+ ADD = 1
525
+
526
+ # The targets have been removed.
527
+ REMOVE = 2
528
+
529
+ # The targets reflect all changes committed before the targets were added
530
+ # to the stream.
531
+ #
532
+ # This will be sent after or with a `read_time` that is greater than or
533
+ # equal to the time at which the targets were added.
534
+ #
535
+ # Listeners can wait for this change if read-after-write semantics
536
+ # are desired.
537
+ CURRENT = 3
538
+
539
+ # The targets have been reset, and a new initial state for the targets
540
+ # will be returned in subsequent changes.
541
+ #
542
+ # After the initial state is complete, `CURRENT` will be returned even
543
+ # if the target was previously indicated to be `CURRENT`.
544
+ RESET = 4
545
+ end
546
+ end
547
+
548
+ # The request for {Google::Firestore::V1::Firestore::ListCollectionIds Firestore::ListCollectionIds}.
549
+ # @!attribute [rw] parent
550
+ # @return [String]
551
+ # The parent document. In the format:
552
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
553
+ # For example:
554
+ # `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
555
+ # @!attribute [rw] page_size
556
+ # @return [Integer]
557
+ # The maximum number of results to return.
558
+ # @!attribute [rw] page_token
559
+ # @return [String]
560
+ # A page token. Must be a value from
561
+ # {Google::Firestore::V1::ListCollectionIdsResponse ListCollectionIdsResponse}.
562
+ class ListCollectionIdsRequest; end
563
+
564
+ # The response from {Google::Firestore::V1::Firestore::ListCollectionIds Firestore::ListCollectionIds}.
565
+ # @!attribute [rw] collection_ids
566
+ # @return [Array<String>]
567
+ # The collection ids.
568
+ # @!attribute [rw] next_page_token
569
+ # @return [String]
570
+ # A page token that may be used to continue the list.
571
+ class ListCollectionIdsResponse; end
572
+ end
573
+ end
574
+ end