google-cloud-dialogflow-cx-v3 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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +1032 -0
  3. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +815 -0
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +586 -0
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/rest.rb +56 -0
  6. data/lib/google/cloud/dialogflow/cx/v3/agents.rb +6 -0
  7. data/lib/google/cloud/dialogflow/cx/v3/bindings_override.rb +104 -0
  8. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +472 -0
  9. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +168 -0
  10. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest.rb +55 -0
  11. data/lib/google/cloud/dialogflow/cx/v3/changelogs.rb +6 -0
  12. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +456 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +168 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest.rb +55 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/deployments.rb +6 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +740 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +347 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest.rb +55 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/entity_types.rb +6 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +1028 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +815 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +585 -0
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/rest.rb +57 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/environments.rb +6 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +821 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +467 -0
  27. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest.rb +55 -0
  28. data/lib/google/cloud/dialogflow/cx/v3/experiments.rb +6 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +1182 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +815 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +646 -0
  32. data/lib/google/cloud/dialogflow/cx/v3/flows/rest.rb +56 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/flows.rb +6 -0
  34. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +722 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +347 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/intents/rest.rb +55 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +6 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +777 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +347 -0
  40. data/lib/google/cloud/dialogflow/cx/v3/pages/rest.rb +55 -0
  41. data/lib/google/cloud/dialogflow/cx/v3/pages.rb +6 -0
  42. data/lib/google/cloud/dialogflow/cx/v3/rest.rb +55 -0
  43. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +673 -0
  44. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +347 -0
  45. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest.rb +55 -0
  46. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service.rb +6 -0
  47. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +688 -0
  48. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +384 -0
  49. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest.rb +56 -0
  50. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types.rb +6 -0
  51. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +576 -0
  52. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +254 -0
  53. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest.rb +58 -0
  54. data/lib/google/cloud/dialogflow/cx/v3/sessions.rb +6 -0
  55. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +1304 -0
  56. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +815 -0
  57. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +765 -0
  58. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest.rb +57 -0
  59. data/lib/google/cloud/dialogflow/cx/v3/test_cases.rb +6 -0
  60. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +748 -0
  61. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +347 -0
  62. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest.rb +56 -0
  63. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups.rb +6 -0
  64. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  65. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +865 -0
  66. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +815 -0
  67. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +467 -0
  68. data/lib/google/cloud/dialogflow/cx/v3/versions/rest.rb +56 -0
  69. data/lib/google/cloud/dialogflow/cx/v3/versions.rb +6 -0
  70. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +677 -0
  71. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +347 -0
  72. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest.rb +55 -0
  73. data/lib/google/cloud/dialogflow/cx/v3/webhooks.rb +6 -0
  74. data/lib/google/cloud/dialogflow/cx/v3.rb +5 -0
  75. metadata +57 -2
