google-cloud-dialogflow-v2 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +0 -1
  4. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +0 -2
  5. data/lib/google/cloud/dialogflow/v2/conversation_dataset_pb.rb +92 -0
  6. data/lib/google/cloud/dialogflow/v2/conversation_dataset_services_pb.rb +81 -0
  7. data/lib/google/cloud/dialogflow/v2/conversation_datasets/client.rb +849 -0
  8. data/lib/google/cloud/dialogflow/v2/conversation_datasets/credentials.rb +52 -0
  9. data/lib/google/cloud/dialogflow/v2/conversation_datasets/operations.rb +767 -0
  10. data/lib/google/cloud/dialogflow/v2/conversation_datasets/paths.rb +69 -0
  11. data/lib/google/cloud/dialogflow/v2/conversation_datasets.rb +53 -0
  12. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +0 -1
  13. data/lib/google/cloud/dialogflow/v2/conversation_model_pb.rb +205 -0
  14. data/lib/google/cloud/dialogflow/v2/conversation_model_services_pb.rb +98 -0
  15. data/lib/google/cloud/dialogflow/v2/conversation_models/client.rb +1257 -0
  16. data/lib/google/cloud/dialogflow/v2/conversation_models/credentials.rb +52 -0
  17. data/lib/google/cloud/dialogflow/v2/conversation_models/operations.rb +767 -0
  18. data/lib/google/cloud/dialogflow/v2/conversation_models/paths.rb +179 -0
  19. data/lib/google/cloud/dialogflow/v2/conversation_models.rb +50 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +0 -3
  21. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +26 -1
  22. data/lib/google/cloud/dialogflow/v2/conversation_profile_services_pb.rb +27 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_profiles/client.rb +250 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_profiles/operations.rb +767 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_profiles/paths.rb +31 -9
  26. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +1 -0
  27. data/lib/google/cloud/dialogflow/v2/document_pb.rb +18 -0
  28. data/lib/google/cloud/dialogflow/v2/gcs_pb.rb +0 -1
  29. data/lib/google/cloud/dialogflow/v2/human_agent_assistant_event_pb.rb +0 -1
  30. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +0 -2
  31. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +0 -3
  32. data/lib/google/cloud/dialogflow/v2/session_pb.rb +0 -1
  33. data/lib/google/cloud/dialogflow/v2/validation_result_pb.rb +0 -1
  34. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  35. data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +0 -1
  36. data/lib/google/cloud/dialogflow/v2.rb +5 -1
  37. data/proto_docs/google/cloud/dialogflow/v2/conversation_dataset.rb +211 -0
  38. data/proto_docs/google/cloud/dialogflow/v2/conversation_model.rb +522 -0
  39. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +87 -2
  40. data/proto_docs/google/cloud/dialogflow/v2/document.rb +39 -0
  41. metadata +19 -2
