google-cloud-dialogflow-cx-v3 0.22.0 → 0.23.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/dialogflow/cx/v3/agent_pb.rb +2 -1
  3. data/lib/google/cloud/dialogflow/cx/v3/audio_config_pb.rb +2 -1
  4. data/lib/google/cloud/dialogflow/cx/v3/entity_type_pb.rb +1 -1
  5. data/lib/google/cloud/dialogflow/cx/v3/entity_type_services_pb.rb +2 -2
  6. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +119 -119
  7. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +112 -112
  8. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +50 -50
  9. data/lib/google/cloud/dialogflow/cx/v3/generator_pb.rb +60 -0
  10. data/lib/google/cloud/dialogflow/cx/v3/generator_services_pb.rb +55 -0
  11. data/lib/google/cloud/dialogflow/cx/v3/generators/client.rb +827 -0
  12. data/lib/google/cloud/dialogflow/cx/v3/generators/credentials.rb +54 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/generators/paths.rb +75 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/client.rb +771 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/service_stub.rb +347 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/generators/rest.rb +55 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/generators.rb +57 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/rest.rb +1 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/session_pb.rb +12 -1
  20. data/lib/google/cloud/dialogflow/cx/v3/session_services_pb.rb +3 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +101 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb +45 -0
  23. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +94 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +60 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  26. data/lib/google/cloud/dialogflow/cx/v3.rb +1 -0
  27. data/proto_docs/google/api/client.rb +13 -0
  28. data/proto_docs/google/cloud/dialogflow/cx/v3/agent.rb +15 -0
  29. data/proto_docs/google/cloud/dialogflow/cx/v3/audio_config.rb +47 -3
  30. data/proto_docs/google/cloud/dialogflow/cx/v3/generator.rb +187 -0
  31. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +185 -0
  32. metadata +13 -3
