google-cloud-firestore-v1 0.7.1 → 0.9.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.
@@ -21,7 +21,8 @@ module Google
21
21
  module Cloud
22
22
  module Firestore
23
23
  module V1
24
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#get_document Firestore.GetDocument}.
24
+ # The request for
25
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#get_document Firestore.GetDocument}.
25
26
  # @!attribute [rw] name
26
27
  # @return [::String]
27
28
  # Required. The resource name of the Document to get. In the format:
@@ -44,68 +45,93 @@ module Google
44
45
  extend ::Google::Protobuf::MessageExts::ClassMethods
45
46
  end
46
47
 
47
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#list_documents Firestore.ListDocuments}.
48
+ # The request for
49
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#list_documents Firestore.ListDocuments}.
48
50
  # @!attribute [rw] parent
49
51
  # @return [::String]
50
52
  # Required. The parent resource name. In the format:
51
53
  # `projects/{project_id}/databases/{database_id}/documents` or
52
54
  # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
55
+ #
53
56
  # For example:
54
57
  # `projects/my-project/databases/my-database/documents` or
55
58
  # `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
56
59
  # @!attribute [rw] collection_id
57
60
  # @return [::String]
58
- # Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`
59
- # or `messages`.
61
+ # Optional. The collection ID, relative to `parent`, to list.
62
+ #
63
+ # For example: `chatrooms` or `messages`.
64
+ #
65
+ # This is optional, and when not provided, Firestore will list documents
66
+ # from all collections under the provided `parent`.
60
67
  # @!attribute [rw] page_size
61
68
  # @return [::Integer]
62
- # The maximum number of documents to return.
69
+ # Optional. The maximum number of documents to return in a single response.
70
+ #
71
+ # Firestore may return fewer than this value.
63
72
  # @!attribute [rw] page_token
64
73
  # @return [::String]
65
- # The `next_page_token` value returned from a previous List request, if any.
74
+ # Optional. A page token, received from a previous `ListDocuments` response.
75
+ #
76
+ # Provide this to retrieve the subsequent page. When paginating, all other
77
+ # parameters (with the exception of `page_size`) must match the values set
78
+ # in the request that generated the page token.
66
79
  # @!attribute [rw] order_by
67
80
  # @return [::String]
68
- # The order to sort results by. For example: `priority desc, name`.
81
+ # Optional. The optional ordering of the documents to return.
82
+ #
83
+ # For example: `priority desc, __name__ desc`.
84
+ #
85
+ # This mirrors the {::Google::Cloud::Firestore::V1::StructuredQuery#order_by `ORDER BY`}
86
+ # used in Firestore queries but in a string representation. When absent,
87
+ # documents are ordered based on `__name__ ASC`.
69
88
  # @!attribute [rw] mask
70
89
  # @return [::Google::Cloud::Firestore::V1::DocumentMask]
71
- # The fields to return. If not set, returns all fields.
90
+ # Optional. The fields to return. If not set, returns all fields.
72
91
  #
73
92
  # If a document has a field that is not present in this mask, that field
74
93
  # will not be returned in the response.
75
94
  # @!attribute [rw] transaction
76
95
  # @return [::String]
77
- # Reads documents in a transaction.
96
+ # Perform the read as part of an already active transaction.
78
97
  # @!attribute [rw] read_time
79
98
  # @return [::Google::Protobuf::Timestamp]
80
- # Reads documents as they were at the given time.
99
+ # Perform the read at the provided time.
100
+ #
81
101
  # This may not be older than 270 seconds.
82
102
  # @!attribute [rw] show_missing
83
103
  # @return [::Boolean]
84
- # If the list should show missing documents. A missing document is a
85
- # document that does not exist but has sub-documents. These documents will
86
- # be returned with a key but will not have fields, {::Google::Cloud::Firestore::V1::Document#create_time Document.create_time},
87
- # or {::Google::Cloud::Firestore::V1::Document#update_time Document.update_time} set.
104
+ # If the list should show missing documents.
105
+ #
106
+ # A document is missing if it does not exist, but there are sub-documents
107
+ # nested underneath it. When true, such missing documents will be returned
108
+ # with a key but will not have fields,
109
+ # {::Google::Cloud::Firestore::V1::Document#create_time `create_time`}, or
110
+ # {::Google::Cloud::Firestore::V1::Document#update_time `update_time`} set.
88
111
  #
