google-cloud-dialogflow-cx-v3 0.21.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/dialogflow/cx/v3/advanced_settings_pb.rb +2 -1
  3. data/lib/google/cloud/dialogflow/cx/v3/agent_pb.rb +2 -1
  4. data/lib/google/cloud/dialogflow/cx/v3/audio_config_pb.rb +2 -1
  5. data/lib/google/cloud/dialogflow/cx/v3/entity_type_pb.rb +1 -1
  6. data/lib/google/cloud/dialogflow/cx/v3/entity_type_services_pb.rb +2 -2
  7. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +119 -119
  8. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +112 -112
  9. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +50 -50
  10. data/lib/google/cloud/dialogflow/cx/v3/flow_pb.rb +3 -1
  11. data/lib/google/cloud/dialogflow/cx/v3/fulfillment_pb.rb +3 -1
  12. data/lib/google/cloud/dialogflow/cx/v3/generator_pb.rb +60 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/generator_services_pb.rb +55 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/generators/client.rb +827 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/generators/credentials.rb +54 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/generators/paths.rb +75 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/client.rb +771 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/service_stub.rb +347 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/generators/rest.rb +55 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/generators.rb +57 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/inline_pb.rb +47 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/intent_pb.rb +13 -1
  23. data/lib/google/cloud/dialogflow/cx/v3/intent_services_pb.rb +22 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +268 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/intents/operations.rb +781 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +254 -0
  27. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/operations.rb +892 -0
  28. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +120 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/intents/rest.rb +1 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +1 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/page_pb.rb +3 -1
  32. data/lib/google/cloud/dialogflow/cx/v3/rest.rb +1 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/session_pb.rb +14 -1
  34. data/lib/google/cloud/dialogflow/cx/v3/session_services_pb.rb +3 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +101 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb +45 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +94 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +60 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  40. data/lib/google/cloud/dialogflow/cx/v3.rb +1 -0
  41. data/proto_docs/google/api/client.rb +13 -0
  42. data/proto_docs/google/cloud/dialogflow/cx/v3/advanced_settings.rb +28 -0
  43. data/proto_docs/google/cloud/dialogflow/cx/v3/agent.rb +15 -0
  44. data/proto_docs/google/cloud/dialogflow/cx/v3/audio_config.rb +47 -3
  45. data/proto_docs/google/cloud/dialogflow/cx/v3/flow.rb +4 -0
  46. data/proto_docs/google/cloud/dialogflow/cx/v3/fulfillment.rb +11 -0
  47. data/proto_docs/google/cloud/dialogflow/cx/v3/generator.rb +187 -0
  48. data/proto_docs/google/cloud/dialogflow/cx/v3/inline.rb +49 -0
  49. data/proto_docs/google/cloud/dialogflow/cx/v3/intent.rb +175 -0
  50. data/proto_docs/google/cloud/dialogflow/cx/v3/page.rb +8 -0
  51. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +192 -0
  52. metadata +17 -3