@@ -0,0 +1,771 @@
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/cloud/errors"
20
+ require "google/cloud/dialogflow/cx/v3/generator_pb"
21
+ require "google/cloud/dialogflow/cx/v3/generators/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module CX
28
+ module V3
29
+ module Generators
30
+ module Rest
31
+ ##
32
+ # REST client for the Generators service.
33
+ #
34
+ # Service for managing {::Google::Cloud::Dialogflow::CX::V3::Generator Generators}
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :generators_stub
41
+
42
+ ##
43
+ # Configure the Generators Client class.
44
+ #
45
+ # See {::Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all Generators clients
51
+ # ::Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Dialogflow", "CX", "V3"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.timeout = 60.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the Generators Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # Create a new Generators REST client object.
104
+ #
105
+ # @example
106
+ #
107
+ # # Create a client using the default configuration
108
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.new
109
+ #
110
+ # # Create a client using a custom configuration
111
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the Generators client.
116
+ # @yieldparam config [Client::Configuration]
117
+ #
118
+ def initialize
119
+ # Create the configuration object
120
+ @config = Configuration.new Client.configure
121
+
122
+ # Yield the configuration if needed
123
+ yield @config if block_given?
124
+
125
+ # Create credentials
126
+ credentials = @config.credentials
127
+ # Use self-signed JWT if the endpoint is unchanged from default,
128
+ # but only if the default endpoint does not have a region prefix.
129
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
130
+ !@config.endpoint.split(".").first.include?("-")
131
+ credentials ||= Credentials.default scope: @config.scope,
132
+ enable_self_signed_jwt: enable_self_signed_jwt
133
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
134
+ credentials = Credentials.new credentials, scope: @config.scope
135
+ end
136
+
137
+ @quota_project_id = @config.quota_project
138
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
139
+
140
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
141
+ config.credentials = credentials
142
+ config.quota_project = @quota_project_id
143
+ config.endpoint = @config.endpoint
144
+ config.bindings_override = @config.bindings_override
145
+ end
146
+
147
+ @generators_stub = ::Google::Cloud::Dialogflow::CX::V3::Generators::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
148
+ end
149
+
150
+ ##
151
+ # Get the associated client for mix-in of the Locations.
152
+ #
153
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
154
+ #
155
+ attr_reader :location_client
156
+
157
+ # Service calls
158
+
159
+ ##
160
+ # Returns the list of all generators in the specified agent.
161
+ #
162
+ # @overload list_generators(request, options = nil)
163
+ # Pass arguments to `list_generators` via a request object, either of type
164
+ # {::Google::Cloud::Dialogflow::CX::V3::ListGeneratorsRequest} or an equivalent Hash.
165
+ #
166
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ListGeneratorsRequest, ::Hash]
167
+ # A request object representing the call parameters. Required. To specify no
168
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
169
+ # @param options [::Gapic::CallOptions, ::Hash]
170
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
171
+ #
172
+ # @overload list_generators(parent: nil, language_code: nil, page_size: nil, page_token: nil)
173
+ # Pass arguments to `list_generators` via keyword arguments. Note that at
174
+ # least one keyword argument is required. To specify no parameters, or to keep all
175
+ # the default parameter values, pass an empty Hash as a request object (see above).
176
+ #
177
+ # @param parent [::String]
178
+ # Required. The agent to list all generators for.
179
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
180
+ # @param language_code [::String]
181
+ # The language to list generators for.
182
+ # @param page_size [::Integer]
183
+ # The maximum number of items to return in a single page. By default 100 and
184
+ # at most 1000.
185
+ # @param page_token [::String]
186
+ # The next_page_token value returned from a previous list request.
187
+ # @yield [result, operation] Access the result along with the TransportOperation object
188
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Generator>]
189
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
190
+ #
191
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Generator>]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
194
+ #
195
+ # @example Basic example
196
+ # require "google/cloud/dialogflow/cx/v3"
197
+ #
198
+ # # Create a client object. The client can be reused for multiple calls.
199
+ # client = Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.new
200
+ #
201
+ # # Create a request. To set request fields, pass in keyword arguments.
202
+ # request = Google::Cloud::Dialogflow::CX::V3::ListGeneratorsRequest.new
203
+ #
204
+ # # Call the list_generators method.
205
+ # result = client.list_generators request
206
+ #
207
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
208
+ # # over elements, and API calls will be issued to fetch pages as needed.
209
+ # result.each do |item|
210
+ # # Each element is of type ::Google::Cloud::Dialogflow::CX::V3::Generator.
211
+ # p item
212
+ # end
213
+ #
214
+ def list_generators request, options = nil
215
+ raise ::ArgumentError, "request must be provided" if request.nil?
216
+
217
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListGeneratorsRequest
218
+
219
+ # Converts hash and nil to an options object
220
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
221
+
222
+ # Customize the options with defaults
223
+ call_metadata = @config.rpcs.list_generators.metadata.to_h
224
+
225
+ # Set x-goog-api-client and x-goog-user-project headers
226
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
227
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
228
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
229
+ transports_version_send: [:rest]
230
+
231
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
232
+
233
+ options.apply_defaults timeout: @config.rpcs.list_generators.timeout,
234
+ metadata: call_metadata,
235
+ retry_policy: @config.rpcs.list_generators.retry_policy
236
+
237
+ options.apply_defaults timeout: @config.timeout,
238
+ metadata: @config.metadata,
239
+ retry_policy: @config.retry_policy
240
+
241
+ @generators_stub.list_generators request, options do |result, operation|
242
+ result = ::Gapic::Rest::PagedEnumerable.new @generators_stub, :list_generators, "generators", request, result, options
243
+ yield result, operation if block_given?
244
+ return result
245
+ end
246
+ rescue ::Gapic::Rest::Error => e
247
+ raise ::Google::Cloud::Error.from_error(e)
248
+ end
249
+
250
+ ##
251
+ # Retrieves the specified generator.
252
+ #
253
+ # @overload get_generator(request, options = nil)
254
+ # Pass arguments to `get_generator` via a request object, either of type
255
+ # {::Google::Cloud::Dialogflow::CX::V3::GetGeneratorRequest} or an equivalent Hash.
256
+ #
257
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::GetGeneratorRequest, ::Hash]
258
+ # A request object representing the call parameters. Required. To specify no
259
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
260
+ # @param options [::Gapic::CallOptions, ::Hash]
261
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
262
+ #
263
+ # @overload get_generator(name: nil, language_code: nil)
264
+ # Pass arguments to `get_generator` via keyword arguments. Note that at
265
+ # least one keyword argument is required. To specify no parameters, or to keep all
266
+ # the default parameter values, pass an empty Hash as a request object (see above).
267
+ #
268
+ # @param name [::String]
269
+ # Required. The name of the generator.
270
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
271
+ # ID>/generators/<Generator ID>`.
272
+ # @param language_code [::String]
273
+ # The language to list generators for.
274
+ # @yield [result, operation] Access the result along with the TransportOperation object
275
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Generator]
276
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
277
+ #
278
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Generator]
279
+ #
280
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
281
+ #
282
+ # @example Basic example
283
+ # require "google/cloud/dialogflow/cx/v3"
284
+ #
285
+ # # Create a client object. The client can be reused for multiple calls.
286
+ # client = Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.new
287
+ #
288
+ # # Create a request. To set request fields, pass in keyword arguments.
289
+ # request = Google::Cloud::Dialogflow::CX::V3::GetGeneratorRequest.new
290
+ #
291
+ # # Call the get_generator method.
292
+ # result = client.get_generator request
293
+ #
294
+ # # The returned object is of type Google::Cloud::Dialogflow::CX::V3::Generator.
295
+ # p result
296
+ #
297
+ def get_generator request, options = nil
298
+ raise ::ArgumentError, "request must be provided" if request.nil?
299
+
300
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetGeneratorRequest
301
+
302
+ # Converts hash and nil to an options object
303
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
304
+
305
+ # Customize the options with defaults
306
+ call_metadata = @config.rpcs.get_generator.metadata.to_h
307
+
308
+ # Set x-goog-api-client and x-goog-user-project headers
309
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
310
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
311
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
312
+ transports_version_send: [:rest]
313
+
314
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
315
+
316
+ options.apply_defaults timeout: @config.rpcs.get_generator.timeout,
317
+ metadata: call_metadata,
318
+ retry_policy: @config.rpcs.get_generator.retry_policy
319
+
320
+ options.apply_defaults timeout: @config.timeout,
321
+ metadata: @config.metadata,
322
+ retry_policy: @config.retry_policy
323
+
324
+ @generators_stub.get_generator request, options do |result, operation|
325
+ yield result, operation if block_given?
326
+ return result
327
+ end
328
+ rescue ::Gapic::Rest::Error => e
329
+ raise ::Google::Cloud::Error.from_error(e)
330
+ end
331
+
332
+ ##
333
+ # Creates a generator in the specified agent.
334
+ #
335
+ # @overload create_generator(request, options = nil)
336
+ # Pass arguments to `create_generator` via a request object, either of type
337
+ # {::Google::Cloud::Dialogflow::CX::V3::CreateGeneratorRequest} or an equivalent Hash.
338
+ #
339
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::CreateGeneratorRequest, ::Hash]
340
+ # A request object representing the call parameters. Required. To specify no
341
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
342
+ # @param options [::Gapic::CallOptions, ::Hash]
343
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
344
+ #
345
+ # @overload create_generator(parent: nil, generator: nil, language_code: nil)
346
+ # Pass arguments to `create_generator` via keyword arguments. Note that at
347
+ # least one keyword argument is required. To specify no parameters, or to keep all
348
+ # the default parameter values, pass an empty Hash as a request object (see above).
349
+ #
350
+ # @param parent [::String]
351
+ # Required. The agent to create a generator for.
352
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
353
+ # @param generator [::Google::Cloud::Dialogflow::CX::V3::Generator, ::Hash]
354
+ # Required. The generator to create.
355
+ # @param language_code [::String]
356
+ # The language to create generators for the following fields:
357
+ # * `Generator.prompt_text.text`
358
+ # If not specified, the agent's default language is used.
359
+ # @yield [result, operation] Access the result along with the TransportOperation object
360
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Generator]
361
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
362
+ #
363
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Generator]
364
+ #
365
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
366
+ #
367
+ # @example Basic example
368
+ # require "google/cloud/dialogflow/cx/v3"
369
+ #
370
+ # # Create a client object. The client can be reused for multiple calls.
371
+ # client = Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.new
372
+ #
373
+ # # Create a request. To set request fields, pass in keyword arguments.
374
+ # request = Google::Cloud::Dialogflow::CX::V3::CreateGeneratorRequest.new
375
+ #
376
+ # # Call the create_generator method.
377
+ # result = client.create_generator request
378
+ #
379
+ # # The returned object is of type Google::Cloud::Dialogflow::CX::V3::Generator.
380
+ # p result
381
+ #
382
+ def create_generator request, options = nil
383
+ raise ::ArgumentError, "request must be provided" if request.nil?
384
+
385
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::CreateGeneratorRequest
386
+
387
+ # Converts hash and nil to an options object
388
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
389
+
390
+ # Customize the options with defaults
391
+ call_metadata = @config.rpcs.create_generator.metadata.to_h
392
+
393
+ # Set x-goog-api-client and x-goog-user-project headers
394
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
395
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
396
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
397
+ transports_version_send: [:rest]
398
+
399
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
400
+
401
+ options.apply_defaults timeout: @config.rpcs.create_generator.timeout,
402
+ metadata: call_metadata,
403
+ retry_policy: @config.rpcs.create_generator.retry_policy
404
+
405
+ options.apply_defaults timeout: @config.timeout,
406
+ metadata: @config.metadata,
407
+ retry_policy: @config.retry_policy
408
+
409
+ @generators_stub.create_generator request, options do |result, operation|
410
+ yield result, operation if block_given?
411
+ return result
412
+ end
413
+ rescue ::Gapic::Rest::Error => e
414
+ raise ::Google::Cloud::Error.from_error(e)
415
+ end
416
+
417
+ ##
418
+ # Update the specified generator.
419
+ #
420
+ # @overload update_generator(request, options = nil)
421
+ # Pass arguments to `update_generator` via a request object, either of type
422
+ # {::Google::Cloud::Dialogflow::CX::V3::UpdateGeneratorRequest} or an equivalent Hash.
423
+ #
424
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::UpdateGeneratorRequest, ::Hash]
425
+ # A request object representing the call parameters. Required. To specify no
426
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
427
+ # @param options [::Gapic::CallOptions, ::Hash]
428
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
429
+ #
430
+ # @overload update_generator(generator: nil, language_code: nil, update_mask: nil)
431
+ # Pass arguments to `update_generator` via keyword arguments. Note that at
432
+ # least one keyword argument is required. To specify no parameters, or to keep all
433
+ # the default parameter values, pass an empty Hash as a request object (see above).
434
+ #
435
+ # @param generator [::Google::Cloud::Dialogflow::CX::V3::Generator, ::Hash]
436
+ # Required. The generator to update.
437
+ # @param language_code [::String]
438
+ # The language to list generators for.
439
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
440
+ # The mask to control which fields get updated. If the mask is not present,
441
+ # all fields will be updated.
442
+ # @yield [result, operation] Access the result along with the TransportOperation object
443
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Generator]
444
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
445
+ #
446
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Generator]
447
+ #
448
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
449
+ #
450
+ # @example Basic example
451
+ # require "google/cloud/dialogflow/cx/v3"
452
+ #
453
+ # # Create a client object. The client can be reused for multiple calls.
454
+ # client = Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.new
455
+ #
456
+ # # Create a request. To set request fields, pass in keyword arguments.
457
+ # request = Google::Cloud::Dialogflow::CX::V3::UpdateGeneratorRequest.new
458
+ #
459
+ # # Call the update_generator method.
460
+ # result = client.update_generator request
461
+ #
462
+ # # The returned object is of type Google::Cloud::Dialogflow::CX::V3::Generator.
463
+ # p result
464
+ #
465
+ def update_generator request, options = nil
466
+ raise ::ArgumentError, "request must be provided" if request.nil?
467
+
468
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::UpdateGeneratorRequest
469
+
470
+ # Converts hash and nil to an options object
471
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
472
+
473
+ # Customize the options with defaults
474
+ call_metadata = @config.rpcs.update_generator.metadata.to_h
475
+
476
+ # Set x-goog-api-client and x-goog-user-project headers
477
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
478
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
479
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
480
+ transports_version_send: [:rest]
481
+
482
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
483
+
484
+ options.apply_defaults timeout: @config.rpcs.update_generator.timeout,
485
+ metadata: call_metadata,
486
+ retry_policy: @config.rpcs.update_generator.retry_policy
487
+
488
+ options.apply_defaults timeout: @config.timeout,
489
+ metadata: @config.metadata,
490
+ retry_policy: @config.retry_policy
491
+
492
+ @generators_stub.update_generator request, options do |result, operation|
493
+ yield result, operation if block_given?
494
+ return result
495
+ end
496
+ rescue ::Gapic::Rest::Error => e
497
+ raise ::Google::Cloud::Error.from_error(e)
498
+ end
499
+
500
+ ##
501
+ # Deletes the specified generators.
502
+ #
503
+ # @overload delete_generator(request, options = nil)
504
+ # Pass arguments to `delete_generator` via a request object, either of type
505
+ # {::Google::Cloud::Dialogflow::CX::V3::DeleteGeneratorRequest} or an equivalent Hash.
506
+ #
507
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::DeleteGeneratorRequest, ::Hash]
508
+ # A request object representing the call parameters. Required. To specify no
509
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
510
+ # @param options [::Gapic::CallOptions, ::Hash]
511
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
512
+ #
513
+ # @overload delete_generator(name: nil, force: nil)
514
+ # Pass arguments to `delete_generator` via keyword arguments. Note that at
515
+ # least one keyword argument is required. To specify no parameters, or to keep all
516
+ # the default parameter values, pass an empty Hash as a request object (see above).
517
+ #
518
+ # @param name [::String]
519
+ # Required. The name of the generator to delete.
520
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
521
+ # ID>/generators/<Generator ID>`.
522
+ # @param force [::Boolean]
523
+ # This field has no effect for generators not being used.
524
+ # For generators that are used by pages/flows/transition route groups:
525
+ #
526
+ # * If `force` is set to false, an error will be returned with message
527
+ # indicating the referenced resources.
528
+ # * If `force` is set to true, Dialogflow will remove the generator, as well
529
+ # as any references to the generator (i.e.
530
+ # [Generator][Fulfillment.generator]) in fulfillments.
531
+ # @yield [result, operation] Access the result along with the TransportOperation object
532
+ # @yieldparam result [::Google::Protobuf::Empty]
533
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
534
+ #
535
+ # @return [::Google::Protobuf::Empty]
536
+ #
537
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
538
+ #
539
+ # @example Basic example
540
+ # require "google/cloud/dialogflow/cx/v3"
541
+ #
542
+ # # Create a client object. The client can be reused for multiple calls.
543
+ # client = Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.new
544
+ #
545
+ # # Create a request. To set request fields, pass in keyword arguments.
546
+ # request = Google::Cloud::Dialogflow::CX::V3::DeleteGeneratorRequest.new
547
+ #
548
+ # # Call the delete_generator method.
549
+ # result = client.delete_generator request
550
+ #
551
+ # # The returned object is of type Google::Protobuf::Empty.
552
+ # p result
553
+ #
554
+ def delete_generator request, options = nil
555
+ raise ::ArgumentError, "request must be provided" if request.nil?
556
+
557
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::DeleteGeneratorRequest
558
+
559
+ # Converts hash and nil to an options object
560
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
561
+
562
+ # Customize the options with defaults
563
+ call_metadata = @config.rpcs.delete_generator.metadata.to_h
564
+
565
+ # Set x-goog-api-client and x-goog-user-project headers
566
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
567
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
568
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
569
+ transports_version_send: [:rest]
570
+
571
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
572
+
573
+ options.apply_defaults timeout: @config.rpcs.delete_generator.timeout,
574
+ metadata: call_metadata,
575
+ retry_policy: @config.rpcs.delete_generator.retry_policy
576
+
577
+ options.apply_defaults timeout: @config.timeout,
578
+ metadata: @config.metadata,
579
+ retry_policy: @config.retry_policy
580
+
581
+ @generators_stub.delete_generator request, options do |result, operation|
582
+ yield result, operation if block_given?
583
+ return result
584
+ end
585
+ rescue ::Gapic::Rest::Error => e
586
+ raise ::Google::Cloud::Error.from_error(e)
587
+ end
588
+
589
+ ##
590
+ # Configuration class for the Generators REST API.
591
+ #
592
+ # This class represents the configuration for Generators REST,
593
+ # providing control over timeouts, retry behavior, logging, transport
594
+ # parameters, and other low-level controls. Certain parameters can also be
595
+ # applied individually to specific RPCs. See
596
+ # {::Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client::Configuration::Rpcs}
597
+ # for a list of RPCs that can be configured independently.
598
+ #
599
+ # Configuration can be applied globally to all clients, or to a single client
600
+ # on construction.
601
+ #
602
+ # @example
603
+ #
604
+ # # Modify the global config, setting the timeout for
605
+ # # list_generators to 20 seconds,
606
+ # # and all remaining timeouts to 10 seconds.
607
+ # ::Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.configure do |config|
608
+ # config.timeout = 10.0
609
+ # config.rpcs.list_generators.timeout = 20.0
610
+ # end
611
+ #
612
+ # # Apply the above configuration only to a new client.
613
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Generators::Rest::Client.new do |config|
614
+ # config.timeout = 10.0
615
+ # config.rpcs.list_generators.timeout = 20.0
616
+ # end
617
+ #
618
+ # @!attribute [rw] endpoint
619
+ # The hostname or hostname:port of the service endpoint.
620
+ # Defaults to `"dialogflow.googleapis.com"`.
621
+ # @return [::String]
622
+ # @!attribute [rw] credentials
623
+ # Credentials to send with calls. You may provide any of the following types:
624
+ # * (`String`) The path to a service account key file in JSON format
625
+ # * (`Hash`) A service account key as a Hash
626
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
627
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
628
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
629
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
630
+ # * (`nil`) indicating no credentials
631
+ # @return [::Object]
632
+ # @!attribute [rw] scope
633
+ # The OAuth scopes
634
+ # @return [::Array<::String>]
635
+ # @!attribute [rw] lib_name
636
+ # The library name as recorded in instrumentation and logging
637
+ # @return [::String]
638
+ # @!attribute [rw] lib_version
639
+ # The library version as recorded in instrumentation and logging
640
+ # @return [::String]
641
+ # @!attribute [rw] timeout
642
+ # The call timeout in seconds.
643
+ # @return [::Numeric]
644
+ # @!attribute [rw] metadata
645
+ # Additional headers to be sent with the call.
646
+ # @return [::Hash{::Symbol=>::String}]
647
+ # @!attribute [rw] retry_policy
648
+ # The retry policy. The value is a hash with the following keys:
649
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
650
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
651
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
652
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
653
+ # trigger a retry.
654
+ # @return [::Hash]
655
+ # @!attribute [rw] quota_project
656
+ # A separate project against which to charge quota.
657
+ # @return [::String]
658
+ #
659
+ class Configuration
660
+ extend ::Gapic::Config
661
+
662
+ DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
663
+
664
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
665
+ config_attr :credentials, nil do |value|
666
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
667
+ allowed.any? { |klass| klass === value }
668
+ end
669
+ config_attr :scope, nil, ::String, ::Array, nil
670
+ config_attr :lib_name, nil, ::String, nil
671
+ config_attr :lib_version, nil, ::String, nil
672
+ config_attr :timeout, nil, ::Numeric, nil
673
+ config_attr :metadata, nil, ::Hash, nil
674
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
675
+ config_attr :quota_project, nil, ::String, nil
676
+
677
+ # @private
678
+ # Overrides for http bindings for the RPCs of this service
679
+ # are only used when this service is used as mixin, and only
680
+ # by the host service.
681
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
682
+ config_attr :bindings_override, {}, ::Hash, nil
683
+
684
+ # @private
685
+ def initialize parent_config = nil
686
+ @parent_config = parent_config unless parent_config.nil?
687
+
688
+ yield self if block_given?
689
+ end
690
+
691
+ ##
692
+ # Configurations for individual RPCs
693
+ # @return [Rpcs]
694
+ #
695
+ def rpcs
696
+ @rpcs ||= begin
697
+ parent_rpcs = nil
698
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
699
+ Rpcs.new parent_rpcs
700
+ end
701
+ end
702
+
703
+ ##
704
+ # Configuration RPC class for the Generators API.
705
+ #
706
+ # Includes fields providing the configuration for each RPC in this service.
707
+ # Each configuration object is of type `Gapic::Config::Method` and includes
708
+ # the following configuration fields:
709
+ #
710
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
711
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
712
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
713
+ # include the following keys:
714
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
715
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
716
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
717
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
718
+ # trigger a retry.
719
+ #
720
+ class Rpcs
721
+ ##
722
+ # RPC-specific configuration for `list_generators`
723
+ # @return [::Gapic::Config::Method]
724
+ #
725
+ attr_reader :list_generators
726
+ ##
727
+ # RPC-specific configuration for `get_generator`
728
+ # @return [::Gapic::Config::Method]
729
+ #
730
+ attr_reader :get_generator
731
+ ##
732
+ # RPC-specific configuration for `create_generator`
733
+ # @return [::Gapic::Config::Method]
734
+ #
735
+ attr_reader :create_generator
736
+ ##
737
+ # RPC-specific configuration for `update_generator`
738
+ # @return [::Gapic::Config::Method]
739
+ #
740
+ attr_reader :update_generator
741
+ ##
742
+ # RPC-specific configuration for `delete_generator`
743
+ # @return [::Gapic::Config::Method]
744
+ #
745
+ attr_reader :delete_generator
746
+
747
+ # @private
748
+ def initialize parent_rpcs = nil
749
+ list_generators_config = parent_rpcs.list_generators if parent_rpcs.respond_to? :list_generators
750
+ @list_generators = ::Gapic::Config::Method.new list_generators_config
751
+ get_generator_config = parent_rpcs.get_generator if parent_rpcs.respond_to? :get_generator
752
+ @get_generator = ::Gapic::Config::Method.new get_generator_config
753
+ create_generator_config = parent_rpcs.create_generator if parent_rpcs.respond_to? :create_generator
754
+ @create_generator = ::Gapic::Config::Method.new create_generator_config
755
+ update_generator_config = parent_rpcs.update_generator if parent_rpcs.respond_to? :update_generator
756
+ @update_generator = ::Gapic::Config::Method.new update_generator_config
757
+ delete_generator_config = parent_rpcs.delete_generator if parent_rpcs.respond_to? :delete_generator
758
+ @delete_generator = ::Gapic::Config::Method.new delete_generator_config
759
+
760
+ yield self if block_given?
761
+ end
762
+ end
763
+ end
764
+ end
765
+ end
766
+ end
767
+ end
768
+ end
769
+ end
770
+ end
771
+ end