89
- # Requests with `show_missing` may not specify `where` or
90
- # `order_by`.
112
+ # Requests with `show_missing` may not specify `where` or `order_by`.
91
113
  class ListDocumentsRequest
92
114
  include ::Google::Protobuf::MessageExts
93
115
  extend ::Google::Protobuf::MessageExts::ClassMethods
94
116
  end
95
117
 
96
- # The response for {::Google::Cloud::Firestore::V1::Firestore::Client#list_documents Firestore.ListDocuments}.
118
+ # The response for
119
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#list_documents Firestore.ListDocuments}.
97
120
  # @!attribute [rw] documents
98
121
  # @return [::Array<::Google::Cloud::Firestore::V1::Document>]
99
122
  # The Documents found.
100
123
  # @!attribute [rw] next_page_token
101
124
  # @return [::String]
102
- # The next page token.
125
+ # A token to retrieve the next page of documents.
126
+ #
127
+ # If this field is omitted, there are no subsequent pages.
103
128
  class ListDocumentsResponse
104
129
  include ::Google::Protobuf::MessageExts
105
130
  extend ::Google::Protobuf::MessageExts::ClassMethods
106
131
  end
107
132
 
108
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#create_document Firestore.CreateDocument}.
133
+ # The request for
134
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#create_document Firestore.CreateDocument}.
109
135
  # @!attribute [rw] parent
110
136
  # @return [::String]
111
137
  # Required. The parent resource. For example:
@@ -113,7 +139,8 @@ module Google
113
139
  # `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
114
140
  # @!attribute [rw] collection_id
115
141
  # @return [::String]
116
- # Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`.
142
+ # Required. The collection ID, relative to `parent`, to list. For example:
143
+ # `chatrooms`.
117
144
  # @!attribute [rw] document_id
118
145
  # @return [::String]
119
146
  # The client-assigned document ID to use for this document.
@@ -133,7 +160,8 @@ module Google
133
160
  extend ::Google::Protobuf::MessageExts::ClassMethods
134
161
  end
135
162
 
136
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#update_document Firestore.UpdateDocument}.
163
+ # The request for
164
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#update_document Firestore.UpdateDocument}.
137
165
  # @!attribute [rw] document
138
166
  # @return [::Google::Cloud::Firestore::V1::Document]
139
167
  # Required. The updated document.
@@ -162,7 +190,8 @@ module Google
162
190
  extend ::Google::Protobuf::MessageExts::ClassMethods
163
191
  end
164
192
 
165
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#delete_document Firestore.DeleteDocument}.
193
+ # The request for
194
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#delete_document Firestore.DeleteDocument}.
166
195
  # @!attribute [rw] name
167
196
  # @return [::String]
168
197
  # Required. The resource name of the Document to delete. In the format:
@@ -176,7 +205,8 @@ module Google
176
205
  extend ::Google::Protobuf::MessageExts::ClassMethods
177
206
  end
178
207
 
179
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#batch_get_documents Firestore.BatchGetDocuments}.
208
+ # The request for
209
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#batch_get_documents Firestore.BatchGetDocuments}.
180
210
  # @!attribute [rw] database
181
211
  # @return [::String]
182
212
  # Required. The database name. In the format:
@@ -211,7 +241,8 @@ module Google
211
241
  extend ::Google::Protobuf::MessageExts::ClassMethods
212
242
  end
213
243
 
214
- # The streamed response for {::Google::Cloud::Firestore::V1::Firestore::Client#batch_get_documents Firestore.BatchGetDocuments}.
244
+ # The streamed response for
245
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#batch_get_documents Firestore.BatchGetDocuments}.
215
246
  # @!attribute [rw] found
