google-cloud-firestore-v1 0.7.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7922ef0b53adb9cf8c05dea972dc77df76ca049be8d888ebb3070f86520eeba
4
- data.tar.gz: aafccc0aa33cc527e926d2b16696bb2f8d24551e8871d7d604873646d2bd060d
3
+ metadata.gz: 2fcbf0267a51ef3d6aa2bd915dc9395feb479bf10be6d246173ee43bb34d5bfe
4
+ data.tar.gz: e4c4e23ff5f4e666a3e0d06c8caa05fec89889b42eae60378ff774f89726ab10
5
5
  SHA512:
6
- metadata.gz: ae9b1fb54e5792c92296df31b1e1184e2f83a390761ee4f5b6476984e95a2c1c19141e097cefc778c6ab0169bbd3e02ffa89f93f85793f047a65bad7e17d21bc
7
- data.tar.gz: f37cc1e8425e89cfac0569fbf52146ff9e8b1ef36d778ca439a14ba13c564bd2de7886b975cf629de4cd8df52ab3cb847138404aefc5ff7e59afaa4599665943
6
+ metadata.gz: b9a71c321fa41feb3f871f84843f1bdd4eea7a3a1021351a1610982f8ceac8953ef9cd4b70f4ff9413d7f8c1131cb3456e06e4316b45ee0e2bc4014f6c2b9ce4
7
+ data.tar.gz: 6c12cdf0bfda03c2bfa980a0a74d41753b427d5dbd8e5357ea7f2c3d6a4edc1c068163b084c50997a13a2ba13dce82d497e6fc7958e90be3099a1bec440d3e35
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -46,7 +46,7 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/firestore/v1/firestore_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -33,8 +34,8 @@ module Google
33
34
  # document database that simplifies storing, syncing, and querying data for
34
35
  # your mobile, web, and IoT apps at global scale. Its client libraries provide
35
36
  # live synchronization and offline support, while its security features and
36
- # integrations with Firebase and Google Cloud Platform (GCP) accelerate
37
- # building truly serverless apps.
37
+ # integrations with Firebase and Google Cloud Platform accelerate building
38
+ # truly serverless apps.
38
39
  #
39
40
  class Client
40
41
  # @private
@@ -114,6 +115,11 @@ module Google
114
115
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [8, 14, 13, 4]
115
116
  }
116
117
 
118
+ default_config.rpcs.run_aggregation_query.timeout = 300.0
119
+ default_config.rpcs.run_aggregation_query.retry_policy = {
120
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [8, 14, 13, 4]
121
+ }
122
+
117
123
  default_config.rpcs.partition_query.timeout = 300.0
