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