216
247
  # @return [::Google::Cloud::Firestore::V1::Document]
217
248
  # A document that was requested.
@@ -223,7 +254,8 @@ module Google
223
254
  # @return [::String]
224
255
  # The transaction that was started as part of this request.
225
256
  # Will only be set in the first response, and only if
226
- # {::Google::Cloud::Firestore::V1::BatchGetDocumentsRequest#new_transaction BatchGetDocumentsRequest.new_transaction} was set in the request.
257
+ # {::Google::Cloud::Firestore::V1::BatchGetDocumentsRequest#new_transaction BatchGetDocumentsRequest.new_transaction}
258
+ # was set in the request.
227
259
  # @!attribute [rw] read_time
228
260
  # @return [::Google::Protobuf::Timestamp]
229
261
  # The time at which the document was read.
@@ -235,7 +267,8 @@ module Google
235
267
  extend ::Google::Protobuf::MessageExts::ClassMethods
236
268
  end
237
269
 
238
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#begin_transaction Firestore.BeginTransaction}.
270
+ # The request for
271
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#begin_transaction Firestore.BeginTransaction}.
239
272
  # @!attribute [rw] database
240
273
  # @return [::String]
241
274
  # Required. The database name. In the format:
@@ -249,7 +282,8 @@ module Google
249
282
  extend ::Google::Protobuf::MessageExts::ClassMethods
250
283
  end
251
284
 
252
- # The response for {::Google::Cloud::Firestore::V1::Firestore::Client#begin_transaction Firestore.BeginTransaction}.
285
+ # The response for
286
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#begin_transaction Firestore.BeginTransaction}.
253
287
  # @!attribute [rw] transaction
254
288
  # @return [::String]
255
289
  # The transaction that was started.
@@ -337,13 +371,15 @@ module Google
337
371
  extend ::Google::Protobuf::MessageExts::ClassMethods
338
372
  end
339
373
 
340
- # The response for {::Google::Cloud::Firestore::V1::Firestore::Client#run_query Firestore.RunQuery}.
374
+ # The response for
375
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#run_query Firestore.RunQuery}.
341
376
  # @!attribute [rw] transaction
342
377
  # @return [::String]
343
378
  # The transaction that was started as part of this request.
344
379
  # Can only be set in the first response, and only if
345
- # {::Google::Cloud::Firestore::V1::RunQueryRequest#new_transaction RunQueryRequest.new_transaction} was set in the request.
346
- # If set, no other fields will be set in this response.
380
+ # {::Google::Cloud::Firestore::V1::RunQueryRequest#new_transaction RunQueryRequest.new_transaction}
381
+ # was set in the request. If set, no other fields will be set in this
382
+ # response.
347
383
  # @!attribute [rw] document
348
384
  # @return [::Google::Cloud::Firestore::V1::Document]
349
385
  # A query result, not set when reporting partial progress.
@@ -369,7 +405,65 @@ module Google
369
405
  extend ::Google::Protobuf::MessageExts::ClassMethods
370
406
  end
371
407
 
