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,686 @@
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/version_pb"
21
+ require "google/cloud/dialogflow/v2/versions/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module V2
28
+ module Versions
29
+ module Rest
30
+ ##
31
+ # REST client for the Versions service.
32
+ #
33
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Version Versions}.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :versions_stub
40
+
41
+ ##
42
+ # Configure the Versions Client class.
43
+ #
44
+ # See {::Google::Cloud::Dialogflow::V2::Versions::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all Versions clients
50
+ # ::Google::Cloud::Dialogflow::V2::Versions::Rest::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 Versions 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::Versions::Rest::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 Versions REST client object.
103
+ #
104
+ # @example
105
+ #
106
+ # # Create a client using the default configuration
107
+ # client = ::Google::Cloud::Dialogflow::V2::Versions::Rest::Client.new
108
+ #
109
+ # # Create a client using a custom configuration
110
+ # client = ::Google::Cloud::Dialogflow::V2::Versions::Rest::Client.new do |config|
111
+ # config.timeout = 10.0
112
+ # end
113
+ #
114
+ # @yield [config] Configure the Versions client.
115
+ # @yieldparam config [Client::Configuration]
116
+ #
117
+ def initialize
118
+ # Create the configuration object
119
+ @config = Configuration.new Client.configure
120
+
121
+ # Yield the configuration if needed
122
+ yield @config if block_given?
123
+
124
+ # Create credentials
125
+ credentials = @config.credentials
126
+ # Use self-signed JWT if the endpoint is unchanged from default,
127
+ # but only if the default endpoint does not have a region prefix.
128
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
129
+ !@config.endpoint.split(".").first.include?("-")
130
+ credentials ||= Credentials.default scope: @config.scope,
131
+ enable_self_signed_jwt: enable_self_signed_jwt
132
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
133
+ credentials = Credentials.new credentials, scope: @config.scope
134
+ end
135
+
136
+ @quota_project_id = @config.quota_project
137
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
138
+
139
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
140
+ config.credentials = credentials
141
+ config.quota_project = @quota_project_id
142
+ config.endpoint = @config.endpoint
143
+ config.bindings_override = @config.bindings_override
144
+ end
145
+
146
+ @versions_stub = ::Google::Cloud::Dialogflow::V2::Versions::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
147
+ end
148
+
149
+ ##
150
+ # Get the associated client for mix-in of the Locations.
151
+ #
152
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
153
+ #
154
+ attr_reader :location_client
155
+
156
+ # Service calls
157
+
158
+ ##
159
+ # Returns the list of all versions of the specified agent.
160
+ #
161
+ # @overload list_versions(request, options = nil)
162
+ # Pass arguments to `list_versions` via a request object, either of type
163
+ # {::Google::Cloud::Dialogflow::V2::ListVersionsRequest} or an equivalent Hash.
164
+ #
165
+ # @param request [::Google::Cloud::Dialogflow::V2::ListVersionsRequest, ::Hash]
166
+ # A request object representing the call parameters. Required. To specify no
167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
168
+ # @param options [::Gapic::CallOptions, ::Hash]
169
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
170
+ #
171
+ # @overload list_versions(parent: nil, page_size: nil, page_token: nil)
172
+ # Pass arguments to `list_versions` via keyword arguments. Note that at
173
+ # least one keyword argument is required. To specify no parameters, or to keep all
174
+ # the default parameter values, pass an empty Hash as a request object (see above).
175
+ #
176
+ # @param parent [::String]
177
+ # Required. The agent to list all versions from.
178
+ # Supported formats:
179
+ #
180
+ # - `projects/<Project ID>/agent`
181
+ # - `projects/<Project ID>/locations/<Location ID>/agent`
182
+ # @param page_size [::Integer]
183
+ # Optional. The maximum number of items to return in a single page. By
184
+ # default 100 and at most 1000.
185
+ # @param page_token [::String]
186
+ # Optional. The next_page_token value returned from a previous list request.
187
+ # @yield [result, operation] Access the result along with the TransportOperation object
188
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Version>]
189
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
190
+ #
191
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Version>]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
194
+ def list_versions request, options = nil
195
+ raise ::ArgumentError, "request must be provided" if request.nil?
196
+
197
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListVersionsRequest
198
+
199
+ # Converts hash and nil to an options object
200
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
201
+
202
+ # Customize the options with defaults
203
+ call_metadata = @config.rpcs.list_versions.metadata.to_h
204
+
205
+ # Set x-goog-api-client and x-goog-user-project headers
206
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
207
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
208
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
209
+ transports_version_send: [:rest]
210
+
211
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
212
+
213
+ options.apply_defaults timeout: @config.rpcs.list_versions.timeout,
214
+ metadata: call_metadata,
215
+ retry_policy: @config.rpcs.list_versions.retry_policy
216
+
217
+ options.apply_defaults timeout: @config.timeout,
218
+ metadata: @config.metadata,
219
+ retry_policy: @config.retry_policy
220
+
221
+ @versions_stub.list_versions request, options do |result, operation|
222
+ result = ::Gapic::Rest::PagedEnumerable.new @versions_stub, :list_versions, "versions", request, result, options
223
+ yield result, operation if block_given?
224
+ return result
225
+ end
226
+ rescue ::Gapic::Rest::Error => e
227
+ raise ::Google::Cloud::Error.from_error(e)
228
+ end
229
+
230
+ ##
231
+ # Retrieves the specified agent version.
232
+ #
233
+ # @overload get_version(request, options = nil)
234
+ # Pass arguments to `get_version` via a request object, either of type
235
+ # {::Google::Cloud::Dialogflow::V2::GetVersionRequest} or an equivalent Hash.
236
+ #
237
+ # @param request [::Google::Cloud::Dialogflow::V2::GetVersionRequest, ::Hash]
238
+ # A request object representing the call parameters. Required. To specify no
239
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
240
+ # @param options [::Gapic::CallOptions, ::Hash]
241
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
242
+ #
243
+ # @overload get_version(name: nil)
244
+ # Pass arguments to `get_version` via keyword arguments. Note that at
245
+ # least one keyword argument is required. To specify no parameters, or to keep all
246
+ # the default parameter values, pass an empty Hash as a request object (see above).
247
+ #
248
+ # @param name [::String]
249
+ # Required. The name of the version.
250
+ # Supported formats:
251
+ #
252
+ # - `projects/<Project ID>/agent/versions/<Version ID>`
253
+ # - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
254
+ # ID>`
255
+ # @yield [result, operation] Access the result along with the TransportOperation object
256
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Version]
257
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
258
+ #
259
+ # @return [::Google::Cloud::Dialogflow::V2::Version]
260
+ #
261
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
262
+ def get_version request, options = nil
263
+ raise ::ArgumentError, "request must be provided" if request.nil?
264
+
265
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetVersionRequest
266
+
267
+ # Converts hash and nil to an options object
268
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
269
+
270
+ # Customize the options with defaults
271
+ call_metadata = @config.rpcs.get_version.metadata.to_h
272
+
273
+ # Set x-goog-api-client and x-goog-user-project headers
274
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
275
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
276
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
277
+ transports_version_send: [:rest]
278
+
279
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
280
+
281
+ options.apply_defaults timeout: @config.rpcs.get_version.timeout,
282
+ metadata: call_metadata,
283
+ retry_policy: @config.rpcs.get_version.retry_policy
284
+
285
+ options.apply_defaults timeout: @config.timeout,
286
+ metadata: @config.metadata,
287
+ retry_policy: @config.retry_policy
288
+
289
+ @versions_stub.get_version request, options do |result, operation|
290
+ yield result, operation if block_given?
291
+ return result
292
+ end
293
+ rescue ::Gapic::Rest::Error => e
294
+ raise ::Google::Cloud::Error.from_error(e)
295
+ end
296
+
297
+ ##
298
+ # Creates an agent version.
299
+ #
300
+ # The new version points to the agent instance in the "default" environment.
301
+ #
302
+ # @overload create_version(request, options = nil)
303
+ # Pass arguments to `create_version` via a request object, either of type
304
+ # {::Google::Cloud::Dialogflow::V2::CreateVersionRequest} or an equivalent Hash.
305
+ #
306
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateVersionRequest, ::Hash]
307
+ # A request object representing the call parameters. Required. To specify no
308
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
309
+ # @param options [::Gapic::CallOptions, ::Hash]
310
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
311
+ #
312
+ # @overload create_version(parent: nil, version: nil)
313
+ # Pass arguments to `create_version` via keyword arguments. Note that at
314
+ # least one keyword argument is required. To specify no parameters, or to keep all
315
+ # the default parameter values, pass an empty Hash as a request object (see above).
316
+ #
317
+ # @param parent [::String]
318
+ # Required. The agent to create a version for.
319
+ # Supported formats:
320
+ #
321
+ # - `projects/<Project ID>/agent`
322
+ # - `projects/<Project ID>/locations/<Location ID>/agent`
323
+ # @param version [::Google::Cloud::Dialogflow::V2::Version, ::Hash]
324
+ # Required. The version to create.
325
+ # @yield [result, operation] Access the result along with the TransportOperation object
326
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Version]
327
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
328
+ #
329
+ # @return [::Google::Cloud::Dialogflow::V2::Version]
330
+ #
331
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
332
+ def create_version request, options = nil
333
+ raise ::ArgumentError, "request must be provided" if request.nil?
334
+
335
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateVersionRequest
336
+
337
+ # Converts hash and nil to an options object
338
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
339
+
340
+ # Customize the options with defaults
341
+ call_metadata = @config.rpcs.create_version.metadata.to_h
342
+
343
+ # Set x-goog-api-client and x-goog-user-project headers
344
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
345
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
346
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
347
+ transports_version_send: [:rest]
348
+
349
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
350
+
351
+ options.apply_defaults timeout: @config.rpcs.create_version.timeout,
352
+ metadata: call_metadata,
353
+ retry_policy: @config.rpcs.create_version.retry_policy
354
+
355
+ options.apply_defaults timeout: @config.timeout,
356
+ metadata: @config.metadata,
357
+ retry_policy: @config.retry_policy
358
+
359
+ @versions_stub.create_version request, options do |result, operation|
360
+ yield result, operation if block_given?
361
+ return result
362
+ end
363
+ rescue ::Gapic::Rest::Error => e
364
+ raise ::Google::Cloud::Error.from_error(e)
365
+ end
366
+
367
+ ##
368
+ # Updates the specified agent version.
369
+ #
370
+ # Note that this method does not allow you to update the state of the agent
371
+ # the given version points to. It allows you to update only mutable
372
+ # properties of the version resource.
373
+ #
374
+ # @overload update_version(request, options = nil)
375
+ # Pass arguments to `update_version` via a request object, either of type
376
+ # {::Google::Cloud::Dialogflow::V2::UpdateVersionRequest} or an equivalent Hash.
377
+ #
378
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateVersionRequest, ::Hash]
379
+ # A request object representing the call parameters. Required. To specify no
380
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
381
+ # @param options [::Gapic::CallOptions, ::Hash]
382
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
383
+ #
384
+ # @overload update_version(version: nil, update_mask: nil)
385
+ # Pass arguments to `update_version` via keyword arguments. Note that at
386
+ # least one keyword argument is required. To specify no parameters, or to keep all
387
+ # the default parameter values, pass an empty Hash as a request object (see above).
388
+ #
389
+ # @param version [::Google::Cloud::Dialogflow::V2::Version, ::Hash]
390
+ # Required. The version to update.
391
+ # Supported formats:
392
+ #
393
+ # - `projects/<Project ID>/agent/versions/<Version ID>`
394
+ # - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
395
+ # ID>`
396
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
397
+ # Required. The mask to control which fields get updated.
398
+ # @yield [result, operation] Access the result along with the TransportOperation object
399
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Version]
400
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
401
+ #
402
+ # @return [::Google::Cloud::Dialogflow::V2::Version]
403
+ #
404
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
405
+ def update_version request, options = nil
406
+ raise ::ArgumentError, "request must be provided" if request.nil?
407
+
408
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateVersionRequest
409
+
410
+ # Converts hash and nil to an options object
411
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
412
+
413
+ # Customize the options with defaults
414
+ call_metadata = @config.rpcs.update_version.metadata.to_h
415
+
416
+ # Set x-goog-api-client and x-goog-user-project headers
417
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
418
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
419
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
420
+ transports_version_send: [:rest]
421
+
422
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
423
+
424
+ options.apply_defaults timeout: @config.rpcs.update_version.timeout,
425
+ metadata: call_metadata,
426
+ retry_policy: @config.rpcs.update_version.retry_policy
427
+
428
+ options.apply_defaults timeout: @config.timeout,
429
+ metadata: @config.metadata,
430
+ retry_policy: @config.retry_policy
431
+
432
+ @versions_stub.update_version request, options do |result, operation|
433
+ yield result, operation if block_given?
434
+ return result
435
+ end
436
+ rescue ::Gapic::Rest::Error => e
437
+ raise ::Google::Cloud::Error.from_error(e)
438
+ end
439
+
440
+ ##
441
+ # Delete the specified agent version.
442
+ #
443
+ # @overload delete_version(request, options = nil)
444
+ # Pass arguments to `delete_version` via a request object, either of type
445
+ # {::Google::Cloud::Dialogflow::V2::DeleteVersionRequest} or an equivalent Hash.
446
+ #
447
+ # @param request [::Google::Cloud::Dialogflow::V2::DeleteVersionRequest, ::Hash]
448
+ # A request object representing the call parameters. Required. To specify no
449
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
450
+ # @param options [::Gapic::CallOptions, ::Hash]
451
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
452
+ #
453
+ # @overload delete_version(name: nil)
454
+ # Pass arguments to `delete_version` via keyword arguments. Note that at
455
+ # least one keyword argument is required. To specify no parameters, or to keep all
456
+ # the default parameter values, pass an empty Hash as a request object (see above).
457
+ #
458
+ # @param name [::String]
459
+ # Required. The name of the version to delete.
460
+ # Supported formats:
461
+ #
462
+ # - `projects/<Project ID>/agent/versions/<Version ID>`
463
+ # - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
464
+ # ID>`
465
+ # @yield [result, operation] Access the result along with the TransportOperation object
466
+ # @yieldparam result [::Google::Protobuf::Empty]
467
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
468
+ #
469
+ # @return [::Google::Protobuf::Empty]
470
+ #
471
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
472
+ def delete_version request, options = nil
473
+ raise ::ArgumentError, "request must be provided" if request.nil?
474
+
475
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeleteVersionRequest
476
+
477
+ # Converts hash and nil to an options object
478
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
479
+
480
+ # Customize the options with defaults
481
+ call_metadata = @config.rpcs.delete_version.metadata.to_h
482
+
483
+ # Set x-goog-api-client and x-goog-user-project headers
484
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
485
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
486
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
487
+ transports_version_send: [:rest]
488
+
489
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
490
+
491
+ options.apply_defaults timeout: @config.rpcs.delete_version.timeout,
492
+ metadata: call_metadata,
493
+ retry_policy: @config.rpcs.delete_version.retry_policy
494
+
495
+ options.apply_defaults timeout: @config.timeout,
496
+ metadata: @config.metadata,
497
+ retry_policy: @config.retry_policy
498
+
499
+ @versions_stub.delete_version request, options do |result, operation|
500
+ yield result, operation if block_given?
501
+ return result
502
+ end
503
+ rescue ::Gapic::Rest::Error => e
504
+ raise ::Google::Cloud::Error.from_error(e)
505
+ end
506
+
507
+ ##
508
+ # Configuration class for the Versions REST API.
509
+ #
510
+ # This class represents the configuration for Versions REST,
511
+ # providing control over timeouts, retry behavior, logging, transport
512
+ # parameters, and other low-level controls. Certain parameters can also be
513
+ # applied individually to specific RPCs. See
514
+ # {::Google::Cloud::Dialogflow::V2::Versions::Rest::Client::Configuration::Rpcs}
515
+ # for a list of RPCs that can be configured independently.
516
+ #
517
+ # Configuration can be applied globally to all clients, or to a single client
518
+ # on construction.
519
+ #
520
+ # @example
521
+ #
522
+ # # Modify the global config, setting the timeout for
523
+ # # list_versions to 20 seconds,
524
+ # # and all remaining timeouts to 10 seconds.
525
+ # ::Google::Cloud::Dialogflow::V2::Versions::Rest::Client.configure do |config|
526
+ # config.timeout = 10.0
527
+ # config.rpcs.list_versions.timeout = 20.0
528
+ # end
529
+ #
530
+ # # Apply the above configuration only to a new client.
531
+ # client = ::Google::Cloud::Dialogflow::V2::Versions::Rest::Client.new do |config|
532
+ # config.timeout = 10.0
533
+ # config.rpcs.list_versions.timeout = 20.0
534
+ # end
535
+ #
536
+ # @!attribute [rw] endpoint
537
+ # The hostname or hostname:port of the service endpoint.
538
+ # Defaults to `"dialogflow.googleapis.com"`.
539
+ # @return [::String]
540
+ # @!attribute [rw] credentials
541
+ # Credentials to send with calls. You may provide any of the following types:
542
+ # * (`String`) The path to a service account key file in JSON format
543
+ # * (`Hash`) A service account key as a Hash
544
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
545
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
546
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
547
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
548
+ # * (`nil`) indicating no credentials
549
+ # @return [::Object]
550
+ # @!attribute [rw] scope
551
+ # The OAuth scopes
552
+ # @return [::Array<::String>]
553
+ # @!attribute [rw] lib_name
554
+ # The library name as recorded in instrumentation and logging
555
+ # @return [::String]
556
+ # @!attribute [rw] lib_version
557
+ # The library version as recorded in instrumentation and logging
558
+ # @return [::String]
559
+ # @!attribute [rw] timeout
560
+ # The call timeout in seconds.
561
+ # @return [::Numeric]
562
+ # @!attribute [rw] metadata
563
+ # Additional headers to be sent with the call.
564
+ # @return [::Hash{::Symbol=>::String}]
565
+ # @!attribute [rw] retry_policy
566
+ # The retry policy. The value is a hash with the following keys:
567
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
568
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
569
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
570
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
571
+ # trigger a retry.
572
+ # @return [::Hash]
573
+ # @!attribute [rw] quota_project
574
+ # A separate project against which to charge quota.
575
+ # @return [::String]
576
+ #
577
+ class Configuration
578
+ extend ::Gapic::Config
579
+
580
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
581
+ config_attr :credentials, nil do |value|
582
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
583
+ allowed.any? { |klass| klass === value }
584
+ end
585
+ config_attr :scope, nil, ::String, ::Array, nil
586
+ config_attr :lib_name, nil, ::String, nil
587
+ config_attr :lib_version, nil, ::String, nil
588
+ config_attr :timeout, nil, ::Numeric, nil
589
+ config_attr :metadata, nil, ::Hash, nil
590
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
591
+ config_attr :quota_project, nil, ::String, nil
592
+
593
+ # @private
594
+ # Overrides for http bindings for the RPCs of this service
595
+ # are only used when this service is used as mixin, and only
596
+ # by the host service.
597
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
598
+ config_attr :bindings_override, {}, ::Hash, nil
599
+
600
+ # @private
601
+ def initialize parent_config = nil
602
+ @parent_config = parent_config unless parent_config.nil?
603
+
604
+ yield self if block_given?
605
+ end
606
+
607
+ ##
608
+ # Configurations for individual RPCs
609
+ # @return [Rpcs]
610
+ #
611
+ def rpcs
612
+ @rpcs ||= begin
613
+ parent_rpcs = nil
614
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
615
+ Rpcs.new parent_rpcs
616
+ end
617
+ end
618
+
619
+ ##
620
+ # Configuration RPC class for the Versions API.
621
+ #
622
+ # Includes fields providing the configuration for each RPC in this service.
623
+ # Each configuration object is of type `Gapic::Config::Method` and includes
624
+ # the following configuration fields:
625
+ #
626
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
627
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
628
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
629
+ # include the following keys:
630
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
631
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
632
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
633
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
634
+ # trigger a retry.
635
+ #
636
+ class Rpcs
637
+ ##
638
+ # RPC-specific configuration for `list_versions`
639
+ # @return [::Gapic::Config::Method]
640
+ #
641
+ attr_reader :list_versions
642
+ ##
643
+ # RPC-specific configuration for `get_version`
644
+ # @return [::Gapic::Config::Method]
645
+ #
646
+ attr_reader :get_version
647
+ ##
648
+ # RPC-specific configuration for `create_version`
649
+ # @return [::Gapic::Config::Method]
650
+ #
651
+ attr_reader :create_version
652
+ ##
653
+ # RPC-specific configuration for `update_version`
654
+ # @return [::Gapic::Config::Method]
655
+ #
656
+ attr_reader :update_version
657
+ ##
658
+ # RPC-specific configuration for `delete_version`
659
+ # @return [::Gapic::Config::Method]
660
+ #
661
+ attr_reader :delete_version
662
+
663
+ # @private
664
+ def initialize parent_rpcs = nil
665
+ list_versions_config = parent_rpcs.list_versions if parent_rpcs.respond_to? :list_versions
666
+ @list_versions = ::Gapic::Config::Method.new list_versions_config
667
+ get_version_config = parent_rpcs.get_version if parent_rpcs.respond_to? :get_version
668
+ @get_version = ::Gapic::Config::Method.new get_version_config
669
+ create_version_config = parent_rpcs.create_version if parent_rpcs.respond_to? :create_version
670
+ @create_version = ::Gapic::Config::Method.new create_version_config
671
+ update_version_config = parent_rpcs.update_version if parent_rpcs.respond_to? :update_version
672
+ @update_version = ::Gapic::Config::Method.new update_version_config
673
+ delete_version_config = parent_rpcs.delete_version if parent_rpcs.respond_to? :delete_version
674
+ @delete_version = ::Gapic::Config::Method.new delete_version_config
675
+
676
+ yield self if block_given?
677
+ end
678
+ end
679
+ end
680
+ end
681
+ end
682
+ end
683
+ end
684
+ end
685
+ end
686
+ end