118
124
  default_config.rpcs.partition_query.retry_policy = {
119
125
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [8, 14, 13, 4]
@@ -210,6 +216,12 @@ module Google
210
216
  @quota_project_id = @config.quota_project
211
217
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
212
218
 
219
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
220
+ config.credentials = credentials
221
+ config.quota_project = @quota_project_id
222
+ config.endpoint = @config.endpoint
223
+ end
224
+
213
225
  @firestore_stub = ::Gapic::ServiceStub.new(
214
226
  ::Google::Cloud::Firestore::V1::Firestore::Stub,
215
227
  credentials: credentials,
@@ -219,6 +231,13 @@ module Google
219
231
  )
220
232
  end
221
233
 
234
+ ##
235
+ # Get the associated client for mix-in of the Locations.
236
+ #
237
+ # @return [Google::Cloud::Location::Locations::Client]
238
+ #
239
+ attr_reader :location_client
240
+
222
241
  # Service calls
223
242
 
224
243
  ##
@@ -339,36 +358,56 @@ module Google
339
358
  # Required. The parent resource name. In the format:
340
359
  # `projects/{project_id}/databases/{database_id}/documents` or
341
360
  # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
361
+ #
342
362
  # For example:
343
363
  # `projects/my-project/databases/my-database/documents` or
344
364
  # `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
345
365
  # @param collection_id [::String]
346
- # Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`
347
- # or `messages`.
366
+ # Optional. The collection ID, relative to `parent`, to list.
367
+ #
368
+ # For example: `chatrooms` or `messages`.
369
+ #
370
+ # This is optional, and when not provided, Firestore will list documents
371
+ # from all collections under the provided `parent`.
348
372
  # @param page_size [::Integer]
349
- # The maximum number of documents to return.
373
+ # Optional. The maximum number of documents to return in a single response.
374
+ #
375
+ # Firestore may return fewer than this value.
350
376
  # @param page_token [::String]
351
- # The `next_page_token` value returned from a previous List request, if any.
377
+ # Optional. A page token, received from a previous `ListDocuments` response.
378
+ #
379
+ # Provide this to retrieve the subsequent page. When paginating, all other
380
+ # parameters (with the exception of `page_size`) must match the values set
381
+ # in the request that generated the page token.
352
382
  # @param order_by [::String]
353
- # The order to sort results by. For example: `priority desc, name`.
383
+ # Optional. The optional ordering of the documents to return.
384
+ #
385
+ # For example: `priority desc, __name__ desc`.
386
+ #
387
+ # This mirrors the {::Google::Cloud::Firestore::V1::StructuredQuery#order_by `ORDER BY`}
388
+ # used in Firestore queries but in a string representation. When absent,
389
+ # documents are ordered based on `__name__ ASC`.
354
390
  # @param mask [::Google::Cloud::Firestore::V1::DocumentMask, ::Hash]
355
- # The fields to return. If not set, returns all fields.
391
+ # Optional. The fields to return. If not set, returns all fields.
356
392
  #
357
393
  # If a document has a field that is not present in this mask, that field
358
394
  # will not be returned in the response.
359
395
  # @param transaction [::String]
360
- # Reads documents in a transaction.
396
+ # Perform the read as part of an already active transaction.
361
397
  # @param read_time [::Google::Protobuf::Timestamp, ::Hash]
362
- # Reads documents as they were at the given time.
398
+ # Perform the read at the provided time.
399
+ #
363
400
  # This may not be older than 270 seconds.
364
401
  # @param show_missing [::Boolean]
365
- # If the list should show missing documents. A missing document is a
366
- # document that does not exist but has sub-documents. These documents will
367
- # be returned with a key but will not have fields, {::Google::Cloud::Firestore::V1::Document#create_time Document.create_time},
368
- # or {::Google::Cloud::Firestore::V1::Document#update_time Document.update_time} set.
402
+ # If the list should show missing documents.
403
+ #
404
+ # A document is missing if it does not exist, but there are sub-documents
405
+ # nested underneath it. When true, such missing documents will be returned
406
+ # with a key but will not have fields,
407
+ # {::Google::Cloud::Firestore::V1::Document#create_time `create_time`}, or
408
+ # {::Google::Cloud::Firestore::V1::Document#update_time `update_time`} set.
369
409
  #
370
- # Requests with `show_missing` may not specify `where` or
371
- # `order_by`.
410
+ # Requests with `show_missing` may not specify `where` or `order_by`.
372
411
  #
373
412
  # @yield [response, operation] Access the result along with the RPC operation
374
413
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Firestore::V1::Document>]
@@ -390,13 +429,11 @@ module Google
390
429
  # # Call the list_documents method.
391
430
  # result = client.list_documents request
392
431
  #
393
- # # The returned object is of type Gapic::PagedEnumerable. You can
394
- # # iterate over all elements by calling #each, and the enumerable
395
- # # will lazily make API calls to fetch subsequent pages. Other
396
- # # methods are also available for managing paging directly.
397
- # result.each do |response|
432
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
433
+ # # over elements, and API calls will be issued to fetch pages as needed.
434
+ # result.each do |item|
398
435
  # # Each element is of type ::Google::Cloud::Firestore::V1::Document.
