google-cloud-dialogflow-v2 0.22.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +1078 -0
  4. data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +813 -0
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/service_stub.rb +652 -0
  6. data/lib/google/cloud/dialogflow/v2/agents/rest.rb +54 -0
  7. data/lib/google/cloud/dialogflow/v2/agents.rb +6 -0
  8. data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +463 -0
  9. data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +182 -0
  10. data/lib/google/cloud/dialogflow/v2/answer_records/rest.rb +54 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_records.rb +6 -0
  12. data/lib/google/cloud/dialogflow/v2/bindings_override.rb +102 -0
  13. data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +753 -0
  14. data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +536 -0
  15. data/lib/google/cloud/dialogflow/v2/contexts/rest.rb +53 -0
  16. data/lib/google/cloud/dialogflow/v2/contexts.rb +6 -0
  17. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +714 -0
  18. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +813 -0
  19. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub.rb +367 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest.rb +57 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_datasets.rb +6 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +1010 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +813 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +642 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_models/rest.rb +54 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_models.rb +6 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +868 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +813 -0
  29. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +518 -0
  30. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest.rb +55 -0
  31. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +6 -0
  32. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +819 -0
  33. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +450 -0
  34. data/lib/google/cloud/dialogflow/v2/conversations/rest.rb +54 -0
  35. data/lib/google/cloud/dialogflow/v2/conversations.rb +6 -0
  36. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +1013 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +813 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +631 -0
  39. data/lib/google/cloud/dialogflow/v2/documents/rest.rb +55 -0
  40. data/lib/google/cloud/dialogflow/v2/documents.rb +6 -0
  41. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +1178 -0
  42. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +813 -0
  43. data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +722 -0
  44. data/lib/google/cloud/dialogflow/v2/entity_types/rest.rb +54 -0
  45. data/lib/google/cloud/dialogflow/v2/entity_types.rb +6 -0
  46. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +779 -0
  47. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +448 -0
  48. data/lib/google/cloud/dialogflow/v2/environments/rest.rb +53 -0
  49. data/lib/google/cloud/dialogflow/v2/environments.rb +6 -0
  50. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +444 -0
  51. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +182 -0
  52. data/lib/google/cloud/dialogflow/v2/fulfillments/rest.rb +53 -0
  53. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +6 -0
  54. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +914 -0
  55. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +813 -0
  56. data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +532 -0
  57. data/lib/google/cloud/dialogflow/v2/intents/rest.rb +54 -0
  58. data/lib/google/cloud/dialogflow/v2/intents.rb +6 -0
  59. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +696 -0
  60. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +419 -0
  61. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest.rb +54 -0
  62. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +6 -0
  63. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +955 -0
  64. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +588 -0
  65. data/lib/google/cloud/dialogflow/v2/participants/rest.rb +53 -0
  66. data/lib/google/cloud/dialogflow/v2/participants.rb +6 -0
  67. data/lib/google/cloud/dialogflow/v2/rest.rb +54 -0
  68. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +703 -0
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +456 -0
  70. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest.rb +54 -0
  71. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +6 -0
  72. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +437 -0
  73. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +132 -0
  74. data/lib/google/cloud/dialogflow/v2/sessions/rest.rb +56 -0
  75. data/lib/google/cloud/dialogflow/v2/sessions.rb +6 -0
  76. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  77. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +686 -0
  78. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +382 -0
  79. data/lib/google/cloud/dialogflow/v2/versions/rest.rb +53 -0
  80. data/lib/google/cloud/dialogflow/v2/versions.rb +6 -0
  81. data/lib/google/cloud/dialogflow/v2.rb +5 -0
  82. metadata +66 -5
