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