372
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#partition_query Firestore.PartitionQuery}.
408
+ # The request for
409
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#run_aggregation_query Firestore.RunAggregationQuery}.
410
+ # @!attribute [rw] parent
411
+ # @return [::String]
412
+ # Required. The parent resource name. In the format:
413
+ # `projects/{project_id}/databases/{database_id}/documents` or
414
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
415
+ # For example:
416
+ # `projects/my-project/databases/my-database/documents` or
417
+ # `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
418
+ # @!attribute [rw] structured_aggregation_query
419
+ # @return [::Google::Cloud::Firestore::V1::StructuredAggregationQuery]
420
+ # An aggregation query.
421
+ # @!attribute [rw] transaction
422
+ # @return [::String]
423
+ # Run the aggregation within an already active transaction.
424
+ #
425
+ # The value here is the opaque transaction ID to execute the query in.
426
+ # @!attribute [rw] new_transaction
427
+ # @return [::Google::Cloud::Firestore::V1::TransactionOptions]
428
+ # Starts a new transaction as part of the query, defaulting to read-only.
429
+ #
430
+ # The new transaction ID will be returned as the first response in the
431
+ # stream.
432
+ # @!attribute [rw] read_time
433
+ # @return [::Google::Protobuf::Timestamp]
434
+ # Executes the query at the given timestamp.
435
+ #
436
+ # Requires:
437
+ #
438
+ # * Cannot be more than 270 seconds in the past.
439
+ class RunAggregationQueryRequest
440
+ include ::Google::Protobuf::MessageExts
441
+ extend ::Google::Protobuf::MessageExts::ClassMethods
442
+ end
443
+
444
+ # The response for
445
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#run_aggregation_query Firestore.RunAggregationQuery}.
446
+ # @!attribute [rw] result
447
+ # @return [::Google::Cloud::Firestore::V1::AggregationResult]
448
+ # A single aggregation result.
449
+ #
450
+ # Not present when reporting partial progress.
451
+ # @!attribute [rw] transaction
452
+ # @return [::String]
453
+ # The transaction that was started as part of this request.
454
+ #
455
+ # Only present on the first response when the request requested to start
456
+ # a new transaction.
457
+ # @!attribute [rw] read_time
458
+ # @return [::Google::Protobuf::Timestamp]
459
+ # The time at which the aggregate value is valid for.
460
+ class RunAggregationQueryResponse
461
+ include ::Google::Protobuf::MessageExts
462
+ extend ::Google::Protobuf::MessageExts::ClassMethods
463
+ end
464
+
465
+ # The request for
466
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#partition_query Firestore.PartitionQuery}.
373
467
  # @!attribute [rw] parent
374
468
  # @return [::String]
375
469
  # Required. The parent resource name. In the format:
@@ -425,7 +519,8 @@ module Google
425
519
  extend ::Google::Protobuf::MessageExts::ClassMethods
426
520
  end
427
521
 
428
- # The response for {::Google::Cloud::Firestore::V1::Firestore::Client#partition_query Firestore.PartitionQuery}.
522
+ # The response for
523
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#partition_query Firestore.PartitionQuery}.
429
524
  # @!attribute [rw] partitions
430
525
  # @return [::Array<::Google::Cloud::Firestore::V1::Cursor>]
431
526
  # Partition results.
@@ -488,9 +583,9 @@ module Google
488
583
  # A stream token that was previously sent by the server.
489
584
  #
490
585
  # The client should set this field to the token from the most recent
491
- # {::Google::Cloud::Firestore::V1::WriteResponse WriteResponse} it has received. This acknowledges that the client has
492
- # received responses up to this token. After sending this token, earlier
493
- # tokens may not be used anymore.
586
+ # {::Google::Cloud::Firestore::V1::WriteResponse WriteResponse} it has received. This
587
+ # acknowledges that the client has received responses up to this token. After
588
+ # sending this token, earlier tokens may not be used anymore.
494
589
  #
495
590
  # The server may close the stream if there are too many unacknowledged
496
591
  # responses.
@@ -582,8 +677,8 @@ module Google
582
677
  # A {::Google::Cloud::Firestore::V1::Document Document} has been deleted.
583
678
  # @!attribute [rw] document_remove
584
679
  # @return [::Google::Cloud::Firestore::V1::DocumentRemove]
585
- # A {::Google::Cloud::Firestore::V1::Document Document} has been removed from a target (because it is no longer
586
- # relevant to that target).
680
+ # A {::Google::Cloud::Firestore::V1::Document Document} has been removed from a target
681
+ # (because it is no longer relevant to that target).
587
682
  # @!attribute [rw] filter
588
683
  # @return [::Google::Cloud::Firestore::V1::ExistenceFilter]
589
684
  # A filter to apply to the set of documents previously returned for the
@@ -605,7 +700,8 @@ module Google
605
700
  # A target specified by a set of document names.
606
701
  # @!attribute [rw] resume_token
607
702
  # @return [::String]
