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