399
- # p response
436
+ # p item
400
437
  # end
401
438
  #
402
439
  def list_documents request, options = nil
@@ -697,13 +734,13 @@ module Google
697
734
  # # Create a request. To set request fields, pass in keyword arguments.
698
735
  # request = Google::Cloud::Firestore::V1::BatchGetDocumentsRequest.new
699
736
  #
700
- # # Call the batch_get_documents method.
701
- # result = client.batch_get_documents request
737
+ # # Call the batch_get_documents method to start streaming.
738
+ # output = client.batch_get_documents request
702
739
  #
703
- # # The returned object is a streamed enumerable yielding elements of
704
- # # type ::Google::Cloud::Firestore::V1::BatchGetDocumentsResponse.
705
- # result.each do |response|
706
- # p response
740
+ # # The returned object is a streamed enumerable yielding elements of type
741
+ # # ::Google::Cloud::Firestore::V1::BatchGetDocumentsResponse
742
+ # output.each do |current_response|
743
+ # p current_response
707
744
  # end
708
745
  #
709
746
  def batch_get_documents request, options = nil
@@ -1073,13 +1110,13 @@ module Google
1073
1110
  # # Create a request. To set request fields, pass in keyword arguments.
1074
1111
  # request = Google::Cloud::Firestore::V1::RunQueryRequest.new
1075
1112
  #
1076
- # # Call the run_query method.
1077
- # result = client.run_query request
1113
+ # # Call the run_query method to start streaming.
1114
+ # output = client.run_query request
1078
1115
  #
1079
- # # The returned object is a streamed enumerable yielding elements of
1080
- # # type ::Google::Cloud::Firestore::V1::RunQueryResponse.
1081
- # result.each do |response|
1082
- # p response
1116
+ # # The returned object is a streamed enumerable yielding elements of type
1117
+ # # ::Google::Cloud::Firestore::V1::RunQueryResponse
1118
+ # output.each do |current_response|
1119
+ # p current_response
1083
1120
  # end
1084
1121
  #
1085
1122
  def run_query request, options = nil
@@ -1123,6 +1160,128 @@ module Google
1123
1160
  raise ::Google::Cloud::Error.from_error(e)
1124
1161
  end
1125
1162
 