608
- # A resume token from a prior {::Google::Cloud::Firestore::V1::TargetChange TargetChange} for an identical target.
703
+ # A resume token from a prior
704
+ # {::Google::Cloud::Firestore::V1::TargetChange TargetChange} for an identical target.
609
705
  #
610
706
  # Using a resume token with a different target is unsupported and may fail.
611
707
  # @!attribute [rw] read_time
@@ -720,7 +816,8 @@ module Google
720
816
  end
721
817
  end
722
818
 
723
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#list_collection_ids Firestore.ListCollectionIds}.
819
+ # The request for
820
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#list_collection_ids Firestore.ListCollectionIds}.
724
821
  # @!attribute [rw] parent
725
822
  # @return [::String]
726
823
  # Required. The parent document. In the format:
@@ -743,7 +840,8 @@ module Google
743
840
  extend ::Google::Protobuf::MessageExts::ClassMethods
744
841
  end
745
842
 
746
- # The response from {::Google::Cloud::Firestore::V1::Firestore::Client#list_collection_ids Firestore.ListCollectionIds}.
843
+ # The response from
844
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#list_collection_ids Firestore.ListCollectionIds}.
747
845
  # @!attribute [rw] collection_ids
748
846
  # @return [::Array<::String>]
749
847
  # The collection ids.
@@ -755,7 +853,8 @@ module Google
755
853
  extend ::Google::Protobuf::MessageExts::ClassMethods
756
854
  end
757
855
 
758
- # The request for {::Google::Cloud::Firestore::V1::Firestore::Client#batch_write Firestore.BatchWrite}.
856
+ # The request for
857
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#batch_write Firestore.BatchWrite}.
759
858
  # @!attribute [rw] database
760
859
  # @return [::String]
761
860
  # Required. The database name. In the format:
@@ -784,7 +883,8 @@ module Google
784
883
  end
785
884
  end
786
885
 
787
- # The response from {::Google::Cloud::Firestore::V1::Firestore::Client#batch_write Firestore.BatchWrite}.
886
+ # The response from
887
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#batch_write Firestore.BatchWrite}.
788
888
  # @!attribute [rw] write_results
789
889
  # @return [::Array<::Google::Cloud::Firestore::V1::WriteResult>]
790
890
  # The result of applying the writes.
@@ -55,22 +55,67 @@ module Google
55
55
  # `WHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC`
56
56
  # @!attribute [rw] start_at
57
57
  # @return [::Google::Cloud::Firestore::V1::Cursor]
58
- # A starting point for the query results.
58
+ # A potential prefix of a position in the result set to start the query at.
59
+ #
60
+ # The ordering of the result set is based on the `ORDER BY` clause of the
61
+ # original query.
62
+ #
63
+ # ```
64
+ # SELECT * FROM k WHERE a = 1 AND b > 2 ORDER BY b ASC, __name__ ASC;
65
+ # ```
66
+ #
67
+ # This query's results are ordered by `(b ASC, __name__ ASC)`.
68
+ #
69
+ # Cursors can reference either the full ordering or a prefix of the location,
70
+ # though it cannot reference more fields than what are in the provided
71
+ # `ORDER BY`.
72
+ #
73
+ # Continuing off the example above, attaching the following start cursors
74
+ # will have varying impact:
75
+ #
76
+ # - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
77
+ # b > 2 AND __name__ > /k/123`.
78
+ # - `START AFTER (10)`: start the query right after `a = 1 AND b > 10`.
79
+ #
80
+ # Unlike `OFFSET` which requires scanning over the first N results to skip,
81
+ # a start cursor allows the query to begin at a logical position. This
82
+ # position is not required to match an actual result, it will scan forward
83
+ # from this position to find the next document.
84
+ #
85
+ # Requires:
86
+ #
87
+ # * The number of values cannot be greater than the number of fields
88
+ # specified in the `ORDER BY` clause.
59
89
  # @!attribute [rw] end_at
60
90
  # @return [::Google::Cloud::Firestore::V1::Cursor]
