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

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