1163
+ ##
1164
+ # Runs an aggregation query.
1165
+ #
1166
+ # Rather than producing {::Google::Cloud::Firestore::V1::Document Document} results like
1167
+ # {::Google::Cloud::Firestore::V1::Firestore::Client#run_query Firestore.RunQuery}, this API
1168
+ # allows running an aggregation to produce a series of
1169
+ # {::Google::Cloud::Firestore::V1::AggregationResult AggregationResult} server-side.
1170
+ #
1171
+ # High-Level Example:
1172
+ #
1173
+ # ```
1174
+ # -- Return the number of documents in table given a filter.
1175
+ # SELECT COUNT(*) FROM ( SELECT * FROM k where a = true );
1176
+ # ```
1177
+ #
1178
+ # @overload run_aggregation_query(request, options = nil)
1179
+ # Pass arguments to `run_aggregation_query` via a request object, either of type
1180
+ # {::Google::Cloud::Firestore::V1::RunAggregationQueryRequest} or an equivalent Hash.
1181
+ #
1182
+ # @param request [::Google::Cloud::Firestore::V1::RunAggregationQueryRequest, ::Hash]
1183
+ # A request object representing the call parameters. Required. To specify no
1184
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1185
+ # @param options [::Gapic::CallOptions, ::Hash]
1186
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1187
+ #
1188
+ # @overload run_aggregation_query(parent: nil, structured_aggregation_query: nil, transaction: nil, new_transaction: nil, read_time: nil)
1189
+ # Pass arguments to `run_aggregation_query` via keyword arguments. Note that at
1190
+ # least one keyword argument is required. To specify no parameters, or to keep all
1191
+ # the default parameter values, pass an empty Hash as a request object (see above).
1192
+ #
1193
+ # @param parent [::String]
1194
+ # Required. The parent resource name. In the format:
1195
+ # `projects/{project_id}/databases/{database_id}/documents` or
1196
+ # `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
1197
+ # For example:
1198
+ # `projects/my-project/databases/my-database/documents` or
1199
+ # `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
1200
+ # @param structured_aggregation_query [::Google::Cloud::Firestore::V1::StructuredAggregationQuery, ::Hash]
1201
+ # An aggregation query.
1202
+ # @param transaction [::String]
1203
+ # Run the aggregation within an already active transaction.
1204
+ #
1205
+ # The value here is the opaque transaction ID to execute the query in.
1206
+ # @param new_transaction [::Google::Cloud::Firestore::V1::TransactionOptions, ::Hash]
1207
+ # Starts a new transaction as part of the query, defaulting to read-only.
1208
+ #
1209
+ # The new transaction ID will be returned as the first response in the
1210
+ # stream.
1211
+ # @param read_time [::Google::Protobuf::Timestamp, ::Hash]
1212
+ # Executes the query at the given timestamp.
1213
+ #
1214
+ # Requires:
1215
+ #
1216
+ # * Cannot be more than 270 seconds in the past.
1217
+ #
1218
+ # @yield [response, operation] Access the result along with the RPC operation
1219
+ # @yieldparam response [::Enumerable<::Google::Cloud::Firestore::V1::RunAggregationQueryResponse>]
1220
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1221
+ #
1222
+ # @return [::Enumerable<::Google::Cloud::Firestore::V1::RunAggregationQueryResponse>]
1223
+ #
1224
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1225
+ #
1226
+ # @example Basic example
1227
+ # require "google/cloud/firestore/v1"
1228
+ #
1229
+ # # Create a client object. The client can be reused for multiple calls.
1230
+ # client = Google::Cloud::Firestore::V1::Firestore::Client.new
1231
+ #
1232
+ # # Create a request. To set request fields, pass in keyword arguments.
1233
+ # request = Google::Cloud::Firestore::V1::RunAggregationQueryRequest.new
1234
+ #
1235
+ # # Call the run_aggregation_query method to start streaming.
1236
+ # output = client.run_aggregation_query request
1237
+ #
1238
+ # # The returned object is a streamed enumerable yielding elements of type
1239
+ # # ::Google::Cloud::Firestore::V1::RunAggregationQueryResponse
1240
+ # output.each do |current_response|
1241
+ # p current_response
1242
+ # end
1243
+ #
1244
+ def run_aggregation_query request, options = nil
1245
+ raise ::ArgumentError, "request must be provided" if request.nil?
1246
+
1247
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Firestore::V1::RunAggregationQueryRequest
1248
+
1249
+ # Converts hash and nil to an options object
1250
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1251
+
1252
+ # Customize the options with defaults
1253
+ metadata = @config.rpcs.run_aggregation_query.metadata.to_h
1254
+
1255
+ # Set x-goog-api-client and x-goog-user-project headers
1256
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1257
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1258
+ gapic_version: ::Google::Cloud::Firestore::V1::VERSION
1259
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1260
+
1261
+ header_params = {}
1262
+ if request.parent
1263
+ header_params["parent"] = request.parent
1264
+ end
1265
+
1266
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1267
+ metadata[:"x-goog-request-params"] ||= request_params_header
1268
+
1269
+ options.apply_defaults timeout: @config.rpcs.run_aggregation_query.timeout,
1270
+ metadata: metadata,
1271
+ retry_policy: @config.rpcs.run_aggregation_query.retry_policy
1272
+
1273
+ options.apply_defaults timeout: @config.timeout,
1274
+ metadata: @config.metadata,
1275
+ retry_policy: @config.retry_policy
1276
+
1277
+ @firestore_stub.call_rpc :run_aggregation_query, request, options: options do |response, operation|
1278
+ yield response, operation if block_given?
1279
+ return response
1280
+ end
1281
+ rescue ::GRPC::BadStatus => e
1282
+ raise ::Google::Cloud::Error.from_error(e)
1283
+ end
1284
+
1126
1285
  ##