@@ -0,0 +1,1257 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 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/conversation_model_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dialogflow
25
+ module V2
26
+ module ConversationModels
27
+ ##
28
+ # Client for the ConversationModels service.
29
+ #
30
+ # Manages a collection of models for human agent assistant.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :conversation_models_stub
37
+
38
+ ##
39
+ # Configure the ConversationModels Client class.
40
+ #
41
+ # See {::Google::Cloud::Dialogflow::V2::ConversationModels::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all ConversationModels clients
47
+ # ::Google::Cloud::Dialogflow::V2::ConversationModels::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config.timeout = 60.0
68
+ default_config.retry_policy = {
69
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
70
+ }
71
+
72
+ default_config
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the ConversationModels Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::Dialogflow::V2::ConversationModels::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # Create a new ConversationModels client object.
100
+ #
101
+ # @example
102
+ #
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
105
+ #
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::Dialogflow::V2::ConversationModels::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the ConversationModels client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/cloud/dialogflow/v2/conversation_model_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
132
+ !@config.endpoint.split(".").first.include?("-")
133
+ credentials ||= Credentials.default scope: @config.scope,
134
+ enable_self_signed_jwt: enable_self_signed_jwt
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
136
+ credentials = Credentials.new credentials, scope: @config.scope
137
+ end
138
+ @quota_project_id = @config.quota_project
139
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
+
141
+ @operations_client = Operations.new do |config|
142
+ config.credentials = credentials
143
+ config.quota_project = @quota_project_id
144
+ config.endpoint = @config.endpoint
145
+ end
146
+
147
+ @conversation_models_stub = ::Gapic::ServiceStub.new(
148
+ ::Google::Cloud::Dialogflow::V2::ConversationModels::Stub,
149
+ credentials: credentials,
150
+ endpoint: @config.endpoint,
151
+ channel_args: @config.channel_args,
152
+ interceptors: @config.interceptors
153
+ )
154
+ end
155
+
156
+ ##
157
+ # Get the associated client for long-running operations.
158
+ #
159
+ # @return [::Google::Cloud::Dialogflow::V2::ConversationModels::Operations]
160
+ #
161
+ attr_reader :operations_client
162
+
163
+ # Service calls
164
+
165
+ ##
166
+ # Creates a model.
167
+ #
168
+ # This method is a [long-running
169
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
170
+ # The returned `Operation` type has the following method-specific fields:
171
+ #
172
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::CreateConversationModelOperationMetadata CreateConversationModelOperationMetadata}
173
+ # - `response`: {::Google::Cloud::Dialogflow::V2::ConversationModel ConversationModel}
174
+ #
175
+ # @overload create_conversation_model(request, options = nil)
176
+ # Pass arguments to `create_conversation_model` via a request object, either of type
177
+ # {::Google::Cloud::Dialogflow::V2::CreateConversationModelRequest} or an equivalent Hash.
178
+ #
179
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateConversationModelRequest, ::Hash]
180
+ # A request object representing the call parameters. Required. To specify no
181
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
182
+ # @param options [::Gapic::CallOptions, ::Hash]
183
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
184
+ #
185
+ # @overload create_conversation_model(parent: nil, conversation_model: nil)
186
+ # Pass arguments to `create_conversation_model` via keyword arguments. Note that at
187
+ # least one keyword argument is required. To specify no parameters, or to keep all
188
+ # the default parameter values, pass an empty Hash as a request object (see above).
189
+ #
190
+ # @param parent [::String]
191
+ # The project to create conversation model for. Format:
192
+ # `projects/<Project ID>`
193
+ # @param conversation_model [::Google::Cloud::Dialogflow::V2::ConversationModel, ::Hash]
194
+ # Required. The conversation model to create.
195
+ #
196
+ # @yield [response, operation] Access the result along with the RPC operation
197
+ # @yieldparam response [::Gapic::Operation]
198
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
199
+ #
200
+ # @return [::Gapic::Operation]
201
+ #
202
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
203
+ #
204
+ # @example Basic example
205
+ # require "google/cloud/dialogflow/v2"
206
+ #
207
+ # # Create a client object. The client can be reused for multiple calls.
208
+ # client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
209
+ #
210
+ # # Create a request. To set request fields, pass in keyword arguments.
211
+ # request = Google::Cloud::Dialogflow::V2::CreateConversationModelRequest.new
212
+ #
213
+ # # Call the create_conversation_model method.
214
+ # result = client.create_conversation_model request
215
+ #
216
+ # # The returned object is of type Gapic::Operation. You can use this
217
+ # # object to check the status of an operation, cancel it, or wait
218
+ # # for results. Here is how to block until completion:
219
+ # result.wait_until_done! timeout: 60
220
+ # if result.response?
221
+ # p result.response
222
+ # else
223
+ # puts "Error!"
224
+ # end
225
+ #
226
+ def create_conversation_model request, options = nil
227
+ raise ::ArgumentError, "request must be provided" if request.nil?
228
+
229
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateConversationModelRequest
230
+
231
+ # Converts hash and nil to an options object
232
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
233
+
234
+ # Customize the options with defaults
235
+ metadata = @config.rpcs.create_conversation_model.metadata.to_h
236
+
237
+ # Set x-goog-api-client and x-goog-user-project headers
238
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
239
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
240
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
241
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
242
+
243
+ header_params = {}
244
+ if request.parent
245
+ header_params["parent"] = request.parent
246
+ end
247
+
248
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
249
+ metadata[:"x-goog-request-params"] ||= request_params_header
250
+
251
+ options.apply_defaults timeout: @config.rpcs.create_conversation_model.timeout,
252
+ metadata: metadata,
253
+ retry_policy: @config.rpcs.create_conversation_model.retry_policy
254
+
255
+ options.apply_defaults timeout: @config.timeout,
256
+ metadata: @config.metadata,
257
+ retry_policy: @config.retry_policy
258
+
259
+ @conversation_models_stub.call_rpc :create_conversation_model, request, options: options do |response, operation|
260
+ response = ::Gapic::Operation.new response, @operations_client, options: options
261
+ yield response, operation if block_given?
262
+ return response
263
+ end
264
+ rescue ::GRPC::BadStatus => e
265
+ raise ::Google::Cloud::Error.from_error(e)
266
+ end
267
+
268
+ ##
269
+ # Gets conversation model.
270
+ #
271
+ # @overload get_conversation_model(request, options = nil)
272
+ # Pass arguments to `get_conversation_model` via a request object, either of type
273
+ # {::Google::Cloud::Dialogflow::V2::GetConversationModelRequest} or an equivalent Hash.
274
+ #
275
+ # @param request [::Google::Cloud::Dialogflow::V2::GetConversationModelRequest, ::Hash]
276
+ # A request object representing the call parameters. Required. To specify no
277
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
278
+ # @param options [::Gapic::CallOptions, ::Hash]
279
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
280
+ #
281
+ # @overload get_conversation_model(name: nil)
282
+ # Pass arguments to `get_conversation_model` via keyword arguments. Note that at
283
+ # least one keyword argument is required. To specify no parameters, or to keep all
284
+ # the default parameter values, pass an empty Hash as a request object (see above).
285
+ #
286
+ # @param name [::String]
287
+ # Required. The conversation model to retrieve. Format:
288
+ # `projects/<Project ID>/conversationModels/<Conversation Model ID>`
289
+ #
290
+ # @yield [response, operation] Access the result along with the RPC operation
291
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::ConversationModel]
292
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
293
+ #
294
+ # @return [::Google::Cloud::Dialogflow::V2::ConversationModel]
295
+ #
296
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
297
+ #
298
+ # @example Basic example
299
+ # require "google/cloud/dialogflow/v2"
300
+ #
301
+ # # Create a client object. The client can be reused for multiple calls.
302
+ # client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
303
+ #
304
+ # # Create a request. To set request fields, pass in keyword arguments.
305
+ # request = Google::Cloud::Dialogflow::V2::GetConversationModelRequest.new
306
+ #
307
+ # # Call the get_conversation_model method.
308
+ # result = client.get_conversation_model request
309
+ #
310
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::ConversationModel.
311
+ # p result
312
+ #
313
+ def get_conversation_model request, options = nil
314
+ raise ::ArgumentError, "request must be provided" if request.nil?
315
+
316
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetConversationModelRequest
317
+
318
+ # Converts hash and nil to an options object
319
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
320
+
321
+ # Customize the options with defaults
322
+ metadata = @config.rpcs.get_conversation_model.metadata.to_h
323
+
324
+ # Set x-goog-api-client and x-goog-user-project headers
325
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
326
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
327
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
328
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
329
+
330
+ header_params = {}
331
+ if request.name
332
+ header_params["name"] = request.name
333
+ end
334
+
335
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
336
+ metadata[:"x-goog-request-params"] ||= request_params_header
337
+
338
+ options.apply_defaults timeout: @config.rpcs.get_conversation_model.timeout,
339
+ metadata: metadata,
340
+ retry_policy: @config.rpcs.get_conversation_model.retry_policy
341
+
342
+ options.apply_defaults timeout: @config.timeout,
343
+ metadata: @config.metadata,
344
+ retry_policy: @config.retry_policy
345
+
346
+ @conversation_models_stub.call_rpc :get_conversation_model, request, options: options do |response, operation|
347
+ yield response, operation if block_given?
348
+ return response
349
+ end
350
+ rescue ::GRPC::BadStatus => e
351
+ raise ::Google::Cloud::Error.from_error(e)
352
+ end
353
+
354
+ ##
355
+ # Lists conversation models.
356
+ #
357
+ # @overload list_conversation_models(request, options = nil)
358
+ # Pass arguments to `list_conversation_models` via a request object, either of type
359
+ # {::Google::Cloud::Dialogflow::V2::ListConversationModelsRequest} or an equivalent Hash.
360
+ #
361
+ # @param request [::Google::Cloud::Dialogflow::V2::ListConversationModelsRequest, ::Hash]
362
+ # A request object representing the call parameters. Required. To specify no
363
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
364
+ # @param options [::Gapic::CallOptions, ::Hash]
365
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
366
+ #
367
+ # @overload list_conversation_models(parent: nil, page_size: nil, page_token: nil)
368
+ # Pass arguments to `list_conversation_models` via keyword arguments. Note that at
369
+ # least one keyword argument is required. To specify no parameters, or to keep all
370
+ # the default parameter values, pass an empty Hash as a request object (see above).
371
+ #
372
+ # @param parent [::String]
373
+ # Required. The project to list all conversation models for.
374
+ # Format: `projects/<Project ID>`
375
+ # @param page_size [::Integer]
376
+ # Optional. Maximum number of conversation models to return in a single
377
+ # page. By default 100 and at most 1000.
378
+ # @param page_token [::String]
379
+ # Optional. The next_page_token value returned from a previous list request.
380
+ #
381
+ # @yield [response, operation] Access the result along with the RPC operation
382
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModel>]
383
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
384
+ #
385
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModel>]
386
+ #
387
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
388
+ #
389
+ # @example Basic example
390
+ # require "google/cloud/dialogflow/v2"
391
+ #
392
+ # # Create a client object. The client can be reused for multiple calls.
393
+ # client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
394
+ #
395
+ # # Create a request. To set request fields, pass in keyword arguments.
396
+ # request = Google::Cloud::Dialogflow::V2::ListConversationModelsRequest.new
397
+ #
398
+ # # Call the list_conversation_models method.
399
+ # result = client.list_conversation_models request
400
+ #
401
+ # # The returned object is of type Gapic::PagedEnumerable. You can
402
+ # # iterate over all elements by calling #each, and the enumerable
403
+ # # will lazily make API calls to fetch subsequent pages. Other
404
+ # # methods are also available for managing paging directly.
405
+ # result.each do |response|
406
+ # # Each element is of type ::Google::Cloud::Dialogflow::V2::ConversationModel.
407
+ # p response
408
+ # end
409
+ #
410
+ def list_conversation_models 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::ListConversationModelsRequest
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
+ metadata = @config.rpcs.list_conversation_models.metadata.to_h
420
+
421
+ # Set x-goog-api-client and x-goog-user-project headers
422
+ 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
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
426
+
427
+ header_params = {}
428
+ if request.parent
429
+ header_params["parent"] = request.parent
430
+ end
431
+
432
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
433
+ metadata[:"x-goog-request-params"] ||= request_params_header
434
+
435
+ options.apply_defaults timeout: @config.rpcs.list_conversation_models.timeout,
436
+ metadata: metadata,
437
+ retry_policy: @config.rpcs.list_conversation_models.retry_policy
438
+
439
+ options.apply_defaults timeout: @config.timeout,
440
+ metadata: @config.metadata,
441
+ retry_policy: @config.retry_policy
442
+
443
+ @conversation_models_stub.call_rpc :list_conversation_models, request, options: options do |response, operation|
444
+ response = ::Gapic::PagedEnumerable.new @conversation_models_stub, :list_conversation_models, request, response, operation, options
445
+ yield response, operation if block_given?
446
+ return response
447
+ end
448
+ rescue ::GRPC::BadStatus => e
449
+ raise ::Google::Cloud::Error.from_error(e)
450
+ end
451
+
452
+ ##
453
+ # Deletes a model.
454
+ #
455
+ # This method is a [long-running
456
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
457
+ # The returned `Operation` type has the following method-specific fields:
458
+ #
459
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::DeleteConversationModelOperationMetadata DeleteConversationModelOperationMetadata}
460
+ # - `response`: An [Empty
461
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
462
+ #
463
+ # @overload delete_conversation_model(request, options = nil)
464
+ # Pass arguments to `delete_conversation_model` via a request object, either of type
465
+ # {::Google::Cloud::Dialogflow::V2::DeleteConversationModelRequest} or an equivalent Hash.
466
+ #
467
+ # @param request [::Google::Cloud::Dialogflow::V2::DeleteConversationModelRequest, ::Hash]
468
+ # A request object representing the call parameters. Required. To specify no
469
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
470
+ # @param options [::Gapic::CallOptions, ::Hash]
471
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
472
+ #
473
+ # @overload delete_conversation_model(name: nil)
474
+ # Pass arguments to `delete_conversation_model` via keyword arguments. Note that at
475
+ # least one keyword argument is required. To specify no parameters, or to keep all
476
+ # the default parameter values, pass an empty Hash as a request object (see above).
477
+ #
478
+ # @param name [::String]
479
+ # Required. The conversation model to delete. Format:
480
+ # `projects/<Project ID>/conversationModels/<Conversation Model ID>`
481
+ #
482
+ # @yield [response, operation] Access the result along with the RPC operation
483
+ # @yieldparam response [::Gapic::Operation]
484
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
485
+ #
486
+ # @return [::Gapic::Operation]
487
+ #
488
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
489
+ #
490
+ # @example Basic example
491
+ # require "google/cloud/dialogflow/v2"
492
+ #
493
+ # # Create a client object. The client can be reused for multiple calls.
494
+ # client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
495
+ #
496
+ # # Create a request. To set request fields, pass in keyword arguments.
497
+ # request = Google::Cloud::Dialogflow::V2::DeleteConversationModelRequest.new
498
+ #
499
+ # # Call the delete_conversation_model method.
500
+ # result = client.delete_conversation_model request
501
+ #
502
+ # # The returned object is of type Gapic::Operation. You can use this
503
+ # # object to check the status of an operation, cancel it, or wait
504
+ # # for results. Here is how to block until completion:
505
+ # result.wait_until_done! timeout: 60
506
+ # if result.response?
507
+ # p result.response
508
+ # else
509
+ # puts "Error!"
510
+ # end
511
+ #
512
+ def delete_conversation_model request, options = nil
513
+ raise ::ArgumentError, "request must be provided" if request.nil?
514
+
515
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeleteConversationModelRequest
516
+
517
+ # Converts hash and nil to an options object
518
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
519
+
520
+ # Customize the options with defaults
521
+ metadata = @config.rpcs.delete_conversation_model.metadata.to_h
522
+
523
+ # Set x-goog-api-client and x-goog-user-project headers
524
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
525
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
526
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
527
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
528
+
529
+ header_params = {}
530
+ if request.name
531
+ header_params["name"] = request.name
532
+ end
533
+
534
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
535
+ metadata[:"x-goog-request-params"] ||= request_params_header
536
+
537
+ options.apply_defaults timeout: @config.rpcs.delete_conversation_model.timeout,
538
+ metadata: metadata,
539
+ retry_policy: @config.rpcs.delete_conversation_model.retry_policy
540
+
541
+ options.apply_defaults timeout: @config.timeout,
542
+ metadata: @config.metadata,
543
+ retry_policy: @config.retry_policy
544
+
545
+ @conversation_models_stub.call_rpc :delete_conversation_model, request, options: options do |response, operation|
546
+ response = ::Gapic::Operation.new response, @operations_client, options: options
547
+ yield response, operation if block_given?
548
+ return response
549
+ end
550
+ rescue ::GRPC::BadStatus => e
551
+ raise ::Google::Cloud::Error.from_error(e)
552
+ end
553
+
554
+ ##
555
+ # Deploys a model. If a model is already deployed, deploying it
556
+ # has no effect. A model can only serve prediction requests after it gets
557
+ # deployed. For article suggestion, custom model will not be used unless
558
+ # it is deployed.
559
+ #
560
+ # This method is a [long-running
561
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
562
+ # The returned `Operation` type has the following method-specific fields:
563
+ #
564
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::DeployConversationModelOperationMetadata DeployConversationModelOperationMetadata}
565
+ # - `response`: An [Empty
566
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
567
+ #
568
+ # @overload deploy_conversation_model(request, options = nil)
569
+ # Pass arguments to `deploy_conversation_model` via a request object, either of type
570
+ # {::Google::Cloud::Dialogflow::V2::DeployConversationModelRequest} or an equivalent Hash.
571
+ #
572
+ # @param request [::Google::Cloud::Dialogflow::V2::DeployConversationModelRequest, ::Hash]
573
+ # A request object representing the call parameters. Required. To specify no
574
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
575
+ # @param options [::Gapic::CallOptions, ::Hash]
576
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
577
+ #
578
+ # @overload deploy_conversation_model(name: nil)
579
+ # Pass arguments to `deploy_conversation_model` via keyword arguments. Note that at
580
+ # least one keyword argument is required. To specify no parameters, or to keep all
581
+ # the default parameter values, pass an empty Hash as a request object (see above).
582
+ #
583
+ # @param name [::String]
584
+ # Required. The conversation model to deploy. Format:
585
+ # `projects/<Project ID>/conversationModels/<Conversation Model ID>`
586
+ #
587
+ # @yield [response, operation] Access the result along with the RPC operation
588
+ # @yieldparam response [::Gapic::Operation]
589
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
590
+ #
591
+ # @return [::Gapic::Operation]
592
+ #
593
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
594
+ #
595
+ # @example Basic example
596
+ # require "google/cloud/dialogflow/v2"
597
+ #
598
+ # # Create a client object. The client can be reused for multiple calls.
599
+ # client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
600
+ #
601
+ # # Create a request. To set request fields, pass in keyword arguments.
602
+ # request = Google::Cloud::Dialogflow::V2::DeployConversationModelRequest.new
603
+ #
604
+ # # Call the deploy_conversation_model method.
605
+ # result = client.deploy_conversation_model request
606
+ #
607
+ # # The returned object is of type Gapic::Operation. You can use this
608
+ # # object to check the status of an operation, cancel it, or wait
609
+ # # for results. Here is how to block until completion:
610
+ # result.wait_until_done! timeout: 60
611
+ # if result.response?
612
+ # p result.response
613
+ # else
614
+ # puts "Error!"
615
+ # end
616
+ #
617
+ def deploy_conversation_model request, options = nil
618
+ raise ::ArgumentError, "request must be provided" if request.nil?
619
+
620
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeployConversationModelRequest
621
+
622
+ # Converts hash and nil to an options object
623
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
624
+
625
+ # Customize the options with defaults
626
+ metadata = @config.rpcs.deploy_conversation_model.metadata.to_h
627
+
628
+ # Set x-goog-api-client and x-goog-user-project headers
629
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
630
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
631
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
632
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
633
+
634
+ header_params = {}
635
+ if request.name
636
+ header_params["name"] = request.name
637
+ end
638
+
639
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
640
+ metadata[:"x-goog-request-params"] ||= request_params_header
641
+
642
+ options.apply_defaults timeout: @config.rpcs.deploy_conversation_model.timeout,
643
+ metadata: metadata,
644
+ retry_policy: @config.rpcs.deploy_conversation_model.retry_policy
645
+
646
+ options.apply_defaults timeout: @config.timeout,
647
+ metadata: @config.metadata,
648
+ retry_policy: @config.retry_policy
649
+
650
+ @conversation_models_stub.call_rpc :deploy_conversation_model, request, options: options do |response, operation|
651
+ response = ::Gapic::Operation.new response, @operations_client, options: options
652
+ yield response, operation if block_given?
653
+ return response
654
+ end
655
+ rescue ::GRPC::BadStatus => e
656
+ raise ::Google::Cloud::Error.from_error(e)
657
+ end
658
+
659
+ ##
660
+ # Undeploys a model. If the model is not deployed this method has no effect.
661
+ # If the model is currently being used:
662
+ # - For article suggestion, article suggestion will fallback to the default
663
+ # model if model is undeployed.
664
+ #
665
+ # This method is a [long-running
666
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
667
+ # The returned `Operation` type has the following method-specific fields:
668
+ #
669
+ # - `metadata`: {::Google::Cloud::Dialogflow::V2::UndeployConversationModelOperationMetadata UndeployConversationModelOperationMetadata}
670
+ # - `response`: An [Empty
671
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
672
+ #
673
+ # @overload undeploy_conversation_model(request, options = nil)
674
+ # Pass arguments to `undeploy_conversation_model` via a request object, either of type
675
+ # {::Google::Cloud::Dialogflow::V2::UndeployConversationModelRequest} or an equivalent Hash.
676
+ #
677
+ # @param request [::Google::Cloud::Dialogflow::V2::UndeployConversationModelRequest, ::Hash]
678
+ # A request object representing the call parameters. Required. To specify no
679
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
680
+ # @param options [::Gapic::CallOptions, ::Hash]
681
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
682
+ #
683
+ # @overload undeploy_conversation_model(name: nil)
684
+ # Pass arguments to `undeploy_conversation_model` via keyword arguments. Note that at
685
+ # least one keyword argument is required. To specify no parameters, or to keep all
686
+ # the default parameter values, pass an empty Hash as a request object (see above).
687
+ #
688
+ # @param name [::String]
689
+ # Required. The conversation model to undeploy. Format:
690
+ # `projects/<Project ID>/conversationModels/<Conversation Model ID>`
691
+ #
692
+ # @yield [response, operation] Access the result along with the RPC operation
693
+ # @yieldparam response [::Gapic::Operation]
694
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
695
+ #
696
+ # @return [::Gapic::Operation]
697
+ #
698
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
699
+ #
700
+ # @example Basic example
701
+ # require "google/cloud/dialogflow/v2"
702
+ #
703
+ # # Create a client object. The client can be reused for multiple calls.
704
+ # client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
705
+ #
706
+ # # Create a request. To set request fields, pass in keyword arguments.
707
+ # request = Google::Cloud::Dialogflow::V2::UndeployConversationModelRequest.new
708
+ #
709
+ # # Call the undeploy_conversation_model method.
710
+ # result = client.undeploy_conversation_model request
711
+ #
712
+ # # The returned object is of type Gapic::Operation. You can use this
713
+ # # object to check the status of an operation, cancel it, or wait
714
+ # # for results. Here is how to block until completion:
715
+ # result.wait_until_done! timeout: 60
716
+ # if result.response?
717
+ # p result.response
718
+ # else
719
+ # puts "Error!"
720
+ # end
721
+ #
722
+ def undeploy_conversation_model request, options = nil
723
+ raise ::ArgumentError, "request must be provided" if request.nil?
724
+
725
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UndeployConversationModelRequest
726
+
727
+ # Converts hash and nil to an options object
728
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
729
+
730
+ # Customize the options with defaults
731
+ metadata = @config.rpcs.undeploy_conversation_model.metadata.to_h
732
+
733
+ # Set x-goog-api-client and x-goog-user-project headers
734
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
735
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
736
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
737
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
738
+
739
+ header_params = {}
740
+ if request.name
741
+ header_params["name"] = request.name
742
+ end
743
+
744
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
745
+ metadata[:"x-goog-request-params"] ||= request_params_header
746
+
747
+ options.apply_defaults timeout: @config.rpcs.undeploy_conversation_model.timeout,
748
+ metadata: metadata,
749
+ retry_policy: @config.rpcs.undeploy_conversation_model.retry_policy
750
+
751
+ options.apply_defaults timeout: @config.timeout,
752
+ metadata: @config.metadata,
753
+ retry_policy: @config.retry_policy
754
+
755
+ @conversation_models_stub.call_rpc :undeploy_conversation_model, request, options: options do |response, operation|
756
+ response = ::Gapic::Operation.new response, @operations_client, options: options
757
+ yield response, operation if block_given?
758
+ return response
759
+ end
760
+ rescue ::GRPC::BadStatus => e
761
+ raise ::Google::Cloud::Error.from_error(e)
762
+ end
763
+
764
+ ##
765
+ # Gets an evaluation of conversation model.
766
+ #
767
+ # @overload get_conversation_model_evaluation(request, options = nil)
768
+ # Pass arguments to `get_conversation_model_evaluation` via a request object, either of type
769
+ # {::Google::Cloud::Dialogflow::V2::GetConversationModelEvaluationRequest} or an equivalent Hash.
770
+ #
771
+ # @param request [::Google::Cloud::Dialogflow::V2::GetConversationModelEvaluationRequest, ::Hash]
772
+ # A request object representing the call parameters. Required. To specify no
773
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
774
+ # @param options [::Gapic::CallOptions, ::Hash]
775
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
776
+ #
777
+ # @overload get_conversation_model_evaluation(name: nil)
778
+ # Pass arguments to `get_conversation_model_evaluation` via keyword arguments. Note that at
779
+ # least one keyword argument is required. To specify no parameters, or to keep all
780
+ # the default parameter values, pass an empty Hash as a request object (see above).
781
+ #
782
+ # @param name [::String]
783
+ # Required. The conversation model evaluation resource name. Format:
784
+ # `projects/<Project ID>/conversationModels/<Conversation Model
785
+ # ID>/evaluations/<Evaluation ID>`
786
+ #
787
+ # @yield [response, operation] Access the result along with the RPC operation
788
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation]
789
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
790
+ #
791
+ # @return [::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation]
792
+ #
793
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
794
+ #
795
+ # @example Basic example
796
+ # require "google/cloud/dialogflow/v2"
797
+ #
798
+ # # Create a client object. The client can be reused for multiple calls.
799
+ # client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
800
+ #
801
+ # # Create a request. To set request fields, pass in keyword arguments.
802
+ # request = Google::Cloud::Dialogflow::V2::GetConversationModelEvaluationRequest.new
803
+ #
804
+ # # Call the get_conversation_model_evaluation method.
805
+ # result = client.get_conversation_model_evaluation request
806
+ #
807
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::ConversationModelEvaluation.
808
+ # p result
809
+ #
810
+ def get_conversation_model_evaluation request, options = nil
811
+ raise ::ArgumentError, "request must be provided" if request.nil?
812
+
813
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetConversationModelEvaluationRequest
814
+
815
+ # Converts hash and nil to an options object
816
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
817
+
818
+ # Customize the options with defaults
819
+ metadata = @config.rpcs.get_conversation_model_evaluation.metadata.to_h
820
+
821
+ # Set x-goog-api-client and x-goog-user-project headers
822
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
823
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
824
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
825
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
826
+
827
+ header_params = {}
828
+ if request.name
829
+ header_params["name"] = request.name
830
+ end
831
+
832
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
833
+ metadata[:"x-goog-request-params"] ||= request_params_header
834
+
835
+ options.apply_defaults timeout: @config.rpcs.get_conversation_model_evaluation.timeout,
836
+ metadata: metadata,
837
+ retry_policy: @config.rpcs.get_conversation_model_evaluation.retry_policy
838
+
839
+ options.apply_defaults timeout: @config.timeout,
840
+ metadata: @config.metadata,
841
+ retry_policy: @config.retry_policy
842
+
843
+ @conversation_models_stub.call_rpc :get_conversation_model_evaluation, request, options: options do |response, operation|
844
+ yield response, operation if block_given?
845
+ return response
846
+ end
847
+ rescue ::GRPC::BadStatus => e
848
+ raise ::Google::Cloud::Error.from_error(e)
849
+ end
850
+
851
+ ##
852
+ # Lists evaluations of a conversation model.
853
+ #
854
+ # @overload list_conversation_model_evaluations(request, options = nil)
855
+ # Pass arguments to `list_conversation_model_evaluations` via a request object, either of type
856
+ # {::Google::Cloud::Dialogflow::V2::ListConversationModelEvaluationsRequest} or an equivalent Hash.
857
+ #
858
+ # @param request [::Google::Cloud::Dialogflow::V2::ListConversationModelEvaluationsRequest, ::Hash]
859
+ # A request object representing the call parameters. Required. To specify no
860
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
861
+ # @param options [::Gapic::CallOptions, ::Hash]
862
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
863
+ #
864
+ # @overload list_conversation_model_evaluations(parent: nil, page_size: nil, page_token: nil)
865
+ # Pass arguments to `list_conversation_model_evaluations` via keyword arguments. Note that at
866
+ # least one keyword argument is required. To specify no parameters, or to keep all
867
+ # the default parameter values, pass an empty Hash as a request object (see above).
868
+ #
869
+ # @param parent [::String]
870
+ # Required. The conversation model resource name. Format:
871
+ # `projects/<Project ID>/conversationModels/<Conversation Model ID>`
872
+ # @param page_size [::Integer]
873
+ # Optional. Maximum number of evaluations to return in a
874
+ # single page. By default 100 and at most 1000.
875
+ # @param page_token [::String]
876
+ # Optional. The next_page_token value returned from a previous list request.
877
+ #
878
+ # @yield [response, operation] Access the result along with the RPC operation
879
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation>]
880
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
881
+ #
882
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation>]
883
+ #
884
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
885
+ #
886
+ # @example Basic example
887
+ # require "google/cloud/dialogflow/v2"
888
+ #
889
+ # # Create a client object. The client can be reused for multiple calls.
890
+ # client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
891
+ #
892
+ # # Create a request. To set request fields, pass in keyword arguments.
893
+ # request = Google::Cloud::Dialogflow::V2::ListConversationModelEvaluationsRequest.new
894
+ #
895
+ # # Call the list_conversation_model_evaluations method.
896
+ # result = client.list_conversation_model_evaluations request
897
+ #
898
+ # # The returned object is of type Gapic::PagedEnumerable. You can
899
+ # # iterate over all elements by calling #each, and the enumerable
900
+ # # will lazily make API calls to fetch subsequent pages. Other
901
+ # # methods are also available for managing paging directly.
902
+ # result.each do |response|
903
+ # # Each element is of type ::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation.
904
+ # p response
905
+ # end
906
+ #
907
+ def list_conversation_model_evaluations request, options = nil
908
+ raise ::ArgumentError, "request must be provided" if request.nil?
909
+
910
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListConversationModelEvaluationsRequest
911
+
912
+ # Converts hash and nil to an options object
913
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
914
+
915
+ # Customize the options with defaults
916
+ metadata = @config.rpcs.list_conversation_model_evaluations.metadata.to_h
917
+
918
+ # Set x-goog-api-client and x-goog-user-project headers
919
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
920
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
921
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
922
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
923
+
924
+ header_params = {}
925
+ if request.parent
926
+ header_params["parent"] = request.parent
927
+ end
928
+
929
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
930
+ metadata[:"x-goog-request-params"] ||= request_params_header
931
+
932
+ options.apply_defaults timeout: @config.rpcs.list_conversation_model_evaluations.timeout,
933
+ metadata: metadata,
934
+ retry_policy: @config.rpcs.list_conversation_model_evaluations.retry_policy
935
+
936
+ options.apply_defaults timeout: @config.timeout,
937
+ metadata: @config.metadata,
938
+ retry_policy: @config.retry_policy
939
+
940
+ @conversation_models_stub.call_rpc :list_conversation_model_evaluations, request, options: options do |response, operation|
941
+ response = ::Gapic::PagedEnumerable.new @conversation_models_stub, :list_conversation_model_evaluations, request, response, operation, options
942
+ yield response, operation if block_given?
943
+ return response
944
+ end
945
+ rescue ::GRPC::BadStatus => e
946
+ raise ::Google::Cloud::Error.from_error(e)
947
+ end
948
+
949
+ ##
950
+ # Creates evaluation of a conversation model.
951
+ #
952
+ # @overload create_conversation_model_evaluation(request, options = nil)
953
+ # Pass arguments to `create_conversation_model_evaluation` via a request object, either of type
954
+ # {::Google::Cloud::Dialogflow::V2::CreateConversationModelEvaluationRequest} or an equivalent Hash.
955
+ #
956
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateConversationModelEvaluationRequest, ::Hash]
957
+ # A request object representing the call parameters. Required. To specify no
958
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
959
+ # @param options [::Gapic::CallOptions, ::Hash]
960
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
961
+ #
962
+ # @overload create_conversation_model_evaluation(parent: nil, conversation_model_evaluation: nil)
963
+ # Pass arguments to `create_conversation_model_evaluation` via keyword arguments. Note that at
964
+ # least one keyword argument is required. To specify no parameters, or to keep all
965
+ # the default parameter values, pass an empty Hash as a request object (see above).
966
+ #
967
+ # @param parent [::String]
968
+ # Required. The conversation model resource name. Format:
969
+ # `projects/<Project ID>/locations/<Location
970
+ # ID>/conversationModels/<Conversation Model ID>`
971
+ # @param conversation_model_evaluation [::Google::Cloud::Dialogflow::V2::ConversationModelEvaluation, ::Hash]
972
+ # Required. The conversation model evaluation to be created.
973
+ #
974
+ # @yield [response, operation] Access the result along with the RPC operation
975
+ # @yieldparam response [::Gapic::Operation]
976
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
977
+ #
978
+ # @return [::Gapic::Operation]
979
+ #
980
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
981
+ #
982
+ # @example Basic example
983
+ # require "google/cloud/dialogflow/v2"
984
+ #
985
+ # # Create a client object. The client can be reused for multiple calls.
986
+ # client = Google::Cloud::Dialogflow::V2::ConversationModels::Client.new
987
+ #
988
+ # # Create a request. To set request fields, pass in keyword arguments.
989
+ # request = Google::Cloud::Dialogflow::V2::CreateConversationModelEvaluationRequest.new
990
+ #
991
+ # # Call the create_conversation_model_evaluation method.
992
+ # result = client.create_conversation_model_evaluation request
993
+ #
994
+ # # The returned object is of type Gapic::Operation. You can use this
995
+ # # object to check the status of an operation, cancel it, or wait
996
+ # # for results. Here is how to block until completion:
997
+ # result.wait_until_done! timeout: 60
998
+ # if result.response?
999
+ # p result.response
1000
+ # else
1001
+ # puts "Error!"
1002
+ # end
1003
+ #
1004
+ def create_conversation_model_evaluation request, options = nil
1005
+ raise ::ArgumentError, "request must be provided" if request.nil?
1006
+
1007
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateConversationModelEvaluationRequest
1008
+
1009
+ # Converts hash and nil to an options object
1010
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1011
+
1012
+ # Customize the options with defaults
1013
+ metadata = @config.rpcs.create_conversation_model_evaluation.metadata.to_h
1014
+
1015
+ # Set x-goog-api-client and x-goog-user-project headers
1016
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1017
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1018
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
1019
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1020
+
1021
+ header_params = {}
1022
+ if request.parent
1023
+ header_params["parent"] = request.parent
1024
+ end
1025
+
1026
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1027
+ metadata[:"x-goog-request-params"] ||= request_params_header
1028
+
1029
+ options.apply_defaults timeout: @config.rpcs.create_conversation_model_evaluation.timeout,
1030
+ metadata: metadata,
1031
+ retry_policy: @config.rpcs.create_conversation_model_evaluation.retry_policy
1032
+
1033
+ options.apply_defaults timeout: @config.timeout,
1034
+ metadata: @config.metadata,
1035
+ retry_policy: @config.retry_policy
1036
+
1037
+ @conversation_models_stub.call_rpc :create_conversation_model_evaluation, request, options: options do |response, operation|
1038
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1039
+ yield response, operation if block_given?
1040
+ return response
1041
+ end
1042
+ rescue ::GRPC::BadStatus => e
1043
+ raise ::Google::Cloud::Error.from_error(e)
1044
+ end
1045
+
1046
+ ##
1047
+ # Configuration class for the ConversationModels API.
1048
+ #
1049
+ # This class represents the configuration for ConversationModels,
1050
+ # providing control over timeouts, retry behavior, logging, transport
1051
+ # parameters, and other low-level controls. Certain parameters can also be
1052
+ # applied individually to specific RPCs. See
1053
+ # {::Google::Cloud::Dialogflow::V2::ConversationModels::Client::Configuration::Rpcs}
1054
+ # for a list of RPCs that can be configured independently.
1055
+ #
1056
+ # Configuration can be applied globally to all clients, or to a single client
1057
+ # on construction.
1058
+ #
1059
+ # @example
1060
+ #
1061
+ # # Modify the global config, setting the timeout for
1062
+ # # create_conversation_model to 20 seconds,
1063
+ # # and all remaining timeouts to 10 seconds.
1064
+ # ::Google::Cloud::Dialogflow::V2::ConversationModels::Client.configure do |config|
1065
+ # config.timeout = 10.0
1066
+ # config.rpcs.create_conversation_model.timeout = 20.0
1067
+ # end
1068
+ #
1069
+ # # Apply the above configuration only to a new client.
1070
+ # client = ::Google::Cloud::Dialogflow::V2::ConversationModels::Client.new do |config|
1071
+ # config.timeout = 10.0
1072
+ # config.rpcs.create_conversation_model.timeout = 20.0
1073
+ # end
1074
+ #
1075
+ # @!attribute [rw] endpoint
1076
+ # The hostname or hostname:port of the service endpoint.
1077
+ # Defaults to `"dialogflow.googleapis.com"`.
1078
+ # @return [::String]
1079
+ # @!attribute [rw] credentials
1080
+ # Credentials to send with calls. You may provide any of the following types:
1081
+ # * (`String`) The path to a service account key file in JSON format
1082
+ # * (`Hash`) A service account key as a Hash
1083
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1084
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1085
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1086
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1087
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1088
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1089
+ # * (`nil`) indicating no credentials
1090
+ # @return [::Object]
1091
+ # @!attribute [rw] scope
1092
+ # The OAuth scopes
1093
+ # @return [::Array<::String>]
1094
+ # @!attribute [rw] lib_name
1095
+ # The library name as recorded in instrumentation and logging
1096
+ # @return [::String]
1097
+ # @!attribute [rw] lib_version
1098
+ # The library version as recorded in instrumentation and logging
1099
+ # @return [::String]
1100
+ # @!attribute [rw] channel_args
1101
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1102
+ # `GRPC::Core::Channel` object is provided as the credential.
1103
+ # @return [::Hash]
1104
+ # @!attribute [rw] interceptors
1105
+ # An array of interceptors that are run before calls are executed.
1106
+ # @return [::Array<::GRPC::ClientInterceptor>]
1107
+ # @!attribute [rw] timeout
1108
+ # The call timeout in seconds.
1109
+ # @return [::Numeric]
1110
+ # @!attribute [rw] metadata
1111
+ # Additional gRPC headers to be sent with the call.
1112
+ # @return [::Hash{::Symbol=>::String}]
1113
+ # @!attribute [rw] retry_policy
1114
+ # The retry policy. The value is a hash with the following keys:
1115
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1116
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1117
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1118
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1119
+ # trigger a retry.
1120
+ # @return [::Hash]
1121
+ # @!attribute [rw] quota_project
1122
+ # A separate project against which to charge quota.
1123
+ # @return [::String]
1124
+ #
1125
+ class Configuration
1126
+ extend ::Gapic::Config
1127
+
1128
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
1129
+ config_attr :credentials, nil do |value|
1130
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1131
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1132
+ allowed.any? { |klass| klass === value }
1133
+ end
1134
+ config_attr :scope, nil, ::String, ::Array, nil
1135
+ config_attr :lib_name, nil, ::String, nil
1136
+ config_attr :lib_version, nil, ::String, nil
1137
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1138
+ config_attr :interceptors, nil, ::Array, nil
1139
+ config_attr :timeout, nil, ::Numeric, nil
1140
+ config_attr :metadata, nil, ::Hash, nil
1141
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1142
+ config_attr :quota_project, nil, ::String, nil
1143
+
1144
+ # @private
1145
+ def initialize parent_config = nil
1146
+ @parent_config = parent_config unless parent_config.nil?
1147
+
1148
+ yield self if block_given?
1149
+ end
1150
+
1151
+ ##
1152
+ # Configurations for individual RPCs
1153
+ # @return [Rpcs]
1154
+ #
1155
+ def rpcs
1156
+ @rpcs ||= begin
1157
+ parent_rpcs = nil
1158
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1159
+ Rpcs.new parent_rpcs
1160
+ end
1161
+ end
1162
+
1163
+ ##
1164
+ # Configuration RPC class for the ConversationModels API.
1165
+ #
1166
+ # Includes fields providing the configuration for each RPC in this service.
1167
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1168
+ # the following configuration fields:
1169
+ #
1170
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1171
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1172
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1173
+ # include the following keys:
1174
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1175
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1176
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1177
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1178
+ # trigger a retry.
1179
+ #
1180
+ class Rpcs
1181
+ ##
1182
+ # RPC-specific configuration for `create_conversation_model`
1183
+ # @return [::Gapic::Config::Method]
1184
+ #
1185
+ attr_reader :create_conversation_model
1186
+ ##
1187
+ # RPC-specific configuration for `get_conversation_model`
1188
+ # @return [::Gapic::Config::Method]
1189
+ #
1190
+ attr_reader :get_conversation_model
1191
+ ##
1192
+ # RPC-specific configuration for `list_conversation_models`
1193
+ # @return [::Gapic::Config::Method]
1194
+ #
1195
+ attr_reader :list_conversation_models
1196
+ ##
1197
+ # RPC-specific configuration for `delete_conversation_model`
1198
+ # @return [::Gapic::Config::Method]
1199
+ #
1200
+ attr_reader :delete_conversation_model
1201
+ ##
1202
+ # RPC-specific configuration for `deploy_conversation_model`
1203
+ # @return [::Gapic::Config::Method]
1204
+ #
1205
+ attr_reader :deploy_conversation_model
1206
+ ##
1207
+ # RPC-specific configuration for `undeploy_conversation_model`
1208
+ # @return [::Gapic::Config::Method]
1209
+ #
1210
+ attr_reader :undeploy_conversation_model
1211
+ ##
1212
+ # RPC-specific configuration for `get_conversation_model_evaluation`
1213
+ # @return [::Gapic::Config::Method]
1214
+ #
1215
+ attr_reader :get_conversation_model_evaluation
1216
+ ##
1217
+ # RPC-specific configuration for `list_conversation_model_evaluations`
1218
+ # @return [::Gapic::Config::Method]
1219
+ #
1220
+ attr_reader :list_conversation_model_evaluations
1221
+ ##
1222
+ # RPC-specific configuration for `create_conversation_model_evaluation`
1223
+ # @return [::Gapic::Config::Method]
1224
+ #
1225
+ attr_reader :create_conversation_model_evaluation
1226
+
1227
+ # @private
1228
+ def initialize parent_rpcs = nil
1229
+ create_conversation_model_config = parent_rpcs.create_conversation_model if parent_rpcs.respond_to? :create_conversation_model
1230
+ @create_conversation_model = ::Gapic::Config::Method.new create_conversation_model_config
1231
+ get_conversation_model_config = parent_rpcs.get_conversation_model if parent_rpcs.respond_to? :get_conversation_model
1232
+ @get_conversation_model = ::Gapic::Config::Method.new get_conversation_model_config
1233
+ list_conversation_models_config = parent_rpcs.list_conversation_models if parent_rpcs.respond_to? :list_conversation_models
1234
+ @list_conversation_models = ::Gapic::Config::Method.new list_conversation_models_config
1235
+ delete_conversation_model_config = parent_rpcs.delete_conversation_model if parent_rpcs.respond_to? :delete_conversation_model
1236
+ @delete_conversation_model = ::Gapic::Config::Method.new delete_conversation_model_config
1237
+ deploy_conversation_model_config = parent_rpcs.deploy_conversation_model if parent_rpcs.respond_to? :deploy_conversation_model
1238
+ @deploy_conversation_model = ::Gapic::Config::Method.new deploy_conversation_model_config
1239
+ undeploy_conversation_model_config = parent_rpcs.undeploy_conversation_model if parent_rpcs.respond_to? :undeploy_conversation_model
1240
+ @undeploy_conversation_model = ::Gapic::Config::Method.new undeploy_conversation_model_config
1241
+ get_conversation_model_evaluation_config = parent_rpcs.get_conversation_model_evaluation if parent_rpcs.respond_to? :get_conversation_model_evaluation
1242
+ @get_conversation_model_evaluation = ::Gapic::Config::Method.new get_conversation_model_evaluation_config
1243
+ list_conversation_model_evaluations_config = parent_rpcs.list_conversation_model_evaluations if parent_rpcs.respond_to? :list_conversation_model_evaluations
1244
+ @list_conversation_model_evaluations = ::Gapic::Config::Method.new list_conversation_model_evaluations_config
1245
+ create_conversation_model_evaluation_config = parent_rpcs.create_conversation_model_evaluation if parent_rpcs.respond_to? :create_conversation_model_evaluation
1246
+ @create_conversation_model_evaluation = ::Gapic::Config::Method.new create_conversation_model_evaluation_config
1247
+
1248
+ yield self if block_given?
1249
+ end
1250
+ end
1251
+ end
1252
+ end
1253
+ end
1254
+ end
1255
+ end
1256
+ end
1257
+ end