google-cloud-dialogflow-v2 1.0.0 → 1.1.0

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