1127
1286
  # Partitions a query by returning partition cursors that can be used to run
1128
1287
  # the query in parallel. The returned partition cursors are split points that
@@ -1208,13 +1367,11 @@ module Google
1208
1367
  # # Call the partition_query method.
1209
1368
  # result = client.partition_query request
1210
1369
  #
1211
- # # The returned object is of type Gapic::PagedEnumerable. You can
1212
- # # iterate over all elements by calling #each, and the enumerable
1213
- # # will lazily make API calls to fetch subsequent pages. Other
1214
- # # methods are also available for managing paging directly.
1215
- # result.each do |response|
1370
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1371
+ # # over elements, and API calls will be issued to fetch pages as needed.
1372
+ # result.each do |item|
1216
1373
  # # Each element is of type ::Google::Cloud::Firestore::V1::Cursor.
1217
- # p response
1374
+ # p item
1218
1375
  # end
1219
1376
  #
1220
1377
  def partition_query request, options = nil
@@ -1260,7 +1417,8 @@ module Google
1260
1417
  end
1261
1418
 
1262
1419
  ##
1263
- # Streams batches of document updates and deletes, in order.
1420
+ # Streams batches of document updates and deletes, in order. This method is
1421
+ # only available via the gRPC API (not REST).
1264
1422
  #
1265
1423
  # @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Firestore::V1::WriteRequest, ::Hash>]
1266
1424
  # An enumerable of {::Google::Cloud::Firestore::V1::WriteRequest} instances.
@@ -1281,22 +1439,22 @@ module Google
1281
1439
  # # Create a client object. The client can be reused for multiple calls.
1282
1440
  # client = Google::Cloud::Firestore::V1::Firestore::Client.new
1283
1441
  #
1284
- # # Create an input stream
1442
+ # # Create an input stream.
1285
1443
  # input = Gapic::StreamInput.new
1286
1444
  #
1287
1445
  # # Call the write method to start streaming.
1288
1446
  # output = client.write input
1289
1447
  #
1290
- # # Send requests on the stream. For each request, pass in keyword
1291
- # # arguments to set fields. Be sure to close the stream when done.
1448
+ # # Send requests on the stream. For each request object, set fields by
1449
+ # # passing keyword arguments. Be sure to close the stream when done.
1292
1450
  # input << Google::Cloud::Firestore::V1::WriteRequest.new
1293
1451
  # input << Google::Cloud::Firestore::V1::WriteRequest.new
1294
1452
  # input.close
1295
1453
  #
1296
- # # Handle streamed responses. These may be interleaved with inputs.
1297
- # # Each response is of type ::Google::Cloud::Firestore::V1::WriteResponse.
1298
- # output.each do |response|
1299
- # p response
1454
+ # # The returned object is a streamed enumerable yielding elements of type
1455
+ # # ::Google::Cloud::Firestore::V1::WriteResponse
1456
+ # output.each do |current_response|
1457
+ # p current_response
1300
1458
  # end
1301
1459
  #
1302
1460
  def write request, options = nil
@@ -1338,7 +1496,8 @@ module Google
1338
1496
  end
1339
1497
 
1340
1498
  ##
1341
- # Listens to changes.
1499
+ # Listens to changes. This method is only available via the gRPC API (not
1500
+ # REST).
1342
1501
  #
1343
1502
  # @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Firestore::V1::ListenRequest, ::Hash>]
1344
1503
  # An enumerable of {::Google::Cloud::Firestore::V1::ListenRequest} instances.
@@ -1359,22 +1518,22 @@ module Google
1359
1518
  # # Create a client object. The client can be reused for multiple calls.