61
- # A end point for the query results.
91
+ # A potential prefix of a position in the result set to end the query at.
92
+ #
93
+ # This is similar to `START_AT` but with it controlling the end position
94
+ # rather than the start position.
95
+ #
96
+ # Requires:
97
+ #
98
+ # * The number of values cannot be greater than the number of fields
99
+ # specified in the `ORDER BY` clause.
62
100
  # @!attribute [rw] offset
63
101
  # @return [::Integer]
64
- # The number of results to skip.
102
+ # The number of documents to skip before returning the first result.
103
+ #
104
+ # This applies after the constraints specified by the `WHERE`, `START AT`, &
105
+ # `END AT` but before the `LIMIT` clause.
65
106
  #
66
- # Applies before limit, but after all other constraints. Must be >= 0 if
67
- # specified.
107
+ # Requires:
108
+ #
109
+ # * The value must be greater than or equal to zero if specified.
68
110
  # @!attribute [rw] limit
69
111
  # @return [::Google::Protobuf::Int32Value]
70
112
  # The maximum number of results to return.
71
113
  #
72
114
  # Applies after all other constraints.
73
- # Must be >= 0 if specified.
115
+ #
116
+ # Requires:
117
+ #
118
+ # * The value must be greater than or equal to zero if specified.
74
119
  class StructuredQuery
75
120
  include ::Google::Protobuf::MessageExts
76
121
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -127,6 +172,9 @@ module Google
127
172
 
128
173
  # Documents are required to satisfy all of the combined filters.
129
174
  AND = 1
175
+
176
+ # Documents are required to satisfy at least one of the combined filters.
177
+ OR = 2
130
178
  end
131
179
  end
132
180
 
@@ -272,9 +320,15 @@ module Google
272
320
  extend ::Google::Protobuf::MessageExts::ClassMethods
273
321
  end
274
322
 
275
- # A reference to a field, such as `max(messages.time) as max_time`.
323
+ # A reference to a field in a document, ex: `stats.operations`.
276
324
  # @!attribute [rw] field_path
277
325
  # @return [::String]
326
+ # The relative path of the document being referenced.
327
+ #
328
+ # Requires:
329
+ #
330
+ # * Conform to {::Google::Cloud::Firestore::V1::Document#fields document field name}
331
+ # limitations.
278
332
  class FieldReference
279
333
  include ::Google::Protobuf::MessageExts
280
334
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -305,6 +359,98 @@ module Google
305
359
  end
306
360
  end
307
361
 