@@ -0,0 +1,714 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/dialogflow/v2/conversation_dataset_pb"
21
+ require "google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module V2
28
+ module ConversationDatasets
29
+ module Rest
30
+ ##
31
+ # REST client for the ConversationDatasets service.
32
+ #
33
+ # Conversation datasets.
34
+ #
35
+ # Conversation datasets contain raw conversation files and their
36
+ # customizable metadata that can be used for model training.
37
+ #
38
+ class Client
39
+ include Paths
40
+
41
+ # @private
42
+ attr_reader :conversation_datasets_stub
43
+
44
+ ##
45
+ # Configure the ConversationDatasets Client class.
46
+ #
47
+ # See {::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Client::Configuration}
48
+ # for a description of the configuration fields.
49
+ #
50
+ # @example
51
+ #
52
+ # # Modify the configuration for all ConversationDatasets clients
53
+ # ::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Client.configure do |config|
54
+ # config.timeout = 10.0
55
+ # end
56
+ #
57
+ # @yield [config] Configure the Client client.
58
+ # @yieldparam config [Client::Configuration]
59
+ #
60
+ # @return [Client::Configuration]
61
+ #
62
+ def self.configure
63
+ @configure ||= begin
64
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
65
+ parent_config = while namespace.any?
66
+ parent_name = namespace.join "::"
67
+ parent_const = const_get parent_name
68
+ break parent_const.configure if parent_const.respond_to? :configure
69
+ namespace.pop
70
+ end
71
+ default_config = Client::Configuration.new parent_config
72
+
73
+ default_config.timeout = 60.0
74
+ default_config.retry_policy = {
75
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
76
+ }
77
+
78
+ default_config
79
+ end
80
+ yield @configure if block_given?
81
+ @configure
82
+ end
83
+
84
+ ##
85
+ # Configure the ConversationDatasets Client instance.
86
+ #
87
+ # The configuration is set to the derived mode, meaning that values can be changed,
88
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
89
+ # should be made on {Client.configure}.
90
+ #
91
+ # See {::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Client::Configuration}
92
+ # for a description of the configuration fields.
93
+ #
94
+ # @yield [config] Configure the Client client.
95
+ # @yieldparam config [Client::Configuration]
96
+ #
97
+ # @return [Client::Configuration]
98
+ #
99
+ def configure
100
+ yield @config if block_given?
101
+ @config
102
+ end
103
+
104
+ ##
105
+ # Create a new ConversationDatasets REST client object.
106
+ #
107
+ # @example
108
+ #
109
+ # # Create a client using the default configuration
110
+ # client = ::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Client.new
111
+ #
112
+ # # Create a client using a custom configuration
113
+ # client = ::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Client.new do |config|
114
+ # config.timeout = 10.0
115
+ # end
116
+ #
117
+ # @yield [config] Configure the ConversationDatasets client.
118
+ # @yieldparam config [Client::Configuration]
119
+ #
120
+ def initialize
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
+
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @operations_client = ::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Operations.new do |config|
143
+ config.credentials = credentials
144
+ config.quota_project = @quota_project_id
145
+ config.endpoint = @config.endpoint
146
+ end
147
+
148
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
149
+ config.credentials = credentials
150
+ config.quota_project = @quota_project_id
151
+ config.endpoint = @config.endpoint
152
+ config.bindings_override = @config.bindings_override
153
+ end
154
+
155
+ @conversation_datasets_stub = ::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
156
+ end
157
+
158
+ ##
159
+ # Get the associated client for long-running operations.
160
+ #
161
+ # @return [::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Operations]
162
+ #
163
+ attr_reader :operations_client
164
+
165
+ ##
166
+ # Get the associated client for mix-in of the Locations.
167
+ #
168
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
169
+ #
170
+ attr_reader :location_client
171
+
172
+ # Service calls
173
+
174
+ ##
175
+ # Creates a new conversation dataset.
176
+ #
177
+ # This method is a [long-running
178
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
179
+ # The returned `Operation` type has the following method-specific fields:
180
+ #
181
+ # - `metadata`:
182
+ # {::Google::Cloud::Dialogflow::V2::CreateConversationDatasetOperationMetadata CreateConversationDatasetOperationMetadata}
183
+ # - `response`:
184
+ # {::Google::Cloud::Dialogflow::V2::ConversationDataset ConversationDataset}
185
+ #
186
+ # @overload create_conversation_dataset(request, options = nil)
187
+ # Pass arguments to `create_conversation_dataset` via a request object, either of type
188
+ # {::Google::Cloud::Dialogflow::V2::CreateConversationDatasetRequest} or an equivalent Hash.
189
+ #
190
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateConversationDatasetRequest, ::Hash]
191
+ # A request object representing the call parameters. Required. To specify no
192
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
193
+ # @param options [::Gapic::CallOptions, ::Hash]
194
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
195
+ #
196
+ # @overload create_conversation_dataset(parent: nil, conversation_dataset: nil)
197
+ # Pass arguments to `create_conversation_dataset` via keyword arguments. Note that at
198
+ # least one keyword argument is required. To specify no parameters, or to keep all
199
+ # the default parameter values, pass an empty Hash as a request object (see above).
200
+ #
201
+ # @param parent [::String]
202
+ # Required. The project to create conversation dataset for. Format:
203
+ # `projects/<Project ID>/locations/<Location ID>`
204
+ # @param conversation_dataset [::Google::Cloud::Dialogflow::V2::ConversationDataset, ::Hash]
205
+ # Required. The conversation dataset to create.
206
+ # @yield [result, operation] Access the result along with the TransportOperation object
207
+ # @yieldparam result [::Gapic::Operation]
208
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
209
+ #
210
+ # @return [::Gapic::Operation]
211
+ #
212
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
213
+ def create_conversation_dataset request, options = nil
214
+ raise ::ArgumentError, "request must be provided" if request.nil?
215
+
216
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateConversationDatasetRequest
217
+
218
+ # Converts hash and nil to an options object
219
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
220
+
221
+ # Customize the options with defaults
222
+ call_metadata = @config.rpcs.create_conversation_dataset.metadata.to_h
223
+
224
+ # Set x-goog-api-client and x-goog-user-project headers
225
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
226
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
227
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
228
+ transports_version_send: [:rest]
229
+
230
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
231
+
232
+ options.apply_defaults timeout: @config.rpcs.create_conversation_dataset.timeout,
233
+ metadata: call_metadata,
234
+ retry_policy: @config.rpcs.create_conversation_dataset.retry_policy
235
+
236
+ options.apply_defaults timeout: @config.timeout,
237
+ metadata: @config.metadata,
238
+ retry_policy: @config.retry_policy
239
+
240
+ @conversation_datasets_stub.create_conversation_dataset request, options do |result, operation|
241
+ result = ::Gapic::Operation.new result, @operations_client, options: options
242
+ yield result, operation if block_given?
243
+ return result
244
+ end
245
+ rescue ::Gapic::Rest::Error => e
246
+ raise ::Google::Cloud::Error.from_error(e)
247
+ end
248
+
249
+ ##
250
+ # Retrieves the specified conversation dataset.
251
+ #
252
+ # @overload get_conversation_dataset(request, options = nil)
253
+ # Pass arguments to `get_conversation_dataset` via a request object, either of type
254
+ # {::Google::Cloud::Dialogflow::V2::GetConversationDatasetRequest} or an equivalent Hash.
255
+ #
256
+ # @param request [::Google::Cloud::Dialogflow::V2::GetConversationDatasetRequest, ::Hash]
257
+ # A request object representing the call parameters. Required. To specify no
258
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
259
+ # @param options [::Gapic::CallOptions, ::Hash]
260
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
261
+ #
262
+ # @overload get_conversation_dataset(name: nil)
263
+ # Pass arguments to `get_conversation_dataset` via keyword arguments. Note that at
264
+ # least one keyword argument is required. To specify no parameters, or to keep all
265
+ # the default parameter values, pass an empty Hash as a request object (see above).
266
+ #
267
+ # @param name [::String]
268
+ # Required. The conversation dataset to retrieve. Format:
269
+ # `projects/<Project ID>/locations/<Location
270
+ # ID>/conversationDatasets/<Conversation Dataset ID>`
271
+ # @yield [result, operation] Access the result along with the TransportOperation object
272
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::ConversationDataset]
273
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
274
+ #
275
+ # @return [::Google::Cloud::Dialogflow::V2::ConversationDataset]
276
+ #
277
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
278
+ def get_conversation_dataset request, options = nil
279
+ raise ::ArgumentError, "request must be provided" if request.nil?
280
+
281
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetConversationDatasetRequest
282
+
283
+ # Converts hash and nil to an options object
284
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
285
+
286
+ # Customize the options with defaults
287
+ call_metadata = @config.rpcs.get_conversation_dataset.metadata.to_h
288
+
289
+ # Set x-goog-api-client and x-goog-user-project headers
290
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
291
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
292
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
293
+ transports_version_send: [:rest]
294
+
295
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
296
+
297
+ options.apply_defaults timeout: @config.rpcs.get_conversation_dataset.timeout,
298
+ metadata: call_metadata,
299
+ retry_policy: @config.rpcs.get_conversation_dataset.retry_policy
300
+
301
+ options.apply_defaults timeout: @config.timeout,
302
+ metadata: @config.metadata,
303
+ retry_policy: @config.retry_policy
304
+
305
+ @conversation_datasets_stub.get_conversation_dataset request, options do |result, operation|
306
+ yield result, operation if block_given?
307
+ return result
308
+ end
309
+ rescue ::Gapic::Rest::Error => e
310
+ raise ::Google::Cloud::Error.from_error(e)
311
+ end
312
+
313
+ ##
314
+ # Returns the list of all conversation datasets in the specified
315
+ # project and location.
316
+ #
317
+ # @overload list_conversation_datasets(request, options = nil)
318
+ # Pass arguments to `list_conversation_datasets` via a request object, either of type
319
+ # {::Google::Cloud::Dialogflow::V2::ListConversationDatasetsRequest} or an equivalent Hash.
320
+ #
321
+ # @param request [::Google::Cloud::Dialogflow::V2::ListConversationDatasetsRequest, ::Hash]
322
+ # A request object representing the call parameters. Required. To specify no
323
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
324
+ # @param options [::Gapic::CallOptions, ::Hash]
325
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
326
+ #
327
+ # @overload list_conversation_datasets(parent: nil, page_size: nil, page_token: nil)
328
+ # Pass arguments to `list_conversation_datasets` via keyword arguments. Note that at
329
+ # least one keyword argument is required. To specify no parameters, or to keep all
330
+ # the default parameter values, pass an empty Hash as a request object (see above).
331
+ #
332
+ # @param parent [::String]
333
+ # Required. The project and location name to list all conversation datasets
334
+ # for. Format: `projects/<Project ID>/locations/<Location ID>`
335
+ # @param page_size [::Integer]
336
+ # Optional. Maximum number of conversation datasets to return in a single
337
+ # page. By default 100 and at most 1000.
338
+ # @param page_token [::String]
339
+ # Optional. The next_page_token value returned from a previous list request.
340
+ # @yield [result, operation] Access the result along with the TransportOperation object
341
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationDataset>]
342
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
343
+ #
344
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::ConversationDataset>]
345
+ #
346
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
347
+ def list_conversation_datasets request, options = nil
348
+ raise ::ArgumentError, "request must be provided" if request.nil?
349
+
350
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListConversationDatasetsRequest
351
+
352
+ # Converts hash and nil to an options object
353
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
354
+
355
+ # Customize the options with defaults
356
+ call_metadata = @config.rpcs.list_conversation_datasets.metadata.to_h
357
+
358
+ # Set x-goog-api-client and x-goog-user-project headers
359
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
360
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
361
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
362
+ transports_version_send: [:rest]
363
+
364
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
365
+
366
+ options.apply_defaults timeout: @config.rpcs.list_conversation_datasets.timeout,
367
+ metadata: call_metadata,
368
+ retry_policy: @config.rpcs.list_conversation_datasets.retry_policy
369
+
370
+ options.apply_defaults timeout: @config.timeout,
371
+ metadata: @config.metadata,
372
+ retry_policy: @config.retry_policy
373
+
374
+ @conversation_datasets_stub.list_conversation_datasets request, options do |result, operation|
375
+ result = ::Gapic::Rest::PagedEnumerable.new @conversation_datasets_stub, :list_conversation_datasets, "conversation_datasets", request, result, options
376
+ yield result, operation if block_given?
377
+ return result
378
+ end
379
+ rescue ::Gapic::Rest::Error => e
380
+ raise ::Google::Cloud::Error.from_error(e)
381
+ end
382
+
383
+ ##
384
+ # Deletes the specified conversation dataset.
385
+ #
386
+ # This method is a [long-running
387
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
388
+ # The returned `Operation` type has the following method-specific fields:
389
+ #
390
+ # - `metadata`:
391
+ # {::Google::Cloud::Dialogflow::V2::DeleteConversationDatasetOperationMetadata DeleteConversationDatasetOperationMetadata}
392
+ # - `response`: An [Empty
393
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
394
+ #
395
+ # @overload delete_conversation_dataset(request, options = nil)
396
+ # Pass arguments to `delete_conversation_dataset` via a request object, either of type
397
+ # {::Google::Cloud::Dialogflow::V2::DeleteConversationDatasetRequest} or an equivalent Hash.
398
+ #
399
+ # @param request [::Google::Cloud::Dialogflow::V2::DeleteConversationDatasetRequest, ::Hash]
400
+ # A request object representing the call parameters. Required. To specify no
401
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
402
+ # @param options [::Gapic::CallOptions, ::Hash]
403
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
404
+ #
405
+ # @overload delete_conversation_dataset(name: nil)
406
+ # Pass arguments to `delete_conversation_dataset` via keyword arguments. Note that at
407
+ # least one keyword argument is required. To specify no parameters, or to keep all
408
+ # the default parameter values, pass an empty Hash as a request object (see above).
409
+ #
410
+ # @param name [::String]
411
+ # Required. The conversation dataset to delete. Format:
412
+ # `projects/<Project ID>/locations/<Location
413
+ # ID>/conversationDatasets/<Conversation Dataset ID>`
414
+ # @yield [result, operation] Access the result along with the TransportOperation object
415
+ # @yieldparam result [::Gapic::Operation]
416
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
417
+ #
418
+ # @return [::Gapic::Operation]
419
+ #
420
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
421
+ def delete_conversation_dataset request, options = nil
422
+ raise ::ArgumentError, "request must be provided" if request.nil?
423
+
424
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeleteConversationDatasetRequest
425
+
426
+ # Converts hash and nil to an options object
427
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
428
+
429
+ # Customize the options with defaults
430
+ call_metadata = @config.rpcs.delete_conversation_dataset.metadata.to_h
431
+
432
+ # Set x-goog-api-client and x-goog-user-project headers
433
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
434
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
435
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
436
+ transports_version_send: [:rest]
437
+
438
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
439
+
440
+ options.apply_defaults timeout: @config.rpcs.delete_conversation_dataset.timeout,
441
+ metadata: call_metadata,
442
+ retry_policy: @config.rpcs.delete_conversation_dataset.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.delete_conversation_dataset request, options do |result, operation|
449
+ result = ::Gapic::Operation.new result, @operations_client, options: options
450
+ yield result, operation if block_given?
451
+ return result
452
+ end
453
+ rescue ::Gapic::Rest::Error => e
454
+ raise ::Google::Cloud::Error.from_error(e)
455
+ end
456
+
457
+ ##
458
+ # Import data into the specified conversation dataset. Note that it
459
+ # is not allowed to import data to a conversation dataset that
460
+ # already has data in it.
461
+ #
462
+ # This method is a [long-running
463
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
464
+ # The returned `Operation` type has the following method-specific fields:
465
+ #
466
+ # - `metadata`:
467
+ # {::Google::Cloud::Dialogflow::V2::ImportConversationDataOperationMetadata ImportConversationDataOperationMetadata}
468
+ # - `response`:
469
+ # {::Google::Cloud::Dialogflow::V2::ImportConversationDataOperationResponse ImportConversationDataOperationResponse}
470
+ #
471
+ # @overload import_conversation_data(request, options = nil)
472
+ # Pass arguments to `import_conversation_data` via a request object, either of type
473
+ # {::Google::Cloud::Dialogflow::V2::ImportConversationDataRequest} or an equivalent Hash.
474
+ #
475
+ # @param request [::Google::Cloud::Dialogflow::V2::ImportConversationDataRequest, ::Hash]
476
+ # A request object representing the call parameters. Required. To specify no
477
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
478
+ # @param options [::Gapic::CallOptions, ::Hash]
479
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
480
+ #
481
+ # @overload import_conversation_data(name: nil, input_config: nil)
482
+ # Pass arguments to `import_conversation_data` via keyword arguments. Note that at
483
+ # least one keyword argument is required. To specify no parameters, or to keep all
484
+ # the default parameter values, pass an empty Hash as a request object (see above).
485
+ #
486
+ # @param name [::String]
487
+ # Required. Dataset resource name. Format:
488
+ # `projects/<Project ID>/locations/<Location
489
+ # ID>/conversationDatasets/<Conversation Dataset ID>`
490
+ # @param input_config [::Google::Cloud::Dialogflow::V2::InputConfig, ::Hash]
491
+ # Required. Configuration describing where to import data from.
492
+ # @yield [result, operation] Access the result along with the TransportOperation object
493
+ # @yieldparam result [::Gapic::Operation]
494
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
495
+ #
496
+ # @return [::Gapic::Operation]
497
+ #
498
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
499
+ def import_conversation_data request, options = nil
500
+ raise ::ArgumentError, "request must be provided" if request.nil?
501
+
502
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ImportConversationDataRequest
503
+
504
+ # Converts hash and nil to an options object
505
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
506
+
507
+ # Customize the options with defaults
508
+ call_metadata = @config.rpcs.import_conversation_data.metadata.to_h
509
+
510
+ # Set x-goog-api-client and x-goog-user-project headers
511
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
512
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
513
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
514
+ transports_version_send: [:rest]
515
+
516
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
517
+
518
+ options.apply_defaults timeout: @config.rpcs.import_conversation_data.timeout,
519
+ metadata: call_metadata,
520
+ retry_policy: @config.rpcs.import_conversation_data.retry_policy
521
+
522
+ options.apply_defaults timeout: @config.timeout,
523
+ metadata: @config.metadata,
524
+ retry_policy: @config.retry_policy
525
+
526
+ @conversation_datasets_stub.import_conversation_data request, options do |result, operation|
527
+ result = ::Gapic::Operation.new result, @operations_client, options: options
528
+ yield result, operation if block_given?
529
+ return result
530
+ end
531
+ rescue ::Gapic::Rest::Error => e
532
+ raise ::Google::Cloud::Error.from_error(e)
533
+ end
534
+
535
+ ##
536
+ # Configuration class for the ConversationDatasets REST API.
537
+ #
538
+ # This class represents the configuration for ConversationDatasets REST,
539
+ # providing control over timeouts, retry behavior, logging, transport
540
+ # parameters, and other low-level controls. Certain parameters can also be
541
+ # applied individually to specific RPCs. See
542
+ # {::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Client::Configuration::Rpcs}
543
+ # for a list of RPCs that can be configured independently.
544
+ #
545
+ # Configuration can be applied globally to all clients, or to a single client
546
+ # on construction.
547
+ #
548
+ # @example
549
+ #
550
+ # # Modify the global config, setting the timeout for
551
+ # # create_conversation_dataset to 20 seconds,
552
+ # # and all remaining timeouts to 10 seconds.
553
+ # ::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Client.configure do |config|
554
+ # config.timeout = 10.0
555
+ # config.rpcs.create_conversation_dataset.timeout = 20.0
556
+ # end
557
+ #
558
+ # # Apply the above configuration only to a new client.
559
+ # client = ::Google::Cloud::Dialogflow::V2::ConversationDatasets::Rest::Client.new do |config|
560
+ # config.timeout = 10.0
561
+ # config.rpcs.create_conversation_dataset.timeout = 20.0
562
+ # end
563
+ #
564
+ # @!attribute [rw] endpoint
565
+ # The hostname or hostname:port of the service endpoint.
566
+ # Defaults to `"dialogflow.googleapis.com"`.
567
+ # @return [::String]
568
+ # @!attribute [rw] credentials
569
+ # Credentials to send with calls. You may provide any of the following types:
570
+ # * (`String`) The path to a service account key file in JSON format
571
+ # * (`Hash`) A service account key as a Hash
572
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
573
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
574
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
575
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
576
+ # * (`nil`) indicating no credentials
577
+ # @return [::Object]
578
+ # @!attribute [rw] scope
579
+ # The OAuth scopes
580
+ # @return [::Array<::String>]
581
+ # @!attribute [rw] lib_name
582
+ # The library name as recorded in instrumentation and logging
583
+ # @return [::String]
584
+ # @!attribute [rw] lib_version
585
+ # The library version as recorded in instrumentation and logging
586
+ # @return [::String]
587
+ # @!attribute [rw] timeout
588
+ # The call timeout in seconds.
589
+ # @return [::Numeric]
590
+ # @!attribute [rw] metadata
591
+ # Additional headers to be sent with the call.
592
+ # @return [::Hash{::Symbol=>::String}]
593
+ # @!attribute [rw] retry_policy
594
+ # The retry policy. The value is a hash with the following keys:
595
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
596
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
597
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
598
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
599
+ # trigger a retry.
600
+ # @return [::Hash]
601
+ # @!attribute [rw] quota_project
602
+ # A separate project against which to charge quota.
603
+ # @return [::String]
604
+ #
605
+ class Configuration
606
+ extend ::Gapic::Config
607
+
608
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
609
+ config_attr :credentials, nil do |value|
610
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
611
+ allowed.any? { |klass| klass === value }
612
+ end
613
+ config_attr :scope, nil, ::String, ::Array, nil
614
+ config_attr :lib_name, nil, ::String, nil
615
+ config_attr :lib_version, nil, ::String, nil
616
+ config_attr :timeout, nil, ::Numeric, nil
617
+ config_attr :metadata, nil, ::Hash, nil
618
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
619
+ config_attr :quota_project, nil, ::String, nil
620
+
621
+ # @private
622
+ # Overrides for http bindings for the RPCs of this service
623
+ # are only used when this service is used as mixin, and only
624
+ # by the host service.
625
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
626
+ config_attr :bindings_override, {}, ::Hash, nil
627
+
628
+ # @private
629
+ def initialize parent_config = nil
630
+ @parent_config = parent_config unless parent_config.nil?
631
+
632
+ yield self if block_given?
633
+ end
634
+
635
+ ##
636
+ # Configurations for individual RPCs
637
+ # @return [Rpcs]
638
+ #
639
+ def rpcs
640
+ @rpcs ||= begin
641
+ parent_rpcs = nil
642
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
643
+ Rpcs.new parent_rpcs
644
+ end
645
+ end
646
+
647
+ ##
648
+ # Configuration RPC class for the ConversationDatasets API.
649
+ #
650
+ # Includes fields providing the configuration for each RPC in this service.
651
+ # Each configuration object is of type `Gapic::Config::Method` and includes
652
+ # the following configuration fields:
653
+ #
654
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
655
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
656
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
657
+ # include the following keys:
658
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
659
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
660
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
661
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
662
+ # trigger a retry.
663
+ #
664
+ class Rpcs
665
+ ##
666
+ # RPC-specific configuration for `create_conversation_dataset`
667
+ # @return [::Gapic::Config::Method]
668
+ #
669
+ attr_reader :create_conversation_dataset
670
+ ##
671
+ # RPC-specific configuration for `get_conversation_dataset`
672
+ # @return [::Gapic::Config::Method]
673
+ #
674
+ attr_reader :get_conversation_dataset
675
+ ##
676
+ # RPC-specific configuration for `list_conversation_datasets`
677
+ # @return [::Gapic::Config::Method]
678
+ #
679
+ attr_reader :list_conversation_datasets
680
+ ##
681
+ # RPC-specific configuration for `delete_conversation_dataset`
682
+ # @return [::Gapic::Config::Method]
683
+ #
684
+ attr_reader :delete_conversation_dataset
685
+ ##
686
+ # RPC-specific configuration for `import_conversation_data`
687
+ # @return [::Gapic::Config::Method]
688
+ #
689
+ attr_reader :import_conversation_data
690
+
691
+ # @private
692
+ def initialize parent_rpcs = nil
693
+ create_conversation_dataset_config = parent_rpcs.create_conversation_dataset if parent_rpcs.respond_to? :create_conversation_dataset
694
+ @create_conversation_dataset = ::Gapic::Config::Method.new create_conversation_dataset_config
695
+ get_conversation_dataset_config = parent_rpcs.get_conversation_dataset if parent_rpcs.respond_to? :get_conversation_dataset
696
+ @get_conversation_dataset = ::Gapic::Config::Method.new get_conversation_dataset_config
697
+ list_conversation_datasets_config = parent_rpcs.list_conversation_datasets if parent_rpcs.respond_to? :list_conversation_datasets
698
+ @list_conversation_datasets = ::Gapic::Config::Method.new list_conversation_datasets_config
699
+ delete_conversation_dataset_config = parent_rpcs.delete_conversation_dataset if parent_rpcs.respond_to? :delete_conversation_dataset
700
+ @delete_conversation_dataset = ::Gapic::Config::Method.new delete_conversation_dataset_config
701
+ import_conversation_data_config = parent_rpcs.import_conversation_data if parent_rpcs.respond_to? :import_conversation_data
702
+ @import_conversation_data = ::Gapic::Config::Method.new import_conversation_data_config
703
+
704
+ yield self if block_given?
705
+ end
706
+ end
707
+ end
708
+ end
709
+ end
710
+ end
711
+ end
712
+ end
713
+ end
714
+ end