1360
1519
  # client = Google::Cloud::Firestore::V1::Firestore::Client.new
1361
1520
  #
1362
- # # Create an input stream
1521
+ # # Create an input stream.
1363
1522
  # input = Gapic::StreamInput.new
1364
1523
  #
1365
1524
  # # Call the listen method to start streaming.
1366
1525
  # output = client.listen input
1367
1526
  #
1368
- # # Send requests on the stream. For each request, pass in keyword
1369
- # # arguments to set fields. Be sure to close the stream when done.
1527
+ # # Send requests on the stream. For each request object, set fields by
1528
+ # # passing keyword arguments. Be sure to close the stream when done.
1370
1529
  # input << Google::Cloud::Firestore::V1::ListenRequest.new
1371
1530
  # input << Google::Cloud::Firestore::V1::ListenRequest.new
1372
1531
  # input.close
1373
1532
  #
1374
- # # Handle streamed responses. These may be interleaved with inputs.
1375
- # # Each response is of type ::Google::Cloud::Firestore::V1::ListenResponse.
1376
- # output.each do |response|
1377
- # p response
1533
+ # # The returned object is a streamed enumerable yielding elements of type
1534
+ # # ::Google::Cloud::Firestore::V1::ListenResponse
1535
+ # output.each do |current_response|
1536
+ # p current_response
1378
1537
  # end
1379
1538
  #
1380
1539
  def listen request, options = nil
@@ -1517,7 +1676,8 @@ module Google
1517
1676
  # The BatchWrite method does not apply the write operations atomically
1518
1677
  # and can apply them out of order. Method does not allow more than one write
1519
1678
  # per document. Each write succeeds or fails independently. See the
1520
- # {::Google::Cloud::Firestore::V1::BatchWriteResponse BatchWriteResponse} for the success status of each write.
1679
+ # {::Google::Cloud::Firestore::V1::BatchWriteResponse BatchWriteResponse} for the
1680
+ # success status of each write.
1521
1681
  #
1522
1682
  # If you require an atomically applied set of writes, use
1523
1683
  # {::Google::Cloud::Firestore::V1::Firestore::Client#commit Commit} instead.
@@ -1636,7 +1796,8 @@ module Google
1636
1796
  # `projects/{project_id}/databases/{database_id}/documents` or
1637
1797
  # `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
1638
1798
  # @param collection_id [::String]
1639
- # Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`.
1799
+ # Required. The collection ID, relative to `parent`, to list. For example:
1800
+ # `chatrooms`.
1640
1801
  # @param document_id [::String]
1641
1802
  # The client-assigned document ID to use for this document.
1642
1803
  #
@@ -1897,6 +2058,11 @@ module Google
1897
2058
  #
1898
2059
  attr_reader :run_query
1899
2060
  ##
2061
+ # RPC-specific configuration for `run_aggregation_query`
2062
+ # @return [::Gapic::Config::Method]
2063
+ #
2064
+ attr_reader :run_aggregation_query
2065
+ ##
1900
2066
  # RPC-specific configuration for `partition_query`
1901
2067
  # @return [::Gapic::Config::Method]
1902
2068
  #
@@ -1947,6 +2113,8 @@ module Google
1947
2113
  @rollback = ::Gapic::Config::Method.new rollback_config
1948
2114
  run_query_config = parent_rpcs.run_query if parent_rpcs.respond_to? :run_query
1949
2115
  @run_query = ::Gapic::Config::Method.new run_query_config
2116
+ run_aggregation_query_config = parent_rpcs.run_aggregation_query if parent_rpcs.respond_to? :run_aggregation_query
2117
+ @run_aggregation_query = ::Gapic::Config::Method.new run_aggregation_query_config
1950
2118
  partition_query_config = parent_rpcs.partition_query if parent_rpcs.respond_to? :partition_query
1951
2119
  @partition_query = ::Gapic::Config::Method.new partition_query_config
1952
2120
  write_config = parent_rpcs.write if parent_rpcs.respond_to? :write