@@ -0,0 +1,576 @@
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/cx/v3/session_pb"
21
+ require "google/cloud/dialogflow/cx/v3/sessions/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module CX
28
+ module V3
29
+ module Sessions
30
+ module Rest
31
+ ##
32
+ # REST client for the Sessions service.
33
+ #
34
+ # A session represents an interaction with a user. You retrieve user input
35
+ # and pass it to the
36
+ # {::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client#detect_intent DetectIntent} method to
37
+ # determine user intent and respond.
38
+ #
39
+ class Client
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :sessions_stub
44
+
45
+ ##
46
+ # Configure the Sessions Client class.
47
+ #
48
+ # See {::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all Sessions clients
54
+ # ::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Cloud", "Dialogflow", "CX", "V3"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config.timeout = 60.0
75
+ default_config.retry_policy = {
76
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
77
+ }
78
+
79
+ default_config.rpcs.detect_intent.timeout = 220.0
80
+ default_config.rpcs.detect_intent.retry_policy = {
81
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
82
+ }
83
+
84
+ default_config
85
+ end
86
+ yield @configure if block_given?
87
+ @configure
88
+ end
89
+
90
+ ##
91
+ # Configure the Sessions Client instance.
92
+ #
93
+ # The configuration is set to the derived mode, meaning that values can be changed,
94
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
95
+ # should be made on {Client.configure}.
96
+ #
97
+ # See {::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client::Configuration}
98
+ # for a description of the configuration fields.
99
+ #
100
+ # @yield [config] Configure the Client client.
101
+ # @yieldparam config [Client::Configuration]
102
+ #
103
+ # @return [Client::Configuration]
104
+ #
105
+ def configure
106
+ yield @config if block_given?
107
+ @config
108
+ end
109
+
110
+ ##
111
+ # Create a new Sessions REST client object.
112
+ #
113
+ # @example
114
+ #
115
+ # # Create a client using the default configuration
116
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client.new
117
+ #
118
+ # # Create a client using a custom configuration
119
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client.new do |config|
120
+ # config.timeout = 10.0
121
+ # end
122
+ #
123
+ # @yield [config] Configure the Sessions client.
124
+ # @yieldparam config [Client::Configuration]
125
+ #
126
+ def initialize
127
+ # Create the configuration object
128
+ @config = Configuration.new Client.configure
129
+
130
+ # Yield the configuration if needed
131
+ yield @config if block_given?
132
+
133
+ # Create credentials
134
+ credentials = @config.credentials
135
+ # Use self-signed JWT if the endpoint is unchanged from default,
136
+ # but only if the default endpoint does not have a region prefix.
137
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
138
+ !@config.endpoint.split(".").first.include?("-")
139
+ credentials ||= Credentials.default scope: @config.scope,
140
+ enable_self_signed_jwt: enable_self_signed_jwt
141
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
142
+ credentials = Credentials.new credentials, scope: @config.scope
143
+ end
144
+
145
+ @quota_project_id = @config.quota_project
146
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
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
+ @sessions_stub = ::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
156
+ end
157
+
158
+ ##
159
+ # Get the associated client for mix-in of the Locations.
160
+ #
161
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
162
+ #
163
+ attr_reader :location_client
164
+
165
+ # Service calls
166
+
167
+ ##
168
+ # Processes a natural language query and returns structured, actionable data
169
+ # as a result. This method is not idempotent, because it may cause session
170
+ # entity types to be updated, which in turn might affect results of future
171
+ # queries.
172
+ #
173
+ # Note: Always use agent versions for production traffic.
174
+ # See [Versions and
175
+ # environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
176
+ #
177
+ # @overload detect_intent(request, options = nil)
178
+ # Pass arguments to `detect_intent` via a request object, either of type
179
+ # {::Google::Cloud::Dialogflow::CX::V3::DetectIntentRequest} or an equivalent Hash.
180
+ #
181
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::DetectIntentRequest, ::Hash]
182
+ # A request object representing the call parameters. Required. To specify no
183
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
184
+ # @param options [::Gapic::CallOptions, ::Hash]
185
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
186
+ #
187
+ # @overload detect_intent(session: nil, query_params: nil, query_input: nil, output_audio_config: nil)
188
+ # Pass arguments to `detect_intent` via keyword arguments. Note that at
189
+ # least one keyword argument is required. To specify no parameters, or to keep all
190
+ # the default parameter values, pass an empty Hash as a request object (see above).
191
+ #
192
+ # @param session [::String]
193
+ # Required. The name of the session this query is sent to.
194
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
195
+ # ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location
196
+ # ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`.
197
+ # If `Environment ID` is not specified, we assume default 'draft'
198
+ # environment.
199
+ # It's up to the API caller to choose an appropriate `Session ID`. It can be
200
+ # a random number or some type of session identifiers (preferably hashed).
201
+ # The length of the `Session ID` must not exceed 36 characters.
202
+ #
203
+ # For more information, see the [sessions
204
+ # guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
205
+ #
206
+ # Note: Always use agent versions for production traffic.
207
+ # See [Versions and
208
+ # environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
209
+ # @param query_params [::Google::Cloud::Dialogflow::CX::V3::QueryParameters, ::Hash]
210
+ # The parameters of this query.
211
+ # @param query_input [::Google::Cloud::Dialogflow::CX::V3::QueryInput, ::Hash]
212
+ # Required. The input specification.
213
+ # @param output_audio_config [::Google::Cloud::Dialogflow::CX::V3::OutputAudioConfig, ::Hash]
214
+ # Instructs the speech synthesizer how to generate the output audio.
215
+ # @yield [result, operation] Access the result along with the TransportOperation object
216
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::DetectIntentResponse]
217
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
218
+ #
219
+ # @return [::Google::Cloud::Dialogflow::CX::V3::DetectIntentResponse]
220
+ #
221
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
222
+ def detect_intent request, options = nil
223
+ raise ::ArgumentError, "request must be provided" if request.nil?
224
+
225
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::DetectIntentRequest
226
+
227
+ # Converts hash and nil to an options object
228
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
229
+
230
+ # Customize the options with defaults
231
+ call_metadata = @config.rpcs.detect_intent.metadata.to_h
232
+
233
+ # Set x-goog-api-client and x-goog-user-project headers
234
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
235
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
236
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
237
+ transports_version_send: [:rest]
238
+
239
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
240
+
241
+ options.apply_defaults timeout: @config.rpcs.detect_intent.timeout,
242
+ metadata: call_metadata,
243
+ retry_policy: @config.rpcs.detect_intent.retry_policy
244
+
245
+ options.apply_defaults timeout: @config.timeout,
246
+ metadata: @config.metadata,
247
+ retry_policy: @config.retry_policy
248
+
249
+ @sessions_stub.detect_intent request, options do |result, operation|
250
+ yield result, operation if block_given?
251
+ return result
252
+ end
253
+ rescue ::Gapic::Rest::Error => e
254
+ raise ::Google::Cloud::Error.from_error(e)
255
+ end
256
+
257
+ ##
258
+ # Returns preliminary intent match results, doesn't change the session
259
+ # status.
260
+ #
261
+ # @overload match_intent(request, options = nil)
262
+ # Pass arguments to `match_intent` via a request object, either of type
263
+ # {::Google::Cloud::Dialogflow::CX::V3::MatchIntentRequest} or an equivalent Hash.
264
+ #
265
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::MatchIntentRequest, ::Hash]
266
+ # A request object representing the call parameters. Required. To specify no
267
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
268
+ # @param options [::Gapic::CallOptions, ::Hash]
269
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
270
+ #
271
+ # @overload match_intent(session: nil, query_params: nil, query_input: nil, persist_parameter_changes: nil)
272
+ # Pass arguments to `match_intent` via keyword arguments. Note that at
273
+ # least one keyword argument is required. To specify no parameters, or to keep all
274
+ # the default parameter values, pass an empty Hash as a request object (see above).
275
+ #
276
+ # @param session [::String]
277
+ # Required. The name of the session this query is sent to.
278
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
279
+ # ID>/sessions/<Session ID>` or `projects/<Project ID>/locations/<Location
280
+ # ID>/agents/<Agent ID>/environments/<Environment ID>/sessions/<Session ID>`.
281
+ # If `Environment ID` is not specified, we assume default 'draft'
282
+ # environment.
283
+ # It's up to the API caller to choose an appropriate `Session ID`. It can be
284
+ # a random number or some type of session identifiers (preferably hashed).
285
+ # The length of the `Session ID` must not exceed 36 characters.
286
+ #
287
+ # For more information, see the [sessions
288
+ # guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
289
+ # @param query_params [::Google::Cloud::Dialogflow::CX::V3::QueryParameters, ::Hash]
290
+ # The parameters of this query.
291
+ # @param query_input [::Google::Cloud::Dialogflow::CX::V3::QueryInput, ::Hash]
292
+ # Required. The input specification.
293
+ # @param persist_parameter_changes [::Boolean]
294
+ # Persist session parameter changes from `query_params`.
295
+ # @yield [result, operation] Access the result along with the TransportOperation object
296
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse]
297
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
298
+ #
299
+ # @return [::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse]
300
+ #
301
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
302
+ def match_intent request, options = nil
303
+ raise ::ArgumentError, "request must be provided" if request.nil?
304
+
305
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::MatchIntentRequest
306
+
307
+ # Converts hash and nil to an options object
308
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
309
+
310
+ # Customize the options with defaults
311
+ call_metadata = @config.rpcs.match_intent.metadata.to_h
312
+
313
+ # Set x-goog-api-client and x-goog-user-project headers
314
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
315
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
316
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
317
+ transports_version_send: [:rest]
318
+
319
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
320
+
321
+ options.apply_defaults timeout: @config.rpcs.match_intent.timeout,
322
+ metadata: call_metadata,
323
+ retry_policy: @config.rpcs.match_intent.retry_policy
324
+
325
+ options.apply_defaults timeout: @config.timeout,
326
+ metadata: @config.metadata,
327
+ retry_policy: @config.retry_policy
328
+
329
+ @sessions_stub.match_intent request, options do |result, operation|
330
+ yield result, operation if block_given?
331
+ return result
332
+ end
333
+ rescue ::Gapic::Rest::Error => e
334
+ raise ::Google::Cloud::Error.from_error(e)
335
+ end
336
+
337
+ ##
338
+ # Fulfills a matched intent returned by
339
+ # {::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client#match_intent MatchIntent}. Must be
340
+ # called after
341
+ # {::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client#match_intent MatchIntent}, with
342
+ # input from
343
+ # {::Google::Cloud::Dialogflow::CX::V3::MatchIntentResponse MatchIntentResponse}.
344
+ # Otherwise, the behavior is undefined.
345
+ #
346
+ # @overload fulfill_intent(request, options = nil)
347
+ # Pass arguments to `fulfill_intent` via a request object, either of type
348
+ # {::Google::Cloud::Dialogflow::CX::V3::FulfillIntentRequest} or an equivalent Hash.
349
+ #
350
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::FulfillIntentRequest, ::Hash]
351
+ # A request object representing the call parameters. Required. To specify no
352
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
353
+ # @param options [::Gapic::CallOptions, ::Hash]
354
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
355
+ #
356
+ # @overload fulfill_intent(match_intent_request: nil, match: nil, output_audio_config: nil)
357
+ # Pass arguments to `fulfill_intent` via keyword arguments. Note that at
358
+ # least one keyword argument is required. To specify no parameters, or to keep all
359
+ # the default parameter values, pass an empty Hash as a request object (see above).
360
+ #
361
+ # @param match_intent_request [::Google::Cloud::Dialogflow::CX::V3::MatchIntentRequest, ::Hash]
362
+ # Must be same as the corresponding MatchIntent request, otherwise the
363
+ # behavior is undefined.
364
+ # @param match [::Google::Cloud::Dialogflow::CX::V3::Match, ::Hash]
365
+ # The matched intent/event to fulfill.
366
+ # @param output_audio_config [::Google::Cloud::Dialogflow::CX::V3::OutputAudioConfig, ::Hash]
367
+ # Instructs the speech synthesizer how to generate output audio.
368
+ # @yield [result, operation] Access the result along with the TransportOperation object
369
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::FulfillIntentResponse]
370
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
371
+ #
372
+ # @return [::Google::Cloud::Dialogflow::CX::V3::FulfillIntentResponse]
373
+ #
374
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
375
+ def fulfill_intent request, options = nil
376
+ raise ::ArgumentError, "request must be provided" if request.nil?
377
+
378
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::FulfillIntentRequest
379
+
380
+ # Converts hash and nil to an options object
381
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
382
+
383
+ # Customize the options with defaults
384
+ call_metadata = @config.rpcs.fulfill_intent.metadata.to_h
385
+
386
+ # Set x-goog-api-client and x-goog-user-project headers
387
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
388
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
389
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
390
+ transports_version_send: [:rest]
391
+
392
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
393
+
394
+ options.apply_defaults timeout: @config.rpcs.fulfill_intent.timeout,
395
+ metadata: call_metadata,
396
+ retry_policy: @config.rpcs.fulfill_intent.retry_policy
397
+
398
+ options.apply_defaults timeout: @config.timeout,
399
+ metadata: @config.metadata,
400
+ retry_policy: @config.retry_policy
401
+
402
+ @sessions_stub.fulfill_intent request, options do |result, operation|
403
+ yield result, operation if block_given?
404
+ return result
405
+ end
406
+ rescue ::Gapic::Rest::Error => e
407
+ raise ::Google::Cloud::Error.from_error(e)
408
+ end
409
+
410
+ ##
411
+ # Configuration class for the Sessions REST API.
412
+ #
413
+ # This class represents the configuration for Sessions REST,
414
+ # providing control over timeouts, retry behavior, logging, transport
415
+ # parameters, and other low-level controls. Certain parameters can also be
416
+ # applied individually to specific RPCs. See
417
+ # {::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client::Configuration::Rpcs}
418
+ # for a list of RPCs that can be configured independently.
419
+ #
420
+ # Configuration can be applied globally to all clients, or to a single client
421
+ # on construction.
422
+ #
423
+ # @example
424
+ #
425
+ # # Modify the global config, setting the timeout for
426
+ # # detect_intent to 20 seconds,
427
+ # # and all remaining timeouts to 10 seconds.
428
+ # ::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client.configure do |config|
429
+ # config.timeout = 10.0
430
+ # config.rpcs.detect_intent.timeout = 20.0
431
+ # end
432
+ #
433
+ # # Apply the above configuration only to a new client.
434
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Sessions::Rest::Client.new do |config|
435
+ # config.timeout = 10.0
436
+ # config.rpcs.detect_intent.timeout = 20.0
437
+ # end
438
+ #
439
+ # @!attribute [rw] endpoint
440
+ # The hostname or hostname:port of the service endpoint.
441
+ # Defaults to `"dialogflow.googleapis.com"`.
442
+ # @return [::String]
443
+ # @!attribute [rw] credentials
444
+ # Credentials to send with calls. You may provide any of the following types:
445
+ # * (`String`) The path to a service account key file in JSON format
446
+ # * (`Hash`) A service account key as a Hash
447
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
448
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
449
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
450
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
451
+ # * (`nil`) indicating no credentials
452
+ # @return [::Object]
453
+ # @!attribute [rw] scope
454
+ # The OAuth scopes
455
+ # @return [::Array<::String>]
456
+ # @!attribute [rw] lib_name
457
+ # The library name as recorded in instrumentation and logging
458
+ # @return [::String]
459
+ # @!attribute [rw] lib_version
460
+ # The library version as recorded in instrumentation and logging
461
+ # @return [::String]
462
+ # @!attribute [rw] timeout
463
+ # The call timeout in seconds.
464
+ # @return [::Numeric]
465
+ # @!attribute [rw] metadata
466
+ # Additional headers to be sent with the call.
467
+ # @return [::Hash{::Symbol=>::String}]
468
+ # @!attribute [rw] retry_policy
469
+ # The retry policy. The value is a hash with the following keys:
470
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
471
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
472
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
473
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
474
+ # trigger a retry.
475
+ # @return [::Hash]
476
+ # @!attribute [rw] quota_project
477
+ # A separate project against which to charge quota.
478
+ # @return [::String]
479
+ #
480
+ class Configuration
481
+ extend ::Gapic::Config
482
+
483
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
484
+ config_attr :credentials, nil do |value|
485
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
486
+ allowed.any? { |klass| klass === value }
487
+ end
488
+ config_attr :scope, nil, ::String, ::Array, nil
489
+ config_attr :lib_name, nil, ::String, nil
490
+ config_attr :lib_version, nil, ::String, nil
491
+ config_attr :timeout, nil, ::Numeric, nil
492
+ config_attr :metadata, nil, ::Hash, nil
493
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
494
+ config_attr :quota_project, nil, ::String, nil
495
+
496
+ # @private
497
+ # Overrides for http bindings for the RPCs of this service
498
+ # are only used when this service is used as mixin, and only
499
+ # by the host service.
500
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
501
+ config_attr :bindings_override, {}, ::Hash, nil
502
+
503
+ # @private
504
+ def initialize parent_config = nil
505
+ @parent_config = parent_config unless parent_config.nil?
506
+
507
+ yield self if block_given?
508
+ end
509
+
510
+ ##
511
+ # Configurations for individual RPCs
512
+ # @return [Rpcs]
513
+ #
514
+ def rpcs
515
+ @rpcs ||= begin
516
+ parent_rpcs = nil
517
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
518
+ Rpcs.new parent_rpcs
519
+ end
520
+ end
521
+
522
+ ##
523
+ # Configuration RPC class for the Sessions API.
524
+ #
525
+ # Includes fields providing the configuration for each RPC in this service.
526
+ # Each configuration object is of type `Gapic::Config::Method` and includes
527
+ # the following configuration fields:
528
+ #
529
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
530
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
531
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
532
+ # include the following keys:
533
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
534
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
535
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
536
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
537
+ # trigger a retry.
538
+ #
539
+ class Rpcs
540
+ ##
541
+ # RPC-specific configuration for `detect_intent`
542
+ # @return [::Gapic::Config::Method]
543
+ #
544
+ attr_reader :detect_intent
545
+ ##
546
+ # RPC-specific configuration for `match_intent`
547
+ # @return [::Gapic::Config::Method]
548
+ #
549
+ attr_reader :match_intent
550
+ ##
551
+ # RPC-specific configuration for `fulfill_intent`
552
+ # @return [::Gapic::Config::Method]
553
+ #
554
+ attr_reader :fulfill_intent
555
+
556
+ # @private
557
+ def initialize parent_rpcs = nil
558
+ detect_intent_config = parent_rpcs.detect_intent if parent_rpcs.respond_to? :detect_intent
559
+ @detect_intent = ::Gapic::Config::Method.new detect_intent_config
560
+ match_intent_config = parent_rpcs.match_intent if parent_rpcs.respond_to? :match_intent
561
+ @match_intent = ::Gapic::Config::Method.new match_intent_config
562
+ fulfill_intent_config = parent_rpcs.fulfill_intent if parent_rpcs.respond_to? :fulfill_intent
563
+ @fulfill_intent = ::Gapic::Config::Method.new fulfill_intent_config
564
+
565
+ yield self if block_given?
566
+ end
567
+ end
568
+ end
569
+ end
570
+ end
571
+ end
572
+ end
573
+ end
574
+ end
575
+ end
576
+ end