google-cloud-firestore-v1 0.8.0 → 0.10.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.
@@ -0,0 +1,912 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/firestore/v1/firestore_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Firestore
24
+ module V1
25
+ module Firestore
26
+ module Rest
27
+ ##
28
+ # REST service stub for the Firestore service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ def initialize endpoint:, credentials:
34
+ # These require statements are intentionally placed here to initialize
35
+ # the REST modules only when it's required.
36
+ require "gapic/rest"
37
+
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
39
+ numeric_enums: true,
40
+ raise_faraday_errors: false
41
+ end
42
+
43
+ ##
44
+ # Baseline implementation for the get_document REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Firestore::V1::GetDocumentRequest]
47
+ # A request object representing the call parameters. Required.
48
+ # @param options [::Gapic::CallOptions]
49
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
50
+ #
51
+ # @yield [result, operation] Access the result along with the TransportOperation object
52
+ # @yieldparam result [::Google::Cloud::Firestore::V1::Document]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Firestore::V1::Document]
56
+ # A result object deserialized from the server's reply
57
+ def get_document request_pb, options = nil
58
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
59
+
60
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_document_request request_pb
61
+ query_string_params = if query_string_params.any?
62
+ query_string_params.to_h { |p| p.split("=", 2) }
63
+ else
64
+ {}
65
+ end
66
+
67
+ response = @client_stub.make_http_request(
68
+ verb,
69
+ uri: uri,
70
+ body: body || "",
71
+ params: query_string_params,
72
+ options: options
73
+ )
74
+ operation = ::Gapic::Rest::TransportOperation.new response
75
+ result = ::Google::Cloud::Firestore::V1::Document.decode_json response.body, ignore_unknown_fields: true
76
+
77
+ yield result, operation if block_given?
78
+ result
79
+ end
80
+
81
+ ##
82
+ # Baseline implementation for the list_documents REST call
83
+ #
84
+ # @param request_pb [::Google::Cloud::Firestore::V1::ListDocumentsRequest]
85
+ # A request object representing the call parameters. Required.
86
+ # @param options [::Gapic::CallOptions]
87
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
88
+ #
89
+ # @yield [result, operation] Access the result along with the TransportOperation object
90
+ # @yieldparam result [::Google::Cloud::Firestore::V1::ListDocumentsResponse]
91
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
92
+ #
93
+ # @return [::Google::Cloud::Firestore::V1::ListDocumentsResponse]
94
+ # A result object deserialized from the server's reply
95
+ def list_documents request_pb, options = nil
96
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
97
+
98
+ verb, uri, query_string_params, body = ServiceStub.transcode_list_documents_request request_pb
99
+ query_string_params = if query_string_params.any?
100
+ query_string_params.to_h { |p| p.split("=", 2) }
101
+ else
102
+ {}
103
+ end
104
+
105
+ response = @client_stub.make_http_request(
106
+ verb,
107
+ uri: uri,
108
+ body: body || "",
109
+ params: query_string_params,
110
+ options: options
111
+ )
112
+ operation = ::Gapic::Rest::TransportOperation.new response
113
+ result = ::Google::Cloud::Firestore::V1::ListDocumentsResponse.decode_json response.body, ignore_unknown_fields: true
114
+
115
+ yield result, operation if block_given?
116
+ result
117
+ end
118
+
119
+ ##
120
+ # Baseline implementation for the update_document REST call
121
+ #
122
+ # @param request_pb [::Google::Cloud::Firestore::V1::UpdateDocumentRequest]
123
+ # A request object representing the call parameters. Required.
124
+ # @param options [::Gapic::CallOptions]
125
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
126
+ #
127
+ # @yield [result, operation] Access the result along with the TransportOperation object
128
+ # @yieldparam result [::Google::Cloud::Firestore::V1::Document]
129
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
130
+ #
131
+ # @return [::Google::Cloud::Firestore::V1::Document]
132
+ # A result object deserialized from the server's reply
133
+ def update_document request_pb, options = nil
134
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
135
+
136
+ verb, uri, query_string_params, body = ServiceStub.transcode_update_document_request request_pb
137
+ query_string_params = if query_string_params.any?
138
+ query_string_params.to_h { |p| p.split("=", 2) }
139
+ else
140
+ {}
141
+ end
142
+
143
+ response = @client_stub.make_http_request(
144
+ verb,
145
+ uri: uri,
146
+ body: body || "",
147
+ params: query_string_params,
148
+ options: options
149
+ )
150
+ operation = ::Gapic::Rest::TransportOperation.new response
151
+ result = ::Google::Cloud::Firestore::V1::Document.decode_json response.body, ignore_unknown_fields: true
152
+
153
+ yield result, operation if block_given?
154
+ result
155
+ end
156
+
157
+ ##
158
+ # Baseline implementation for the delete_document REST call
159
+ #
160
+ # @param request_pb [::Google::Cloud::Firestore::V1::DeleteDocumentRequest]
161
+ # A request object representing the call parameters. Required.
162
+ # @param options [::Gapic::CallOptions]
163
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
164
+ #
165
+ # @yield [result, operation] Access the result along with the TransportOperation object
166
+ # @yieldparam result [::Google::Protobuf::Empty]
167
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
168
+ #
169
+ # @return [::Google::Protobuf::Empty]
170
+ # A result object deserialized from the server's reply
171
+ def delete_document request_pb, options = nil
172
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
173
+
174
+ verb, uri, query_string_params, body = ServiceStub.transcode_delete_document_request request_pb
175
+ query_string_params = if query_string_params.any?
176
+ query_string_params.to_h { |p| p.split("=", 2) }
177
+ else
178
+ {}
179
+ end
180
+
181
+ response = @client_stub.make_http_request(
182
+ verb,
183
+ uri: uri,
184
+ body: body || "",
185
+ params: query_string_params,
186
+ options: options
187
+ )
188
+ operation = ::Gapic::Rest::TransportOperation.new response
189
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
190
+
191
+ yield result, operation if block_given?
192
+ result
193
+ end
194
+
195
+ ##
196
+ # Baseline implementation for the batch_get_documents REST call
197
+ #
198
+ # @param request_pb [::Google::Cloud::Firestore::V1::BatchGetDocumentsRequest]
199
+ # A request object representing the call parameters. Required.
200
+ # @param options [::Gapic::CallOptions]
201
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
202
+ #
203
+ # @yieldparam chunk [::String] The chunk of data received during server streaming.
204
+ #
205
+ # @return [::Gapic::Rest::TransportOperation]
206
+ def batch_get_documents request_pb, options = nil, &block
207
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
208
+
209
+ verb, uri, query_string_params, body = ServiceStub.transcode_batch_get_documents_request request_pb
210
+ query_string_params = if query_string_params.any?
211
+ query_string_params.to_h { |p| p.split("=", 2) }
212
+ else
213
+ {}
214
+ end
215
+
216
+ response = @client_stub.make_http_request(
217
+ verb,
218
+ uri: uri,
219
+ body: body || "",
220
+ params: query_string_params,
221
+ options: options,
222
+ is_server_streaming: true,
223
+ &block
224
+ )
225
+ ::Gapic::Rest::TransportOperation.new response
226
+ end
227
+
228
+ ##
229
+ # Baseline implementation for the begin_transaction REST call
230
+ #
231
+ # @param request_pb [::Google::Cloud::Firestore::V1::BeginTransactionRequest]
232
+ # A request object representing the call parameters. Required.
233
+ # @param options [::Gapic::CallOptions]
234
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
235
+ #
236
+ # @yield [result, operation] Access the result along with the TransportOperation object
237
+ # @yieldparam result [::Google::Cloud::Firestore::V1::BeginTransactionResponse]
238
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
239
+ #
240
+ # @return [::Google::Cloud::Firestore::V1::BeginTransactionResponse]
241
+ # A result object deserialized from the server's reply
242
+ def begin_transaction request_pb, options = nil
243
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
244
+
245
+ verb, uri, query_string_params, body = ServiceStub.transcode_begin_transaction_request request_pb
246
+ query_string_params = if query_string_params.any?
247
+ query_string_params.to_h { |p| p.split("=", 2) }
248
+ else
249
+ {}
250
+ end
251
+
252
+ response = @client_stub.make_http_request(
253
+ verb,
254
+ uri: uri,
255
+ body: body || "",
256
+ params: query_string_params,
257
+ options: options
258
+ )
259
+ operation = ::Gapic::Rest::TransportOperation.new response
260
+ result = ::Google::Cloud::Firestore::V1::BeginTransactionResponse.decode_json response.body, ignore_unknown_fields: true
261
+
262
+ yield result, operation if block_given?
263
+ result
264
+ end
265
+
266
+ ##
267
+ # Baseline implementation for the commit REST call
268
+ #
269
+ # @param request_pb [::Google::Cloud::Firestore::V1::CommitRequest]
270
+ # A request object representing the call parameters. Required.
271
+ # @param options [::Gapic::CallOptions]
272
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
273
+ #
274
+ # @yield [result, operation] Access the result along with the TransportOperation object
275
+ # @yieldparam result [::Google::Cloud::Firestore::V1::CommitResponse]
276
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
277
+ #
278
+ # @return [::Google::Cloud::Firestore::V1::CommitResponse]
279
+ # A result object deserialized from the server's reply
280
+ def commit request_pb, options = nil
281
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
282
+
283
+ verb, uri, query_string_params, body = ServiceStub.transcode_commit_request request_pb
284
+ query_string_params = if query_string_params.any?
285
+ query_string_params.to_h { |p| p.split("=", 2) }
286
+ else
287
+ {}
288
+ end
289
+
290
+ response = @client_stub.make_http_request(
291
+ verb,
292
+ uri: uri,
293
+ body: body || "",
294
+ params: query_string_params,
295
+ options: options
296
+ )
297
+ operation = ::Gapic::Rest::TransportOperation.new response
298
+ result = ::Google::Cloud::Firestore::V1::CommitResponse.decode_json response.body, ignore_unknown_fields: true
299
+
300
+ yield result, operation if block_given?
301
+ result
302
+ end
303
+
304
+ ##
305
+ # Baseline implementation for the rollback REST call
306
+ #
307
+ # @param request_pb [::Google::Cloud::Firestore::V1::RollbackRequest]
308
+ # A request object representing the call parameters. Required.
309
+ # @param options [::Gapic::CallOptions]
310
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
311
+ #
312
+ # @yield [result, operation] Access the result along with the TransportOperation object
313
+ # @yieldparam result [::Google::Protobuf::Empty]
314
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
315
+ #
316
+ # @return [::Google::Protobuf::Empty]
317
+ # A result object deserialized from the server's reply
318
+ def rollback request_pb, options = nil
319
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
320
+
321
+ verb, uri, query_string_params, body = ServiceStub.transcode_rollback_request request_pb
322
+ query_string_params = if query_string_params.any?
323
+ query_string_params.to_h { |p| p.split("=", 2) }
324
+ else
325
+ {}
326
+ end
327
+
328
+ response = @client_stub.make_http_request(
329
+ verb,
330
+ uri: uri,
331
+ body: body || "",
332
+ params: query_string_params,
333
+ options: options
334
+ )
335
+ operation = ::Gapic::Rest::TransportOperation.new response
336
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
337
+
338
+ yield result, operation if block_given?
339
+ result
340
+ end
341
+
342
+ ##
343
+ # Baseline implementation for the run_query REST call
344
+ #
345
+ # @param request_pb [::Google::Cloud::Firestore::V1::RunQueryRequest]
346
+ # A request object representing the call parameters. Required.
347
+ # @param options [::Gapic::CallOptions]
348
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
349
+ #
350
+ # @yieldparam chunk [::String] The chunk of data received during server streaming.
351
+ #
352
+ # @return [::Gapic::Rest::TransportOperation]
353
+ def run_query request_pb, options = nil, &block
354
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
355
+
356
+ verb, uri, query_string_params, body = ServiceStub.transcode_run_query_request request_pb
357
+ query_string_params = if query_string_params.any?
358
+ query_string_params.to_h { |p| p.split("=", 2) }
359
+ else
360
+ {}
361
+ end
362
+
363
+ response = @client_stub.make_http_request(
364
+ verb,
365
+ uri: uri,
366
+ body: body || "",
367
+ params: query_string_params,
368
+ options: options,
369
+ is_server_streaming: true,
370
+ &block
371
+ )
372
+ ::Gapic::Rest::TransportOperation.new response
373
+ end
374
+
375
+ ##
376
+ # Baseline implementation for the run_aggregation_query REST call
377
+ #
378
+ # @param request_pb [::Google::Cloud::Firestore::V1::RunAggregationQueryRequest]
379
+ # A request object representing the call parameters. Required.
380
+ # @param options [::Gapic::CallOptions]
381
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
382
+ #
383
+ # @yieldparam chunk [::String] The chunk of data received during server streaming.
384
+ #
385
+ # @return [::Gapic::Rest::TransportOperation]
386
+ def run_aggregation_query request_pb, options = nil, &block
387
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
388
+
389
+ verb, uri, query_string_params, body = ServiceStub.transcode_run_aggregation_query_request request_pb
390
+ query_string_params = if query_string_params.any?
391
+ query_string_params.to_h { |p| p.split("=", 2) }
392
+ else
393
+ {}
394
+ end
395
+
396
+ response = @client_stub.make_http_request(
397
+ verb,
398
+ uri: uri,
399
+ body: body || "",
400
+ params: query_string_params,
401
+ options: options,
402
+ is_server_streaming: true,
403
+ &block
404
+ )
405
+ ::Gapic::Rest::TransportOperation.new response
406
+ end
407
+
408
+ ##
409
+ # Baseline implementation for the partition_query REST call
410
+ #
411
+ # @param request_pb [::Google::Cloud::Firestore::V1::PartitionQueryRequest]
412
+ # A request object representing the call parameters. Required.
413
+ # @param options [::Gapic::CallOptions]
414
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
415
+ #
416
+ # @yield [result, operation] Access the result along with the TransportOperation object
417
+ # @yieldparam result [::Google::Cloud::Firestore::V1::PartitionQueryResponse]
418
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
419
+ #
420
+ # @return [::Google::Cloud::Firestore::V1::PartitionQueryResponse]
421
+ # A result object deserialized from the server's reply
422
+ def partition_query request_pb, options = nil
423
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
424
+
425
+ verb, uri, query_string_params, body = ServiceStub.transcode_partition_query_request request_pb
426
+ query_string_params = if query_string_params.any?
427
+ query_string_params.to_h { |p| p.split("=", 2) }
428
+ else
429
+ {}
430
+ end
431
+
432
+ response = @client_stub.make_http_request(
433
+ verb,
434
+ uri: uri,
435
+ body: body || "",
436
+ params: query_string_params,
437
+ options: options
438
+ )
439
+ operation = ::Gapic::Rest::TransportOperation.new response
440
+ result = ::Google::Cloud::Firestore::V1::PartitionQueryResponse.decode_json response.body, ignore_unknown_fields: true
441
+
442
+ yield result, operation if block_given?
443
+ result
444
+ end
445
+
446
+ ##
447
+ # Baseline implementation for the list_collection_ids REST call
448
+ #
449
+ # @param request_pb [::Google::Cloud::Firestore::V1::ListCollectionIdsRequest]
450
+ # A request object representing the call parameters. Required.
451
+ # @param options [::Gapic::CallOptions]
452
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
453
+ #
454
+ # @yield [result, operation] Access the result along with the TransportOperation object
455
+ # @yieldparam result [::Google::Cloud::Firestore::V1::ListCollectionIdsResponse]
456
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
457
+ #
458
+ # @return [::Google::Cloud::Firestore::V1::ListCollectionIdsResponse]
459
+ # A result object deserialized from the server's reply
460
+ def list_collection_ids request_pb, options = nil
461
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
462
+
463
+ verb, uri, query_string_params, body = ServiceStub.transcode_list_collection_ids_request request_pb
464
+ query_string_params = if query_string_params.any?
465
+ query_string_params.to_h { |p| p.split("=", 2) }
466
+ else
467
+ {}
468
+ end
469
+
470
+ response = @client_stub.make_http_request(
471
+ verb,
472
+ uri: uri,
473
+ body: body || "",
474
+ params: query_string_params,
475
+ options: options
476
+ )
477
+ operation = ::Gapic::Rest::TransportOperation.new response
478
+ result = ::Google::Cloud::Firestore::V1::ListCollectionIdsResponse.decode_json response.body, ignore_unknown_fields: true
479
+
480
+ yield result, operation if block_given?
481
+ result
482
+ end
483
+
484
+ ##
485
+ # Baseline implementation for the batch_write REST call
486
+ #
487
+ # @param request_pb [::Google::Cloud::Firestore::V1::BatchWriteRequest]
488
+ # A request object representing the call parameters. Required.
489
+ # @param options [::Gapic::CallOptions]
490
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
491
+ #
492
+ # @yield [result, operation] Access the result along with the TransportOperation object
493
+ # @yieldparam result [::Google::Cloud::Firestore::V1::BatchWriteResponse]
494
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
495
+ #
496
+ # @return [::Google::Cloud::Firestore::V1::BatchWriteResponse]
497
+ # A result object deserialized from the server's reply
498
+ def batch_write request_pb, options = nil
499
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
500
+
501
+ verb, uri, query_string_params, body = ServiceStub.transcode_batch_write_request request_pb
502
+ query_string_params = if query_string_params.any?
503
+ query_string_params.to_h { |p| p.split("=", 2) }
504
+ else
505
+ {}
506
+ end
507
+
508
+ response = @client_stub.make_http_request(
509
+ verb,
510
+ uri: uri,
511
+ body: body || "",
512
+ params: query_string_params,
513
+ options: options
514
+ )
515
+ operation = ::Gapic::Rest::TransportOperation.new response
516
+ result = ::Google::Cloud::Firestore::V1::BatchWriteResponse.decode_json response.body, ignore_unknown_fields: true
517
+
518
+ yield result, operation if block_given?
519
+ result
520
+ end
521
+
522
+ ##
523
+ # Baseline implementation for the create_document REST call
524
+ #
525
+ # @param request_pb [::Google::Cloud::Firestore::V1::CreateDocumentRequest]
526
+ # A request object representing the call parameters. Required.
527
+ # @param options [::Gapic::CallOptions]
528
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
529
+ #
530
+ # @yield [result, operation] Access the result along with the TransportOperation object
531
+ # @yieldparam result [::Google::Cloud::Firestore::V1::Document]
532
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
533
+ #
534
+ # @return [::Google::Cloud::Firestore::V1::Document]
535
+ # A result object deserialized from the server's reply
536
+ def create_document request_pb, options = nil
537
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
538
+
539
+ verb, uri, query_string_params, body = ServiceStub.transcode_create_document_request request_pb
540
+ query_string_params = if query_string_params.any?
541
+ query_string_params.to_h { |p| p.split("=", 2) }
542
+ else
543
+ {}
544
+ end
545
+
546
+ response = @client_stub.make_http_request(
547
+ verb,
548
+ uri: uri,
549
+ body: body || "",
550
+ params: query_string_params,
551
+ options: options
552
+ )
553
+ operation = ::Gapic::Rest::TransportOperation.new response
554
+ result = ::Google::Cloud::Firestore::V1::Document.decode_json response.body, ignore_unknown_fields: true
555
+
556
+ yield result, operation if block_given?
557
+ result
558
+ end
559
+
560
+ ##
561
+ # @private
562
+ #
563
+ # GRPC transcoding helper method for the get_document REST call
564
+ #
565
+ # @param request_pb [::Google::Cloud::Firestore::V1::GetDocumentRequest]
566
+ # A request object representing the call parameters. Required.
567
+ # @return [Array(String, [String, nil], Hash{String => String})]
568
+ # Uri, Body, Query string parameters
569
+ def self.transcode_get_document_request request_pb
570
+ transcoder = Gapic::Rest::GrpcTranscoder.new
571
+ .with_bindings(
572
+ uri_method: :get,
573
+ uri_template: "/v1/{name}",
574
+ matches: [
575
+ ["name", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
576
+ ]
577
+ )
578
+ transcoder.transcode request_pb
579
+ end
580
+
581
+ ##
582
+ # @private
583
+ #
584
+ # GRPC transcoding helper method for the list_documents REST call
585
+ #
586
+ # @param request_pb [::Google::Cloud::Firestore::V1::ListDocumentsRequest]
587
+ # A request object representing the call parameters. Required.
588
+ # @return [Array(String, [String, nil], Hash{String => String})]
589
+ # Uri, Body, Query string parameters
590
+ def self.transcode_list_documents_request request_pb
591
+ transcoder = Gapic::Rest::GrpcTranscoder.new
592
+ .with_bindings(
593
+ uri_method: :get,
594
+ uri_template: "/v1/{parent}/{collection_id}",
595
+ matches: [
596
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true],
597
+ ["collection_id", %r{^[^/]+/?$}, false]
598
+ ]
599
+ )
600
+ .with_bindings(
601
+ uri_method: :get,
602
+ uri_template: "/v1/{parent}/{collection_id}",
603
+ matches: [
604
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false],
605
+ ["collection_id", %r{^[^/]+/?$}, false]
606
+ ]
607
+ )
608
+ transcoder.transcode request_pb
609
+ end
610
+
611
+ ##
612
+ # @private
613
+ #
614
+ # GRPC transcoding helper method for the update_document REST call
615
+ #
616
+ # @param request_pb [::Google::Cloud::Firestore::V1::UpdateDocumentRequest]
617
+ # A request object representing the call parameters. Required.
618
+ # @return [Array(String, [String, nil], Hash{String => String})]
619
+ # Uri, Body, Query string parameters
620
+ def self.transcode_update_document_request request_pb
621
+ transcoder = Gapic::Rest::GrpcTranscoder.new
622
+ .with_bindings(
623
+ uri_method: :patch,
624
+ uri_template: "/v1/{document.name}",
625
+ body: "document",
626
+ matches: [
627
+ ["document.name", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
628
+ ]
629
+ )
630
+ transcoder.transcode request_pb
631
+ end
632
+
633
+ ##
634
+ # @private
635
+ #
636
+ # GRPC transcoding helper method for the delete_document REST call
637
+ #
638
+ # @param request_pb [::Google::Cloud::Firestore::V1::DeleteDocumentRequest]
639
+ # A request object representing the call parameters. Required.
640
+ # @return [Array(String, [String, nil], Hash{String => String})]
641
+ # Uri, Body, Query string parameters
642
+ def self.transcode_delete_document_request request_pb
643
+ transcoder = Gapic::Rest::GrpcTranscoder.new
644
+ .with_bindings(
645
+ uri_method: :delete,
646
+ uri_template: "/v1/{name}",
647
+ matches: [
648
+ ["name", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
649
+ ]
650
+ )
651
+ transcoder.transcode request_pb
652
+ end
653
+
654
+ ##
655
+ # @private
656
+ #
657
+ # GRPC transcoding helper method for the batch_get_documents REST call
658
+ #
659
+ # @param request_pb [::Google::Cloud::Firestore::V1::BatchGetDocumentsRequest]
660
+ # A request object representing the call parameters. Required.
661
+ # @return [Array(String, [String, nil], Hash{String => String})]
662
+ # Uri, Body, Query string parameters
663
+ def self.transcode_batch_get_documents_request request_pb
664
+ transcoder = Gapic::Rest::GrpcTranscoder.new
665
+ .with_bindings(
666
+ uri_method: :post,
667
+ uri_template: "/v1/{database}/documents:batchGet",
668
+ body: "*",
669
+ matches: [
670
+ ["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
671
+ ]
672
+ )
673
+ transcoder.transcode request_pb
674
+ end
675
+
676
+ ##
677
+ # @private
678
+ #
679
+ # GRPC transcoding helper method for the begin_transaction REST call
680
+ #
681
+ # @param request_pb [::Google::Cloud::Firestore::V1::BeginTransactionRequest]
682
+ # A request object representing the call parameters. Required.
683
+ # @return [Array(String, [String, nil], Hash{String => String})]
684
+ # Uri, Body, Query string parameters
685
+ def self.transcode_begin_transaction_request request_pb
686
+ transcoder = Gapic::Rest::GrpcTranscoder.new
687
+ .with_bindings(
688
+ uri_method: :post,
689
+ uri_template: "/v1/{database}/documents:beginTransaction",
690
+ body: "*",
691
+ matches: [
692
+ ["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
693
+ ]
694
+ )
695
+ transcoder.transcode request_pb
696
+ end
697
+
698
+ ##
699
+ # @private
700
+ #
701
+ # GRPC transcoding helper method for the commit REST call
702
+ #
703
+ # @param request_pb [::Google::Cloud::Firestore::V1::CommitRequest]
704
+ # A request object representing the call parameters. Required.
705
+ # @return [Array(String, [String, nil], Hash{String => String})]
706
+ # Uri, Body, Query string parameters
707
+ def self.transcode_commit_request request_pb
708
+ transcoder = Gapic::Rest::GrpcTranscoder.new
709
+ .with_bindings(
710
+ uri_method: :post,
711
+ uri_template: "/v1/{database}/documents:commit",
712
+ body: "*",
713
+ matches: [
714
+ ["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
715
+ ]
716
+ )
717
+ transcoder.transcode request_pb
718
+ end
719
+
720
+ ##
721
+ # @private
722
+ #
723
+ # GRPC transcoding helper method for the rollback REST call
724
+ #
725
+ # @param request_pb [::Google::Cloud::Firestore::V1::RollbackRequest]
726
+ # A request object representing the call parameters. Required.
727
+ # @return [Array(String, [String, nil], Hash{String => String})]
728
+ # Uri, Body, Query string parameters
729
+ def self.transcode_rollback_request request_pb
730
+ transcoder = Gapic::Rest::GrpcTranscoder.new
731
+ .with_bindings(
732
+ uri_method: :post,
733
+ uri_template: "/v1/{database}/documents:rollback",
734
+ body: "*",
735
+ matches: [
736
+ ["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
737
+ ]
738
+ )
739
+ transcoder.transcode request_pb
740
+ end
741
+
742
+ ##
743
+ # @private
744
+ #
745
+ # GRPC transcoding helper method for the run_query REST call
746
+ #
747
+ # @param request_pb [::Google::Cloud::Firestore::V1::RunQueryRequest]
748
+ # A request object representing the call parameters. Required.
749
+ # @return [Array(String, [String, nil], Hash{String => String})]
750
+ # Uri, Body, Query string parameters
751
+ def self.transcode_run_query_request request_pb
752
+ transcoder = Gapic::Rest::GrpcTranscoder.new
753
+ .with_bindings(
754
+ uri_method: :post,
755
+ uri_template: "/v1/{parent}:runQuery",
756
+ body: "*",
757
+ matches: [
758
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false]
759
+ ]
760
+ )
761
+ .with_bindings(
762
+ uri_method: :post,
763
+ uri_template: "/v1/{parent}:runQuery",
764
+ body: "*",
765
+ matches: [
766
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
767
+ ]
768
+ )
769
+ transcoder.transcode request_pb
770
+ end
771
+
772
+ ##
773
+ # @private
774
+ #
775
+ # GRPC transcoding helper method for the run_aggregation_query REST call
776
+ #
777
+ # @param request_pb [::Google::Cloud::Firestore::V1::RunAggregationQueryRequest]
778
+ # A request object representing the call parameters. Required.
779
+ # @return [Array(String, [String, nil], Hash{String => String})]
780
+ # Uri, Body, Query string parameters
781
+ def self.transcode_run_aggregation_query_request request_pb
782
+ transcoder = Gapic::Rest::GrpcTranscoder.new
783
+ .with_bindings(
784
+ uri_method: :post,
785
+ uri_template: "/v1/{parent}:runAggregationQuery",
786
+ body: "*",
787
+ matches: [
788
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false]
789
+ ]
790
+ )
791
+ .with_bindings(
792
+ uri_method: :post,
793
+ uri_template: "/v1/{parent}:runAggregationQuery",
794
+ body: "*",
795
+ matches: [
796
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
797
+ ]
798
+ )
799
+ transcoder.transcode request_pb
800
+ end
801
+
802
+ ##
803
+ # @private
804
+ #
805
+ # GRPC transcoding helper method for the partition_query REST call
806
+ #
807
+ # @param request_pb [::Google::Cloud::Firestore::V1::PartitionQueryRequest]
808
+ # A request object representing the call parameters. Required.
809
+ # @return [Array(String, [String, nil], Hash{String => String})]
810
+ # Uri, Body, Query string parameters
811
+ def self.transcode_partition_query_request request_pb
812
+ transcoder = Gapic::Rest::GrpcTranscoder.new
813
+ .with_bindings(
814
+ uri_method: :post,
815
+ uri_template: "/v1/{parent}:partitionQuery",
816
+ body: "*",
817
+ matches: [
818
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false]
819
+ ]
820
+ )
821
+ .with_bindings(
822
+ uri_method: :post,
823
+ uri_template: "/v1/{parent}:partitionQuery",
824
+ body: "*",
825
+ matches: [
826
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
827
+ ]
828
+ )
829
+ transcoder.transcode request_pb
830
+ end
831
+
832
+ ##
833
+ # @private
834
+ #
835
+ # GRPC transcoding helper method for the list_collection_ids REST call
836
+ #
837
+ # @param request_pb [::Google::Cloud::Firestore::V1::ListCollectionIdsRequest]
838
+ # A request object representing the call parameters. Required.
839
+ # @return [Array(String, [String, nil], Hash{String => String})]
840
+ # Uri, Body, Query string parameters
841
+ def self.transcode_list_collection_ids_request request_pb
842
+ transcoder = Gapic::Rest::GrpcTranscoder.new
843
+ .with_bindings(
844
+ uri_method: :post,
845
+ uri_template: "/v1/{parent}:listCollectionIds",
846
+ body: "*",
847
+ matches: [
848
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/?$}, false]
849
+ ]
850
+ )
851
+ .with_bindings(
852
+ uri_method: :post,
853
+ uri_template: "/v1/{parent}:listCollectionIds",
854
+ body: "*",
855
+ matches: [
856
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents/[^/]+(?:/.*)?$}, true]
857
+ ]
858
+ )
859
+ transcoder.transcode request_pb
860
+ end
861
+
862
+ ##
863
+ # @private
864
+ #
865
+ # GRPC transcoding helper method for the batch_write REST call
866
+ #
867
+ # @param request_pb [::Google::Cloud::Firestore::V1::BatchWriteRequest]
868
+ # A request object representing the call parameters. Required.
869
+ # @return [Array(String, [String, nil], Hash{String => String})]
870
+ # Uri, Body, Query string parameters
871
+ def self.transcode_batch_write_request request_pb
872
+ transcoder = Gapic::Rest::GrpcTranscoder.new
873
+ .with_bindings(
874
+ uri_method: :post,
875
+ uri_template: "/v1/{database}/documents:batchWrite",
876
+ body: "*",
877
+ matches: [
878
+ ["database", %r{^projects/[^/]+/databases/[^/]+/?$}, false]
879
+ ]
880
+ )
881
+ transcoder.transcode request_pb
882
+ end
883
+
884
+ ##
885
+ # @private
886
+ #
887
+ # GRPC transcoding helper method for the create_document REST call
888
+ #
889
+ # @param request_pb [::Google::Cloud::Firestore::V1::CreateDocumentRequest]
890
+ # A request object representing the call parameters. Required.
891
+ # @return [Array(String, [String, nil], Hash{String => String})]
892
+ # Uri, Body, Query string parameters
893
+ def self.transcode_create_document_request request_pb
894
+ transcoder = Gapic::Rest::GrpcTranscoder.new
895
+ .with_bindings(
896
+ uri_method: :post,
897
+ uri_template: "/v1/{parent}/{collection_id}",
898
+ body: "document",
899
+ matches: [
900
+ ["parent", %r{^projects/[^/]+/databases/[^/]+/documents(?:/.*)?$}, true],
901
+ ["collection_id", %r{^[^/]+/?$}, false]
902
+ ]
903
+ )
904
+ transcoder.transcode request_pb
905
+ end
906
+ end
907
+ end
908
+ end
909
+ end
910
+ end
911
+ end
912
+ end