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

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