362
+ # Firestore query for running an aggregation over a
363
+ # {::Google::Cloud::Firestore::V1::StructuredQuery StructuredQuery}.
364
+ # @!attribute [rw] structured_query
365
+ # @return [::Google::Cloud::Firestore::V1::StructuredQuery]
366
+ # Nested structured query.
367
+ # @!attribute [rw] aggregations
368
+ # @return [::Array<::Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation>]
369
+ # Optional. Series of aggregations to apply over the results of the
370
+ # `structured_query`.
371
+ #
372
+ # Requires:
373
+ #
374
+ # * A minimum of one and maximum of five aggregations per query.
375
+ class StructuredAggregationQuery
376
+ include ::Google::Protobuf::MessageExts
377
+ extend ::Google::Protobuf::MessageExts::ClassMethods
378
+
379
+ # Defines a aggregation that produces a single result.
380
+ # @!attribute [rw] count
381
+ # @return [::Google::Cloud::Firestore::V1::StructuredAggregationQuery::Aggregation::Count]
382
+ # Count aggregator.
383
+ # @!attribute [rw] alias
384
+ # @return [::String]
385
+ # Optional. Optional name of the field to store the result of the
386
+ # aggregation into.
387
+ #
388
+ # If not provided, Firestore will pick a default name following the format
389
+ # `field_<incremental_id++>`. For example:
390
+ #
391
+ # ```
392
+ # AGGREGATE
393
+ # COUNT_UP_TO(1) AS count_up_to_1,
394
+ # COUNT_UP_TO(2),
395
+ # COUNT_UP_TO(3) AS count_up_to_3,
396
+ # COUNT_UP_TO(4)
397
+ # OVER (
398
+ # ...
399
+ # );
400
+ # ```
401
+ #
402
+ # becomes:
403
+ #
404
+ # ```
405
+ # AGGREGATE
406
+ # COUNT_UP_TO(1) AS count_up_to_1,
407
+ # COUNT_UP_TO(2) AS field_1,
408
+ # COUNT_UP_TO(3) AS count_up_to_3,
409
+ # COUNT_UP_TO(4) AS field_2
410
+ # OVER (
411
+ # ...
412
+ # );
413
+ # ```
414
+ #
415
+ # Requires:
416
+ #
417
+ # * Must be unique across all aggregation aliases.
418
+ # * Conform to {::Google::Cloud::Firestore::V1::Document#fields document field name}
419
+ # limitations.
420
+ class Aggregation
421
+ include ::Google::Protobuf::MessageExts
422
+ extend ::Google::Protobuf::MessageExts::ClassMethods
423
+
424
+ # Count of documents that match the query.
425
+ #
426
+ # The `COUNT(*)` aggregation function operates on the entire document
427
+ # so it does not require a field reference.
428
+ # @!attribute [rw] up_to
429
+ # @return [::Google::Protobuf::Int64Value]
430
+ # Optional. Optional constraint on the maximum number of documents to
431
+ # count.
432
+ #
433
+ # This provides a way to set an upper bound on the number of documents
434
+ # to scan, limiting latency and cost.
435
+ #
436
+ # Unspecified is interpreted as no bound.
437
+ #
438
+ # High-Level Example:
439
+ #
440
+ # ```
441
+ # AGGREGATE COUNT_UP_TO(1000) OVER ( SELECT * FROM k );
442
+ # ```
443
+ #
444
+ # Requires:
445
+ #
446
+ # * Must be greater than zero when present.
447
+ class Count
448
+ include ::Google::Protobuf::MessageExts
449
+ extend ::Google::Protobuf::MessageExts::ClassMethods
450
+ end
451
+ end
452
+ end
453
+
308
454
  # A position in a query result set.
309
455
  # @!attribute [rw] values
310
456
  # @return [::Array<::Google::Cloud::Firestore::V1::Value>]
@@ -77,8 +77,9 @@ module Google
77
77
  # A transformation of a field of the document.
78
78
  # @!attribute [rw] field_path
79
79
  # @return [::String]
80
- # The path of the field. See {::Google::Cloud::Firestore::V1::Document#fields Document.fields} for the field path syntax
81
- # reference.
80
+ # The path of the field. See
81
+ # {::Google::Cloud::Firestore::V1::Document#fields Document.fields} for the field path
82
+ # syntax reference.
82
83
  # @!attribute [rw] set_to_server_value
83
84
  # @return [::Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform::ServerValue]
84
85
  # Sets the field to the given server value.
@@ -175,8 +176,9 @@ module Google
175
176
  # previous update_time.
176
177
  # @!attribute [rw] transform_results
177
178
  # @return [::Array<::Google::Cloud::Firestore::V1::Value>]
178
- # The results of applying each {::Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform DocumentTransform.FieldTransform}, in the
179
- # same order.
179
+ # The results of applying each
180
+ # {::Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform DocumentTransform.FieldTransform},
181
+ # in the same order.
180
182
  class WriteResult
181
183
  include ::Google::Protobuf::MessageExts
182
184
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -184,11 +186,12 @@ module Google
184
186
 
185
187
  # A {::Google::Cloud::Firestore::V1::Document Document} has changed.
186
188
  #
187
- # May be the result of multiple {::Google::Cloud::Firestore::V1::Write writes}, including deletes, that
188
- # ultimately resulted in a new value for the {::Google::Cloud::Firestore::V1::Document Document}.
189
+ # May be the result of multiple {::Google::Cloud::Firestore::V1::Write writes}, including
190
+ # deletes, that ultimately resulted in a new value for the
191
+ # {::Google::Cloud::Firestore::V1::Document Document}.
189
192
  #