@@ -36,10 +36,10 @@ module Google
36
36
  # document database that simplifies storing, syncing, and querying data for
37
37
  # your mobile, web, and IoT apps at global scale. Its client libraries provide
38
38
  # live synchronization and offline support, while its security features and
39
- # integrations with Firebase and Google Cloud Platform (GCP) accelerate
40
- # building truly serverless apps.
39
+ # integrations with Firebase and Google Cloud Platform accelerate building
40
+ # truly serverless apps.
41
41
  #
42
- # To load this service and instantiate a client:
42
+ # @example Load this service and instantiate a gRPC client
43
43
  #
44
44
  # require "google/cloud/firestore/v1/firestore"
45
45
  # client = ::Google::Cloud::Firestore::V1::Firestore::Client.new
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Firestore
23
23
  module V1
24
- VERSION = "0.7.1"
24
+ VERSION = "0.9.0"
25
25
  end
26
26
  end
27
27
  end
@@ -23,9 +23,9 @@ module Google
23
23
  module Cloud
24
24
  module Firestore
25
25
  ##
26
- # To load this package, including all its services, and instantiate a client:
26
+ # API client module.
27
27
  #
28
- # @example
28
+ # @example Load this package, including all its services, and instantiate a gRPC client
29
29
  #
30
30
  # require "google/cloud/firestore/v1"
31
31
  # client = ::Google::Cloud::Firestore::V1::Firestore::Client.new
@@ -0,0 +1,24 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: google/firestore/v1/aggregation_result.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/firestore/v1/document_pb'
7
+
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_file("google/firestore/v1/aggregation_result.proto", :syntax => :proto3) do
10
+ add_message "google.firestore.v1.AggregationResult" do
11
+ map :aggregate_fields, :string, :message, 2, "google.firestore.v1.Value"
12
+ end
13
+ end
14
+ end
15
+
16
+ module Google
17
+ module Cloud
18
+ module Firestore
19
+ module V1
20
+ AggregationResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.AggregationResult").msgclass
21
+ end
22
+ end
23
+ end
24
+ end
@@ -6,6 +6,7 @@ require 'google/protobuf'
6
6
  require 'google/api/annotations_pb'
7
7
  require 'google/api/client_pb'
8
8
  require 'google/api/field_behavior_pb'
9
+ require 'google/firestore/v1/aggregation_result_pb'
9
10
  require 'google/firestore/v1/common_pb'
10
11
  require 'google/firestore/v1/document_pb'
11
12
  require 'google/firestore/v1/query_pb'
@@ -116,6 +117,22 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
116
117
  optional :done, :bool, 6
117
118
  end
118
119
  end
120
+ add_message "google.firestore.v1.RunAggregationQueryRequest" do
121
+ optional :parent, :string, 1
122
+ oneof :query_type do
123
+ optional :structured_aggregation_query, :message, 2, "google.firestore.v1.StructuredAggregationQuery"
124
+ end
125
+ oneof :consistency_selector do
126
+ optional :transaction, :bytes, 4
127
+ optional :new_transaction, :message, 5, "google.firestore.v1.TransactionOptions"
128
+ optional :read_time, :message, 6, "google.protobuf.Timestamp"
129
+ end
130
+ end
131
+ add_message "google.firestore.v1.RunAggregationQueryResponse" do
132
+ optional :result, :message, 1, "google.firestore.v1.AggregationResult"
133
+ optional :transaction, :bytes, 2
134
+ optional :read_time, :message, 3, "google.protobuf.Timestamp"
135
+ end
119
136
  add_message "google.firestore.v1.PartitionQueryRequest" do
120
137
  optional :parent, :string, 1
121
138
  optional :partition_count, :int64, 3
@@ -240,6 +257,8 @@ module Google
240
257
  RollbackRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.RollbackRequest").msgclass
241
258
  RunQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.RunQueryRequest").msgclass