@@ -0,0 +1,892 @@
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 "gapic/operation"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Dialogflow
24
+ module CX
25
+ module V3
26
+ module Intents
27
+ module Rest
28
+ # Service that implements Longrunning Operations API.
29
+ class Operations
30
+ # @private
31
+ attr_reader :operations_stub
32
+
33
+ ##
34
+ # Configuration for the Intents Operations API.
35
+ #
36
+ # @yield [config] Configure the Operations client.
37
+ # @yieldparam config [Operations::Configuration]
38
+ #
39
+ # @return [Operations::Configuration]
40
+ #
41
+ def self.configure
42
+ @configure ||= Operations::Configuration.new
43
+ yield @configure if block_given?
44
+ @configure
45
+ end
46
+
47
+ ##
48
+ # Configure the Intents Operations instance.
49
+ #
50
+ # The configuration is set to the derived mode, meaning that values can be changed,
51
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
52
+ # should be made on {Operations.configure}.
53
+ #
54
+ # @yield [config] Configure the Operations client.
55
+ # @yieldparam config [Operations::Configuration]
56
+ #
57
+ # @return [Operations::Configuration]
58
+ #
59
+ def configure
60
+ yield @config if block_given?
61
+ @config
62
+ end
63
+
64
+ ##
65
+ # Create a new Operations client object.
66
+ #
67
+ # @yield [config] Configure the Client client.
68
+ # @yieldparam config [Operations::Configuration]
69
+ #
70
+ def initialize
71
+ # Create the configuration object
72
+ @config = Configuration.new Operations.configure
73
+
74
+ # Yield the configuration if needed
75
+ yield @config if block_given?
76
+
77
+ # Create credentials
78
+ credentials = @config.credentials
79
+ credentials ||= Credentials.default scope: @config.scope
80
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
81
+ credentials = Credentials.new credentials, scope: @config.scope
82
+ end
83
+
84
+ @quota_project_id = @config.quota_project
85
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
86
+
87
+ @operations_stub = OperationsServiceStub.new(
88
+ endpoint: @config.endpoint,
89
+ credentials: credentials
90
+ )
91
+
92
+ # Used by an LRO wrapper for some methods of this service
93
+ @operations_client = self
94
+ end
95
+
96
+ # Service calls
97
+
98
+ ##
99
+ # Lists operations that match the specified filter in the request. If the
100
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
101
+ #
102
+ # NOTE: the `name` binding allows API services to override the binding
103
+ # to use different resource name schemes, such as `users/*/operations`. To
104
+ # override the binding, API services can add a binding such as
105
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
106
+ # For backwards compatibility, the default name includes the operations
107
+ # collection id, however overriding users must ensure the name binding
108
+ # is the parent resource, without the operations collection id.
109
+ #
110
+ # @overload list_operations(request, options = nil)
111
+ # Pass arguments to `list_operations` via a request object, either of type
112
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
113
+ #
114
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
115
+ # A request object representing the call parameters. Required. To specify no
116
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
117
+ # @param options [::Gapic::CallOptions, ::Hash]
118
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
119
+ #
120
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
121
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
122
+ # least one keyword argument is required. To specify no parameters, or to keep all
123
+ # the default parameter values, pass an empty Hash as a request object (see above).
124
+ #
125
+ # @param name [::String]
126
+ # The name of the operation's parent resource.
127
+ # @param filter [::String]
128
+ # The standard list filter.
129
+ # @param page_size [::Integer]
130
+ # The standard list page size.
131
+ # @param page_token [::String]
132
+ # The standard list page token.
133
+ # @yield [result, operation] Access the result along with the TransportOperation object
134
+ # @yieldparam result [::Gapic::Operation]
135
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
136
+ #
137
+ # @return [::Gapic::Operation]
138
+ #
139
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
140
+ #
141
+ # @example Basic example
142
+ # require "google/longrunning"
143
+ #
144
+ # # Create a client object. The client can be reused for multiple calls.
145
+ # client = Google::Longrunning::Operations::Rest::Client.new
146
+ #
147
+ # # Create a request. To set request fields, pass in keyword arguments.
148
+ # request = Google::Longrunning::ListOperationsRequest.new
149
+ #
150
+ # # Call the list_operations method.
151
+ # result = client.list_operations request
152
+ #
153
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
154
+ # # over elements, and API calls will be issued to fetch pages as needed.
155
+ # result.each do |item|
156
+ # # Each element is of type ::Google::Longrunning::Operation.
157
+ # p item
158
+ # end
159
+ #
160
+ def list_operations request, options = nil
161
+ raise ::ArgumentError, "request must be provided" if request.nil?
162
+
163
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
164
+
165
+ # Converts hash and nil to an options object
166
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
167
+
168
+ # Customize the options with defaults
169
+ call_metadata = @config.rpcs.list_operations.metadata.to_h
170
+
171
+ # Set x-goog-api-client and x-goog-user-project headers
172
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
173
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
174
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
175
+ transports_version_send: [:rest]
176
+
177
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
178
+
179
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
180
+ metadata: call_metadata,
181
+ retry_policy: @config.rpcs.list_operations.retry_policy
182
+
183
+ options.apply_defaults timeout: @config.timeout,
184
+ metadata: @config.metadata,
185
+ retry_policy: @config.retry_policy
186
+
187
+ @operations_stub.list_operations request, options do |result, operation|
188
+ result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
189
+ yield result, operation if block_given?
190
+ return result
191
+ end
192
+ rescue ::Gapic::Rest::Error => e
193
+ raise ::Google::Cloud::Error.from_error(e)
194
+ end
195
+
196
+ ##
197
+ # Gets the latest state of a long-running operation. Clients can use this
198
+ # method to poll the operation result at intervals as recommended by the API
199
+ # service.
200
+ #
201
+ # @overload get_operation(request, options = nil)
202
+ # Pass arguments to `get_operation` via a request object, either of type
203
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
204
+ #
205
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
206
+ # A request object representing the call parameters. Required. To specify no
207
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
208
+ # @param options [::Gapic::CallOptions, ::Hash]
209
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
210
+ #
211
+ # @overload get_operation(name: nil)
212
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
213
+ # least one keyword argument is required. To specify no parameters, or to keep all
214
+ # the default parameter values, pass an empty Hash as a request object (see above).
215
+ #
216
+ # @param name [::String]
217
+ # The name of the operation resource.
218
+ # @yield [result, operation] Access the result along with the TransportOperation object
219
+ # @yieldparam result [::Gapic::Operation]
220
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
221
+ #
222
+ # @return [::Gapic::Operation]
223
+ #
224
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
225
+ #
226
+ # @example Basic example
227
+ # require "google/longrunning"
228
+ #
229
+ # # Create a client object. The client can be reused for multiple calls.
230
+ # client = Google::Longrunning::Operations::Rest::Client.new
231
+ #
232
+ # # Create a request. To set request fields, pass in keyword arguments.
233
+ # request = Google::Longrunning::GetOperationRequest.new
234
+ #
235
+ # # Call the get_operation method.
236
+ # result = client.get_operation request
237
+ #
238
+ # # The returned object is of type Gapic::Operation. You can use it to
239
+ # # check the status of an operation, cancel it, or wait for results.
240
+ # # Here is how to wait for a response.
241
+ # result.wait_until_done! timeout: 60
242
+ # if result.response?
243
+ # p result.response
244
+ # else
245
+ # puts "No response received."
246
+ # end
247
+ #
248
+ def get_operation request, options = nil
249
+ raise ::ArgumentError, "request must be provided" if request.nil?
250
+
251
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
252
+
253
+ # Converts hash and nil to an options object
254
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
255
+
256
+ # Customize the options with defaults
257
+ call_metadata = @config.rpcs.get_operation.metadata.to_h
258
+
259
+ # Set x-goog-api-client and x-goog-user-project headers
260
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
261
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
262
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
263
+ transports_version_send: [:rest]
264
+
265
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
266
+
267
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
268
+ metadata: call_metadata,
269
+ retry_policy: @config.rpcs.get_operation.retry_policy
270
+
271
+ options.apply_defaults timeout: @config.timeout,
272
+ metadata: @config.metadata,
273
+ retry_policy: @config.retry_policy
274
+
275
+ @operations_stub.get_operation request, options do |result, operation|
276
+ result = ::Gapic::Operation.new result, @operations_client, options: options
277
+ yield result, operation if block_given?
278
+ return result
279
+ end
280
+ rescue ::Gapic::Rest::Error => e
281
+ raise ::Google::Cloud::Error.from_error(e)
282
+ end
283
+
284
+ ##
285
+ # Deletes a long-running operation. This method indicates that the client is
286
+ # no longer interested in the operation result. It does not cancel the
287
+ # operation. If the server doesn't support this method, it returns
288
+ # `google.rpc.Code.UNIMPLEMENTED`.
289
+ #
290
+ # @overload delete_operation(request, options = nil)
291
+ # Pass arguments to `delete_operation` via a request object, either of type
292
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
293
+ #
294
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
295
+ # A request object representing the call parameters. Required. To specify no
296
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
297
+ # @param options [::Gapic::CallOptions, ::Hash]
298
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
299
+ #
300
+ # @overload delete_operation(name: nil)
301
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
302
+ # least one keyword argument is required. To specify no parameters, or to keep all
303
+ # the default parameter values, pass an empty Hash as a request object (see above).
304
+ #
305
+ # @param name [::String]
306
+ # The name of the operation resource to be deleted.
307
+ # @yield [result, operation] Access the result along with the TransportOperation object
308
+ # @yieldparam result [::Google::Protobuf::Empty]
309
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
310
+ #
311
+ # @return [::Google::Protobuf::Empty]
312
+ #
313
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
314
+ #
315
+ # @example Basic example
316
+ # require "google/longrunning"
317
+ #
318
+ # # Create a client object. The client can be reused for multiple calls.
319
+ # client = Google::Longrunning::Operations::Rest::Client.new
320
+ #
321
+ # # Create a request. To set request fields, pass in keyword arguments.
322
+ # request = Google::Longrunning::DeleteOperationRequest.new
323
+ #
324
+ # # Call the delete_operation method.
325
+ # result = client.delete_operation request
326
+ #
327
+ # # The returned object is of type Google::Protobuf::Empty.
328
+ # p result
329
+ #
330
+ def delete_operation request, options = nil
331
+ raise ::ArgumentError, "request must be provided" if request.nil?
332
+
333
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
334
+
335
+ # Converts hash and nil to an options object
336
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
337
+
338
+ # Customize the options with defaults
339
+ call_metadata = @config.rpcs.delete_operation.metadata.to_h
340
+
341
+ # Set x-goog-api-client and x-goog-user-project headers
342
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
343
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
344
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
345
+ transports_version_send: [:rest]
346
+
347
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
348
+
349
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
350
+ metadata: call_metadata,
351
+ retry_policy: @config.rpcs.delete_operation.retry_policy
352
+
353
+ options.apply_defaults timeout: @config.timeout,
354
+ metadata: @config.metadata,
355
+ retry_policy: @config.retry_policy
356
+
357
+ @operations_stub.delete_operation request, options do |result, operation|
358
+ yield result, operation if block_given?
359
+ return result
360
+ end
361
+ rescue ::Gapic::Rest::Error => e
362
+ raise ::Google::Cloud::Error.from_error(e)
363
+ end
364
+
365
+ ##
366
+ # Starts asynchronous cancellation on a long-running operation. The server
367
+ # makes a best effort to cancel the operation, but success is not
368
+ # guaranteed. If the server doesn't support this method, it returns
369
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
370
+ # Operations.GetOperation or
371
+ # other methods to check whether the cancellation succeeded or whether the
372
+ # operation completed despite cancellation. On successful cancellation,
373
+ # the operation is not deleted; instead, it becomes an operation with
374
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
375
+ # corresponding to `Code.CANCELLED`.
376
+ #
377
+ # @overload cancel_operation(request, options = nil)
378
+ # Pass arguments to `cancel_operation` via a request object, either of type
379
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
380
+ #
381
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
382
+ # A request object representing the call parameters. Required. To specify no
383
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
384
+ # @param options [::Gapic::CallOptions, ::Hash]
385
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
386
+ #
387
+ # @overload cancel_operation(name: nil)
388
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
389
+ # least one keyword argument is required. To specify no parameters, or to keep all
390
+ # the default parameter values, pass an empty Hash as a request object (see above).
391
+ #
392
+ # @param name [::String]
393
+ # The name of the operation resource to be cancelled.
394
+ # @yield [result, operation] Access the result along with the TransportOperation object
395
+ # @yieldparam result [::Google::Protobuf::Empty]
396
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
397
+ #
398
+ # @return [::Google::Protobuf::Empty]
399
+ #
400
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
401
+ #
402
+ # @example Basic example
403
+ # require "google/longrunning"
404
+ #
405
+ # # Create a client object. The client can be reused for multiple calls.
406
+ # client = Google::Longrunning::Operations::Rest::Client.new
407
+ #
408
+ # # Create a request. To set request fields, pass in keyword arguments.
409
+ # request = Google::Longrunning::CancelOperationRequest.new
410
+ #
411
+ # # Call the cancel_operation method.
412
+ # result = client.cancel_operation request
413
+ #
414
+ # # The returned object is of type Google::Protobuf::Empty.
415
+ # p result
416
+ #
417
+ def cancel_operation request, options = nil
418
+ raise ::ArgumentError, "request must be provided" if request.nil?
419
+
420
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
421
+
422
+ # Converts hash and nil to an options object
423
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
424
+
425
+ # Customize the options with defaults
426
+ call_metadata = @config.rpcs.cancel_operation.metadata.to_h
427
+
428
+ # Set x-goog-api-client and x-goog-user-project headers
429
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
430
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
431
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
432
+ transports_version_send: [:rest]
433
+
434
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
435
+
436
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
437
+ metadata: call_metadata,
438
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
439
+
440
+ options.apply_defaults timeout: @config.timeout,
441
+ metadata: @config.metadata,
442
+ retry_policy: @config.retry_policy
443
+
444
+ @operations_stub.cancel_operation request, options do |result, operation|
445
+ yield result, operation if block_given?
446
+ return result
447
+ end
448
+ rescue ::Gapic::Rest::Error => e
449
+ raise ::Google::Cloud::Error.from_error(e)
450
+ end
451
+
452
+ ##
453
+ # Configuration class for the Operations REST API.
454
+ #
455
+ # This class represents the configuration for Operations REST,
456
+ # providing control over timeouts, retry behavior, logging, transport
457
+ # parameters, and other low-level controls. Certain parameters can also be
458
+ # applied individually to specific RPCs. See
459
+ # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs}
460
+ # for a list of RPCs that can be configured independently.
461
+ #
462
+ # Configuration can be applied globally to all clients, or to a single client
463
+ # on construction.
464
+ #
465
+ # @example
466
+ #
467
+ # # Modify the global config, setting the timeout for
468
+ # # list_operations to 20 seconds,
469
+ # # and all remaining timeouts to 10 seconds.
470
+ # ::Google::Longrunning::Operations::Rest::Client.configure do |config|
471
+ # config.timeout = 10.0
472
+ # config.rpcs.list_operations.timeout = 20.0
473
+ # end
474
+ #
475
+ # # Apply the above configuration only to a new client.
476
+ # client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
477
+ # config.timeout = 10.0
478
+ # config.rpcs.list_operations.timeout = 20.0
479
+ # end
480
+ #
481
+ # @!attribute [rw] endpoint
482
+ # The hostname or hostname:port of the service endpoint.
483
+ # Defaults to `"dialogflow.googleapis.com"`.
484
+ # @return [::String]
485
+ # @!attribute [rw] credentials
486
+ # Credentials to send with calls. You may provide any of the following types:
487
+ # * (`String`) The path to a service account key file in JSON format
488
+ # * (`Hash`) A service account key as a Hash
489
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
490
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
491
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
492
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
493
+ # * (`nil`) indicating no credentials
494
+ # @return [::Object]
495
+ # @!attribute [rw] scope
496
+ # The OAuth scopes
497
+ # @return [::Array<::String>]
498
+ # @!attribute [rw] lib_name
499
+ # The library name as recorded in instrumentation and logging
500
+ # @return [::String]
501
+ # @!attribute [rw] lib_version
502
+ # The library version as recorded in instrumentation and logging
503
+ # @return [::String]
504
+ # @!attribute [rw] timeout
505
+ # The call timeout in seconds.
506
+ # @return [::Numeric]
507
+ # @!attribute [rw] metadata
508
+ # Additional headers to be sent with the call.
509
+ # @return [::Hash{::Symbol=>::String}]
510
+ # @!attribute [rw] retry_policy
511
+ # The retry policy. The value is a hash with the following keys:
512
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
513
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
514
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
515
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
516
+ # trigger a retry.
517
+ # @return [::Hash]
518
+ # @!attribute [rw] quota_project
519
+ # A separate project against which to charge quota.
520
+ # @return [::String]
521
+ #
522
+ class Configuration
523
+ extend ::Gapic::Config
524
+
525
+ DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
526
+
527
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
528
+ config_attr :credentials, nil do |value|
529
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
530
+ allowed.any? { |klass| klass === value }
531
+ end
532
+ config_attr :scope, nil, ::String, ::Array, nil
533
+ config_attr :lib_name, nil, ::String, nil
534
+ config_attr :lib_version, nil, ::String, nil
535
+ config_attr :timeout, nil, ::Numeric, nil
536
+ config_attr :metadata, nil, ::Hash, nil
537
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
538
+ config_attr :quota_project, nil, ::String, nil
539
+
540
+ # @private
541
+ def initialize parent_config = nil
542
+ @parent_config = parent_config unless parent_config.nil?
543
+
544
+ yield self if block_given?
545
+ end
546
+
547
+ ##
548
+ # Configurations for individual RPCs
549
+ # @return [Rpcs]
550
+ #
551
+ def rpcs
552
+ @rpcs ||= begin
553
+ parent_rpcs = nil
554
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
555
+ Rpcs.new parent_rpcs
556
+ end
557
+ end
558
+
559
+ ##
560
+ # Configuration RPC class for the Operations API.
561
+ #
562
+ # Includes fields providing the configuration for each RPC in this service.
563
+ # Each configuration object is of type `Gapic::Config::Method` and includes
564
+ # the following configuration fields:
565
+ #
566
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
567
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
568
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
569
+ # include the following keys:
570
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
571
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
572
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
573
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
574
+ # trigger a retry.
575
+ #
576
+ class Rpcs
577
+ ##
578
+ # RPC-specific configuration for `list_operations`
579
+ # @return [::Gapic::Config::Method]
580
+ #
581
+ attr_reader :list_operations
582
+ ##
583
+ # RPC-specific configuration for `get_operation`
584
+ # @return [::Gapic::Config::Method]
585
+ #
586
+ attr_reader :get_operation
587
+ ##
588
+ # RPC-specific configuration for `delete_operation`
589
+ # @return [::Gapic::Config::Method]
590
+ #
591
+ attr_reader :delete_operation
592
+ ##
593
+ # RPC-specific configuration for `cancel_operation`
594
+ # @return [::Gapic::Config::Method]
595
+ #
596
+ attr_reader :cancel_operation
597
+
598
+ # @private
599
+ def initialize parent_rpcs = nil
600
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
601
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
602
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
603
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
604
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
605
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
606
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
607
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
608
+
609
+ yield self if block_given?
610
+ end
611
+ end
612
+ end
613
+ end
614
+
615
+ ##
616
+ # @private
617
+ # REST service stub for the Longrunning Operations API.
618
+ # Service stub contains baseline method implementations
619
+ # including transcoding, making the REST call, and deserialing the response.
620
+ class OperationsServiceStub
621
+ def initialize endpoint:, credentials:
622
+ # These require statements are intentionally placed here to initialize
623
+ # the REST modules only when it's required.
624
+ require "gapic/rest"
625
+
626
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
627
+ end
628
+
629
+ ##
630
+ # Baseline implementation for the list_operations REST call
631
+ #
632
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
633
+ # A request object representing the call parameters. Required.
634
+ # @param options [::Gapic::CallOptions]
635
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
636
+ #
637
+ # @yield [result, operation] Access the result along with the TransportOperation object
638
+ # @yieldparam result [::Google::Longrunning::ListOperationsResponse]
639
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
640
+ #
641
+ # @return [::Google::Longrunning::ListOperationsResponse]
642
+ # A result object deserialized from the server's reply
643
+ def list_operations request_pb, options = nil
644
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
645
+
646
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
647
+ query_string_params = if query_string_params.any?
648
+ query_string_params.to_h { |p| p.split "=", 2 }
649
+ else
650
+ {}
651
+ end
652
+
653
+ response = @client_stub.make_http_request(
654
+ verb,
655
+ uri: uri,
656
+ body: body || "",
657
+ params: query_string_params,
658
+ options: options
659
+ )
660
+ operation = ::Gapic::Rest::TransportOperation.new response
661
+ result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
662
+
663
+ yield result, operation if block_given?
664
+ result
665
+ end
666
+
667
+ ##
668
+ # Baseline implementation for the get_operation REST call
669
+ #
670
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
671
+ # A request object representing the call parameters. Required.
672
+ # @param options [::Gapic::CallOptions]
673
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
674
+ #
675
+ # @yield [result, operation] Access the result along with the TransportOperation object
676
+ # @yieldparam result [::Google::Longrunning::Operation]
677
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
678
+ #
679
+ # @return [::Google::Longrunning::Operation]
680
+ # A result object deserialized from the server's reply
681
+ def get_operation request_pb, options = nil
682
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
683
+
684
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
685
+ query_string_params = if query_string_params.any?
686
+ query_string_params.to_h { |p| p.split "=", 2 }
687
+ else
688
+ {}
689
+ end
690
+
691
+ response = @client_stub.make_http_request(
692
+ verb,
693
+ uri: uri,
694
+ body: body || "",
695
+ params: query_string_params,
696
+ options: options
697
+ )
698
+ operation = ::Gapic::Rest::TransportOperation.new response
699
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
700
+
701
+ yield result, operation if block_given?
702
+ result
703
+ end
704
+
705
+ ##
706
+ # Baseline implementation for the delete_operation REST call
707
+ #
708
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
709
+ # A request object representing the call parameters. Required.
710
+ # @param options [::Gapic::CallOptions]
711
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
712
+ #
713
+ # @yield [result, operation] Access the result along with the TransportOperation object
714
+ # @yieldparam result [::Google::Protobuf::Empty]
715
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
716
+ #
717
+ # @return [::Google::Protobuf::Empty]
718
+ # A result object deserialized from the server's reply
719
+ def delete_operation request_pb, options = nil
720
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
721
+
722
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
723
+ query_string_params = if query_string_params.any?
724
+ query_string_params.to_h { |p| p.split "=", 2 }
725
+ else
726
+ {}
727
+ end
728
+
729
+ response = @client_stub.make_http_request(
730
+ verb,
731
+ uri: uri,
732
+ body: body || "",
733
+ params: query_string_params,
734
+ options: options
735
+ )
736
+ operation = ::Gapic::Rest::TransportOperation.new response
737
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
738
+
739
+ yield result, operation if block_given?
740
+ result
741
+ end
742
+
743
+ ##
744
+ # Baseline implementation for the cancel_operation REST call
745
+ #
746
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
747
+ # A request object representing the call parameters. Required.
748
+ # @param options [::Gapic::CallOptions]
749
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
750
+ #
751
+ # @yield [result, operation] Access the result along with the TransportOperation object
752
+ # @yieldparam result [::Google::Protobuf::Empty]
753
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
754
+ #
755
+ # @return [::Google::Protobuf::Empty]
756
+ # A result object deserialized from the server's reply
757
+ def cancel_operation request_pb, options = nil
758
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
759
+
760
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
761
+ query_string_params = if query_string_params.any?
762
+ query_string_params.to_h { |p| p.split "=", 2 }
763
+ else
764
+ {}
765
+ end
766
+
767
+ response = @client_stub.make_http_request(
768
+ verb,
769
+ uri: uri,
770
+ body: body || "",
771
+ params: query_string_params,
772
+ options: options
773
+ )
774
+ operation = ::Gapic::Rest::TransportOperation.new response
775
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
776
+
777
+ yield result, operation if block_given?
778
+ result
779
+ end
780
+
781
+ ##
782
+ # @private
783
+ #
784
+ # GRPC transcoding helper method for the list_operations REST call
785
+ #
786
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
787
+ # A request object representing the call parameters. Required.
788
+ # @return [Array(String, [String, nil], Hash{String => String})]
789
+ # Uri, Body, Query string parameters
790
+ def self.transcode_list_operations_request request_pb
791
+ transcoder = Gapic::Rest::GrpcTranscoder.new
792
+ .with_bindings(
793
+ uri_method: :get,
794
+ uri_template: "/v3/{name}/operations",
795
+ matches: [
796
+ ["name", %r{^projects/[^/]+/?$}, false]
797
+ ]
798
+ )
799
+ .with_bindings(
800
+ uri_method: :get,
801
+ uri_template: "/v3/{name}/operations",
802
+ matches: [
803
+ ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
804
+ ]
805
+ )
806
+ transcoder.transcode request_pb
807
+ end
808
+
809
+ ##
810
+ # @private
811
+ #
812
+ # GRPC transcoding helper method for the get_operation REST call
813
+ #
814
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
815
+ # A request object representing the call parameters. Required.
816
+ # @return [Array(String, [String, nil], Hash{String => String})]
817
+ # Uri, Body, Query string parameters
818
+ def self.transcode_get_operation_request request_pb
819
+ transcoder = Gapic::Rest::GrpcTranscoder.new
820
+ .with_bindings(
821
+ uri_method: :get,
822
+ uri_template: "/v3/{name}",
823
+ matches: [
824
+ ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false]
825
+ ]
826
+ )
827
+ .with_bindings(
828
+ uri_method: :get,
829
+ uri_template: "/v3/{name}",
830
+ matches: [
831
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
832
+ ]
833
+ )
834
+ transcoder.transcode request_pb
835
+ end
836
+
837
+ ##
838
+ # @private
839
+ #
840
+ # GRPC transcoding helper method for the delete_operation REST call
841
+ #
842
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
843
+ # A request object representing the call parameters. Required.
844
+ # @return [Array(String, [String, nil], Hash{String => String})]
845
+ # Uri, Body, Query string parameters
846
+ def self.transcode_delete_operation_request request_pb
847
+ transcoder = Gapic::Rest::GrpcTranscoder.new
848
+ .with_bindings(
849
+ uri_method: :delete,
850
+ uri_template: "/v1/{name}",
851
+ matches: [
852
+ ["name", %r{^operations(?:/.*)?$}, true]
853
+ ]
854
+ )
855
+ transcoder.transcode request_pb
856
+ end
857
+
858
+ ##
859
+ # @private
860
+ #
861
+ # GRPC transcoding helper method for the cancel_operation REST call
862
+ #
863
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
864
+ # A request object representing the call parameters. Required.
865
+ # @return [Array(String, [String, nil], Hash{String => String})]
866
+ # Uri, Body, Query string parameters
867
+ def self.transcode_cancel_operation_request request_pb
868
+ transcoder = Gapic::Rest::GrpcTranscoder.new
869
+ .with_bindings(
870
+ uri_method: :post,
871
+ uri_template: "/v3/{name}:cancel",
872
+ matches: [
873
+ ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false]
874
+ ]
875
+ )
876
+ .with_bindings(
877
+ uri_method: :post,
878
+ uri_template: "/v3/{name}:cancel",
879
+ matches: [
880
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
881
+ ]
882
+ )
883
+ transcoder.transcode request_pb
884
+ end
885
+ end
886
+ end
887
+ end
888
+ end
889
+ end
890
+ end
891
+ end
892
+ end