190
- # Multiple {::Google::Cloud::Firestore::V1::DocumentChange DocumentChange} messages may be returned for the same logical
191
- # change, if multiple targets are affected.
193
+ # Multiple {::Google::Cloud::Firestore::V1::DocumentChange DocumentChange} messages may be
194
+ # returned for the same logical change, if multiple targets are affected.
192
195
  # @!attribute [rw] document
193
196
  # @return [::Google::Cloud::Firestore::V1::Document]
194
197
  # The new state of the {::Google::Cloud::Firestore::V1::Document Document}.
@@ -207,14 +210,16 @@ module Google
207
210
 
208
211
  # A {::Google::Cloud::Firestore::V1::Document Document} has been deleted.
209
212
  #
210
- # May be the result of multiple {::Google::Cloud::Firestore::V1::Write writes}, including updates, the
211
- # last of which deleted the {::Google::Cloud::Firestore::V1::Document Document}.
213
+ # May be the result of multiple {::Google::Cloud::Firestore::V1::Write writes}, including
214
+ # updates, the last of which deleted the
215
+ # {::Google::Cloud::Firestore::V1::Document Document}.
212
216
  #
213
- # Multiple {::Google::Cloud::Firestore::V1::DocumentDelete DocumentDelete} messages may be returned for the same logical
214
- # delete, if multiple targets are affected.
217
+ # Multiple {::Google::Cloud::Firestore::V1::DocumentDelete DocumentDelete} messages may be
218
+ # returned for the same logical delete, if multiple targets are affected.
215
219
  # @!attribute [rw] document
216
220
  # @return [::String]
217
- # The resource name of the {::Google::Cloud::Firestore::V1::Document Document} that was deleted.
221
+ # The resource name of the {::Google::Cloud::Firestore::V1::Document Document} that was
222
+ # deleted.
218
223
  # @!attribute [rw] removed_target_ids
219
224
  # @return [::Array<::Integer>]
220
225
  # A set of target IDs for targets that previously matched this entity.
@@ -228,17 +233,20 @@ module Google
228
233
  extend ::Google::Protobuf::MessageExts::ClassMethods
229
234
  end
230
235
 
231
- # A {::Google::Cloud::Firestore::V1::Document Document} has been removed from the view of the targets.
236
+ # A {::Google::Cloud::Firestore::V1::Document Document} has been removed from the view of
237
+ # the targets.
232
238
  #
233
239
  # Sent if the document is no longer relevant to a target and is out of view.
234
240
  # Can be sent instead of a DocumentDelete or a DocumentChange if the server
235
241
  # can not send the new value of the document.
236
242
  #
237
- # Multiple {::Google::Cloud::Firestore::V1::DocumentRemove DocumentRemove} messages may be returned for the same logical
238
- # write or delete, if multiple targets are affected.
243
+ # Multiple {::Google::Cloud::Firestore::V1::DocumentRemove DocumentRemove} messages may be
244
+ # returned for the same logical write or delete, if multiple targets are
245
+ # affected.
239
246
  # @!attribute [rw] document
240
247
  # @return [::String]
241
- # The resource name of the {::Google::Cloud::Firestore::V1::Document Document} that has gone out of view.
248
+ # The resource name of the {::Google::Cloud::Firestore::V1::Document Document} that has
249
+ # gone out of view.
242
250
  # @!attribute [rw] removed_target_ids
243
251
  # @return [::Array<::Integer>]
244
252
  # A set of target IDs for targets that previously matched this document.
@@ -258,7 +266,8 @@ module Google
258
266
  # The target ID to which this filter applies.
259
267
  # @!attribute [rw] count
260
268
  # @return [::Integer]
261
- # The total count of documents that match {::Google::Cloud::Firestore::V1::ExistenceFilter#target_id target_id}.
269
+ # The total count of documents that match
270
+ # {::Google::Cloud::Firestore::V1::ExistenceFilter#target_id target_id}.
262
271
  #
263
272
  # If different from the count of documents in the client that match, the
264
273
  # client must manually determine which documents no longer match the target.