242
259
  RunQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.RunQueryResponse").msgclass
260
+ RunAggregationQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.RunAggregationQueryRequest").msgclass
261
+ RunAggregationQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.RunAggregationQueryResponse").msgclass
243
262
  PartitionQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.PartitionQueryRequest").msgclass
244
263
  PartitionQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.PartitionQueryResponse").msgclass
245
264
  WriteRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.WriteRequest").msgclass
@@ -32,8 +32,8 @@ module Google
32
32
  # document database that simplifies storing, syncing, and querying data for
33
33
  # your mobile, web, and IoT apps at global scale. Its client libraries provide
34
34
  # live synchronization and offline support, while its security features and
35
- # integrations with Firebase and Google Cloud Platform (GCP) accelerate
36
- # building truly serverless apps.
35
+ # integrations with Firebase and Google Cloud Platform accelerate building
36
+ # truly serverless apps.
37
37
  class Service
38
38
 
39
39
  include ::GRPC::GenericService
@@ -63,13 +63,29 @@ module Google
63
63
  rpc :Rollback, ::Google::Cloud::Firestore::V1::RollbackRequest, ::Google::Protobuf::Empty
64
64
  # Runs a query.
65
65
  rpc :RunQuery, ::Google::Cloud::Firestore::V1::RunQueryRequest, stream(::Google::Cloud::Firestore::V1::RunQueryResponse)
66
+ # Runs an aggregation query.
67
+ #
68
+ # Rather than producing [Document][google.firestore.v1.Document] results like
69
+ # [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery], this API
70
+ # allows running an aggregation to produce a series of
71
+ # [AggregationResult][google.firestore.v1.AggregationResult] server-side.
72
+ #
73
+ # High-Level Example:
74
+ #
75
+ # ```
76
+ # -- Return the number of documents in table given a filter.
77
+ # SELECT COUNT(*) FROM ( SELECT * FROM k where a = true );
78
+ # ```
79
+ rpc :RunAggregationQuery, ::Google::Cloud::Firestore::V1::RunAggregationQueryRequest, stream(::Google::Cloud::Firestore::V1::RunAggregationQueryResponse)
66
80
  # Partitions a query by returning partition cursors that can be used to run
67
81
  # the query in parallel. The returned partition cursors are split points that
68
82
  # can be used by RunQuery as starting/end points for the query results.
69
83
  rpc :PartitionQuery, ::Google::Cloud::Firestore::V1::PartitionQueryRequest, ::Google::Cloud::Firestore::V1::PartitionQueryResponse
70
- # Streams batches of document updates and deletes, in order.
84
+ # Streams batches of document updates and deletes, in order. This method is
85
+ # only available via the gRPC API (not REST).
71
86
  rpc :Write, stream(::Google::Cloud::Firestore::V1::WriteRequest), stream(::Google::Cloud::Firestore::V1::WriteResponse)
72
- # Listens to changes.
87
+ # Listens to changes. This method is only available via the gRPC API (not
88
+ # REST).
73
89
  rpc :Listen, stream(::Google::Cloud::Firestore::V1::ListenRequest), stream(::Google::Cloud::Firestore::V1::ListenResponse)
74
90
  # Lists all the collection IDs underneath a document.
75
91
  rpc :ListCollectionIds, ::Google::Cloud::Firestore::V1::ListCollectionIdsRequest, ::Google::Cloud::Firestore::V1::ListCollectionIdsResponse
@@ -78,7 +94,8 @@ module Google
78
94
  # The BatchWrite method does not apply the write operations atomically
79
95
  # and can apply them out of order. Method does not allow more than one write
80
96
  # per document. Each write succeeds or fails independently. See the
81
- # [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the success status of each write.
97
+ # [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
98
+ # success status of each write.
82
99
  #
83
100
  # If you require an atomically applied set of writes, use
84
101
  # [Commit][google.firestore.v1.Firestore.Commit] instead.