aws-sdk-qbusiness 1.4.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd283db25315ae56fd6ba2985855e68d2ffeb400b3fb04510bd26f0b224c9b8e
4
- data.tar.gz: 1f33079fd2a759b761a495285f213fa25fc4a21ed9e8b438eb9bde885c275c99
3
+ metadata.gz: c72f351ad0879c64ccb82dbe17b1d2dd901d378a9dfac34bcfc686458c993cf3
4
+ data.tar.gz: 5022da17317b4fabde68dd8a2fe15eb5be87a13ad59d40dbbecd3ec7f69b5176
5
5
  SHA512:
6
- metadata.gz: c9107842f460e3df9273103383748d0f2b885946c8590d51d8337b993881075af4ec56dcdf0bd698a45c7a04e7569c2af27826bb0184ce5349221f40e1d60307
7
- data.tar.gz: 006c25b68fd1a1691c66bcb72f8947142a6552f6dd3075c8420aa2fb532d60909488ae97caa453ec7c10f056e5685ba66d998defe0f4072db1a62193b82c04b3
6
+ metadata.gz: 3a7dddaf0af0daaca597b973f3b42c8580d2c4723f1a3aef8f0f6be892ae091804644b57cc1010341dc1d56e0ac7da963e216f4f5ff18319900e002d81660cdd
7
+ data.tar.gz: 564d5e4b8356b7856fa0ddf27d82a40cf9ebc1ec167a8db889ff773e586991e1232fb1c5d9a816b9bd7901676f442607ee19ff019a84b56a6887d1bf7736a682
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.6.0 (2024-05-13)
5
+ ------------------
6
+
7
+ * Feature - Code Generated Changes, see `./build_tools` or `aws-sdk-core`'s CHANGELOG.md for details.
8
+
9
+ 1.5.0 (2024-04-30)
10
+ ------------------
11
+
12
+ * Feature - This is a general availability (GA) release of Amazon Q Business. Q Business enables employees in an enterprise to get comprehensive answers to complex questions and take actions through a unified, intuitive web-based chat experience - using an enterprise's existing content, data, and systems.
13
+
4
14
  1.4.0 (2024-04-25)
5
15
  ------------------
6
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.6.0
@@ -0,0 +1,607 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ begin
11
+ require 'http/2'
12
+ rescue LoadError; end
13
+ require 'aws-sdk-core/plugins/credentials_configuration.rb'
14
+ require 'aws-sdk-core/plugins/logging.rb'
15
+ require 'aws-sdk-core/plugins/param_converter.rb'
16
+ require 'aws-sdk-core/plugins/param_validator.rb'
17
+ require 'aws-sdk-core/plugins/user_agent.rb'
18
+ require 'aws-sdk-core/plugins/helpful_socket_errors.rb'
19
+ require 'aws-sdk-core/plugins/retry_errors.rb'
20
+ require 'aws-sdk-core/plugins/global_configuration.rb'
21
+ require 'aws-sdk-core/plugins/regional_endpoint.rb'
22
+ require 'aws-sdk-core/plugins/stub_responses.rb'
23
+ require 'aws-sdk-core/plugins/idempotency_token.rb'
24
+ require 'aws-sdk-core/plugins/invocation_id.rb'
25
+ require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
26
+ require 'aws-sdk-core/plugins/http_checksum.rb'
27
+ require 'aws-sdk-core/plugins/checksum_algorithm.rb'
28
+ require 'aws-sdk-core/plugins/request_compression.rb'
29
+ require 'aws-sdk-core/plugins/defaults_mode.rb'
30
+ require 'aws-sdk-core/plugins/recursion_detection.rb'
31
+ require 'aws-sdk-core/plugins/sign.rb'
32
+ require 'aws-sdk-core/plugins/protocols/rest_json.rb'
33
+ require 'aws-sdk-core/plugins/event_stream_configuration.rb'
34
+
35
+ Aws::Plugins::GlobalConfiguration.add_identifier(:qbusiness)
36
+
37
+ module Aws::QBusiness
38
+ class AsyncClient < Seahorse::Client::AsyncBase
39
+
40
+ include Aws::AsyncClientStubs
41
+
42
+ @identifier = :qbusiness
43
+
44
+ set_api(ClientApi::API)
45
+
46
+ add_plugin(Aws::Plugins::CredentialsConfiguration)
47
+ add_plugin(Aws::Plugins::Logging)
48
+ add_plugin(Aws::Plugins::ParamConverter)
49
+ add_plugin(Aws::Plugins::ParamValidator)
50
+ add_plugin(Aws::Plugins::UserAgent)
51
+ add_plugin(Aws::Plugins::HelpfulSocketErrors)
52
+ add_plugin(Aws::Plugins::RetryErrors)
53
+ add_plugin(Aws::Plugins::GlobalConfiguration)
54
+ add_plugin(Aws::Plugins::RegionalEndpoint)
55
+ add_plugin(Aws::Plugins::StubResponses)
56
+ add_plugin(Aws::Plugins::IdempotencyToken)
57
+ add_plugin(Aws::Plugins::InvocationId)
58
+ add_plugin(Aws::Plugins::JsonvalueConverter)
59
+ add_plugin(Aws::Plugins::HttpChecksum)
60
+ add_plugin(Aws::Plugins::ChecksumAlgorithm)
61
+ add_plugin(Aws::Plugins::RequestCompression)
62
+ add_plugin(Aws::Plugins::DefaultsMode)
63
+ add_plugin(Aws::Plugins::RecursionDetection)
64
+ add_plugin(Aws::Plugins::Sign)
65
+ add_plugin(Aws::Plugins::Protocols::RestJson)
66
+ add_plugin(Aws::Plugins::EventStreamConfiguration)
67
+ add_plugin(Aws::QBusiness::Plugins::Endpoints)
68
+
69
+ # @option options [required, Aws::CredentialProvider] :credentials
70
+ # Your AWS credentials. This can be an instance of any one of the
71
+ # following classes:
72
+ #
73
+ # * `Aws::Credentials` - Used for configuring static, non-refreshing
74
+ # credentials.
75
+ #
76
+ # * `Aws::SharedCredentials` - Used for loading static credentials from a
77
+ # shared file, such as `~/.aws/config`.
78
+ #
79
+ # * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
80
+ #
81
+ # * `Aws::AssumeRoleWebIdentityCredentials` - Used when you need to
82
+ # assume a role after providing credentials via the web.
83
+ #
84
+ # * `Aws::SSOCredentials` - Used for loading credentials from AWS SSO using an
85
+ # access token generated from `aws login`.
86
+ #
87
+ # * `Aws::ProcessCredentials` - Used for loading credentials from a
88
+ # process that outputs to stdout.
89
+ #
90
+ # * `Aws::InstanceProfileCredentials` - Used for loading credentials
91
+ # from an EC2 IMDS on an EC2 instance.
92
+ #
93
+ # * `Aws::ECSCredentials` - Used for loading credentials from
94
+ # instances running in ECS.
95
+ #
96
+ # * `Aws::CognitoIdentityCredentials` - Used for loading credentials
97
+ # from the Cognito Identity service.
98
+ #
99
+ # When `:credentials` are not configured directly, the following
100
+ # locations will be searched for credentials:
101
+ #
102
+ # * `Aws.config[:credentials]`
103
+ # * The `:access_key_id`, `:secret_access_key`, and `:session_token` options.
104
+ # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
105
+ # * `~/.aws/credentials`
106
+ # * `~/.aws/config`
107
+ # * EC2/ECS IMDS instance profile - When used by default, the timeouts
108
+ # are very aggressive. Construct and pass an instance of
109
+ # `Aws::InstanceProfileCredentails` or `Aws::ECSCredentials` to
110
+ # enable retries and extended timeouts. Instance profile credential
111
+ # fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
112
+ # to true.
113
+ #
114
+ # @option options [required, String] :region
115
+ # The AWS region to connect to. The configured `:region` is
116
+ # used to determine the service `:endpoint`. When not passed,
117
+ # a default `:region` is searched for in the following locations:
118
+ #
119
+ # * `Aws.config[:region]`
120
+ # * `ENV['AWS_REGION']`
121
+ # * `ENV['AMAZON_REGION']`
122
+ # * `ENV['AWS_DEFAULT_REGION']`
123
+ # * `~/.aws/credentials`
124
+ # * `~/.aws/config`
125
+ #
126
+ # @option options [String] :access_key_id
127
+ #
128
+ # @option options [Boolean] :adaptive_retry_wait_to_fill (true)
129
+ # Used only in `adaptive` retry mode. When true, the request will sleep
130
+ # until there is sufficent client side capacity to retry the request.
131
+ # When false, the request will raise a `RetryCapacityNotAvailableError` and will
132
+ # not retry instead of sleeping.
133
+ #
134
+ # @option options [Boolean] :convert_params (true)
135
+ # When `true`, an attempt is made to coerce request parameters into
136
+ # the required types.
137
+ #
138
+ # @option options [Boolean] :correct_clock_skew (true)
139
+ # Used only in `standard` and adaptive retry modes. Specifies whether to apply
140
+ # a clock skew correction and retry requests with skewed client clocks.
141
+ #
142
+ # @option options [String] :defaults_mode ("legacy")
143
+ # See {Aws::DefaultsModeConfiguration} for a list of the
144
+ # accepted modes and the configuration defaults that are included.
145
+ #
146
+ # @option options [Boolean] :disable_request_compression (false)
147
+ # When set to 'true' the request body will not be compressed
148
+ # for supported operations.
149
+ #
150
+ # @option options [String, URI::HTTPS, URI::HTTP] :endpoint
151
+ # Normally you should not configure the `:endpoint` option
152
+ # directly. This is normally constructed from the `:region`
153
+ # option. Configuring `:endpoint` is normally reserved for
154
+ # connecting to test or custom endpoints. The endpoint should
155
+ # be a URI formatted like:
156
+ #
157
+ # 'http://example.com'
158
+ # 'https://example.com'
159
+ # 'http://example.com:123'
160
+ #
161
+ #
162
+ # @option options [Proc] :event_stream_handler
163
+ # When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
164
+ #
165
+ # @option options [Boolean] :ignore_configured_endpoint_urls
166
+ # Setting to true disables use of endpoint URLs provided via environment
167
+ # variables and the shared configuration file.
168
+ #
169
+ # @option options [Proc] :input_event_stream_handler
170
+ # When an EventStream or Proc object is provided, it can be used for sending events for the event stream.
171
+ #
172
+ # @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
173
+ # The log formatter.
174
+ #
175
+ # @option options [Symbol] :log_level (:info)
176
+ # The log level to send messages to the `:logger` at.
177
+ #
178
+ # @option options [Logger] :logger
179
+ # The Logger instance to send log messages to. If this option
180
+ # is not set, logging will be disabled.
181
+ #
182
+ # @option options [Integer] :max_attempts (3)
183
+ # An integer representing the maximum number attempts that will be made for
184
+ # a single request, including the initial attempt. For example,
185
+ # setting this value to 5 will result in a request being retried up to
186
+ # 4 times. Used in `standard` and `adaptive` retry modes.
187
+ #
188
+ # @option options [Proc] :output_event_stream_handler
189
+ # When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
190
+ #
191
+ # @option options [String] :profile ("default")
192
+ # Used when loading credentials from the shared credentials file
193
+ # at HOME/.aws/credentials. When not specified, 'default' is used.
194
+ #
195
+ # @option options [Integer] :request_min_compression_size_bytes (10240)
196
+ # The minimum size in bytes that triggers compression for request
197
+ # bodies. The value must be non-negative integer value between 0
198
+ # and 10485780 bytes inclusive.
199
+ #
200
+ # @option options [Proc] :retry_backoff
201
+ # A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
202
+ # This option is only used in the `legacy` retry mode.
203
+ #
204
+ # @option options [Float] :retry_base_delay (0.3)
205
+ # The base delay in seconds used by the default backoff function. This option
206
+ # is only used in the `legacy` retry mode.
207
+ #
208
+ # @option options [Symbol] :retry_jitter (:none)
209
+ # A delay randomiser function used by the default backoff function.
210
+ # Some predefined functions can be referenced by name - :none, :equal, :full,
211
+ # otherwise a Proc that takes and returns a number. This option is only used
212
+ # in the `legacy` retry mode.
213
+ #
214
+ # @see https://www.awsarchitectureblog.com/2015/03/backoff.html
215
+ #
216
+ # @option options [Integer] :retry_limit (3)
217
+ # The maximum number of times to retry failed requests. Only
218
+ # ~ 500 level server errors and certain ~ 400 level client errors
219
+ # are retried. Generally, these are throttling errors, data
220
+ # checksum errors, networking errors, timeout errors, auth errors,
221
+ # endpoint discovery, and errors from expired credentials.
222
+ # This option is only used in the `legacy` retry mode.
223
+ #
224
+ # @option options [Integer] :retry_max_delay (0)
225
+ # The maximum number of seconds to delay between retries (0 for no limit)
226
+ # used by the default backoff function. This option is only used in the
227
+ # `legacy` retry mode.
228
+ #
229
+ # @option options [String] :retry_mode ("legacy")
230
+ # Specifies which retry algorithm to use. Values are:
231
+ #
232
+ # * `legacy` - The pre-existing retry behavior. This is default value if
233
+ # no retry mode is provided.
234
+ #
235
+ # * `standard` - A standardized set of retry rules across the AWS SDKs.
236
+ # This includes support for retry quotas, which limit the number of
237
+ # unsuccessful retries a client can make.
238
+ #
239
+ # * `adaptive` - An experimental retry mode that includes all the
240
+ # functionality of `standard` mode along with automatic client side
241
+ # throttling. This is a provisional mode that may change behavior
242
+ # in the future.
243
+ #
244
+ #
245
+ # @option options [String] :sdk_ua_app_id
246
+ # A unique and opaque application ID that is appended to the
247
+ # User-Agent header as app/sdk_ua_app_id. It should have a
248
+ # maximum length of 50. This variable is sourced from environment
249
+ # variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
250
+ #
251
+ # @option options [String] :secret_access_key
252
+ #
253
+ # @option options [String] :session_token
254
+ #
255
+ # @option options [Boolean] :stub_responses (false)
256
+ # Causes the client to return stubbed responses. By default
257
+ # fake responses are generated and returned. You can specify
258
+ # the response data to return or errors to raise by calling
259
+ # {ClientStubs#stub_responses}. See {ClientStubs} for more information.
260
+ #
261
+ # ** Please note ** When response stubbing is enabled, no HTTP
262
+ # requests are made, and retries are disabled.
263
+ #
264
+ # @option options [Aws::TokenProvider] :token_provider
265
+ # A Bearer Token Provider. This can be an instance of any one of the
266
+ # following classes:
267
+ #
268
+ # * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
269
+ # tokens.
270
+ #
271
+ # * `Aws::SSOTokenProvider` - Used for loading tokens from AWS SSO using an
272
+ # access token generated from `aws login`.
273
+ #
274
+ # When `:token_provider` is not configured directly, the `Aws::TokenProviderChain`
275
+ # will be used to search for tokens configured for your profile in shared configuration files.
276
+ #
277
+ # @option options [Boolean] :use_dualstack_endpoint
278
+ # When set to `true`, dualstack enabled endpoints (with `.aws` TLD)
279
+ # will be used if available.
280
+ #
281
+ # @option options [Boolean] :use_fips_endpoint
282
+ # When set to `true`, fips compatible endpoints will be used if available.
283
+ # When a `fips` region is used, the region is normalized and this config
284
+ # is set to `true`.
285
+ #
286
+ # @option options [Boolean] :validate_params (true)
287
+ # When `true`, request parameters are validated before
288
+ # sending the request.
289
+ #
290
+ # @option options [Aws::QBusiness::EndpointProvider] :endpoint_provider
291
+ # The endpoint provider used to resolve endpoints. Any object that responds to `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to `Aws::QBusiness::EndpointParameters`
292
+ #
293
+ # @option options [Integer] :connection_read_timeout (60)
294
+ # Connection read timeout in seconds, defaults to 60 sec.
295
+ #
296
+ # @option options [Integer] :connection_timeout (60)
297
+ # Connection timeout in seconds, defaults to 60 sec.
298
+ #
299
+ # @option options [Boolean] :enable_alpn (false)
300
+ # Set to `true` to enable ALPN in HTTP2 over TLS. Requires Openssl version >= 1.0.2.
301
+ # Defaults to false. Note: not all service HTTP2 operations supports ALPN on server
302
+ # side, please refer to service documentation.
303
+ #
304
+ # @option options [Boolean] :http_wire_trace (false)
305
+ # When `true`, HTTP2 debug output will be sent to the `:logger`.
306
+ #
307
+ # @option options [Integer] :max_concurrent_streams (100)
308
+ # Maximum concurrent streams used in HTTP2 connection, defaults to 100. Note that server may send back
309
+ # :settings_max_concurrent_streams value which will take priority when initializing new streams.
310
+ #
311
+ # @option options [Boolean] :raise_response_errors (true)
312
+ # Defaults to `true`, raises errors if exist when #wait or #join! is called upon async response.
313
+ #
314
+ # @option options [Integer] :read_chunk_size (1024)
315
+ #
316
+ # @option options [String] :ssl_ca_bundle
317
+ # Full path to the SSL certificate authority bundle file that should be used when
318
+ # verifying peer certificates. If you do not pass `:ssl_ca_directory` or `:ssl_ca_bundle`
319
+ # the system default will be used if available.
320
+ #
321
+ # @option options [String] :ssl_ca_directory
322
+ # Full path of the directory that contains the unbundled SSL certificate authority
323
+ # files for verifying peer certificates. If you do not pass `:ssl_ca_bundle` or
324
+ # `:ssl_ca_directory` the system default will be used if available.
325
+ #
326
+ # @option options [String] :ssl_ca_store
327
+ #
328
+ # @option options [Boolean] :ssl_verify_peer (true)
329
+ # When `true`, SSL peer certificates are verified when establishing a connection.
330
+ #
331
+ def initialize(*args)
332
+ unless Kernel.const_defined?("HTTP2")
333
+ raise "Must include http/2 gem to use AsyncClient instances."
334
+ end
335
+ super
336
+ end
337
+
338
+ # @!group API Operations
339
+
340
+ # Starts or continues a streaming Amazon Q Business conversation.
341
+ #
342
+ # @option params [required, String] :application_id
343
+ # The identifier of the Amazon Q Business application linked to a
344
+ # streaming Amazon Q Business conversation.
345
+ #
346
+ # @option params [String] :user_id
347
+ # The identifier of the user attached to the chat input.
348
+ #
349
+ # @option params [Array<String>] :user_groups
350
+ # The groups that a user associated with the chat input belongs to.
351
+ #
352
+ # @option params [String] :conversation_id
353
+ # The identifier of the Amazon Q Business conversation.
354
+ #
355
+ # @option params [String] :parent_message_id
356
+ # The identifier used to associate a user message with a AI generated
357
+ # response.
358
+ #
359
+ # @option params [String] :client_token
360
+ # A token that you provide to identify the chat input.
361
+ #
362
+ # **A suitable default value is auto-generated.** You should normally
363
+ # not need to pass this option.**
364
+ #
365
+ # @return [Types::ChatOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
366
+ #
367
+ # * {Types::ChatOutput#output_stream #output_stream} => Types::ChatOutputStream
368
+ #
369
+ # @example Bi-directional EventStream Operation Example
370
+ #
371
+ # You can signal input events after the initial request is established. Events
372
+ # will be sent to the stream immediately once the stream connection is
373
+ # established successfully.
374
+ #
375
+ # To signal events, you can call the #signal methods from an Aws::QBusiness::EventStreams::ChatInputStream
376
+ # object. You must signal events before calling #wait or #join! on the async response.
377
+ #
378
+ # input_stream = Aws::QBusiness::EventStreams::ChatInputStream.new
379
+ #
380
+ # async_resp = client.chat(
381
+ # # params input
382
+ # input_event_stream_handler: input_stream) do |out_stream|
383
+ #
384
+ # # register callbacks for events
385
+ # out_stream.on_text_event_event do |event|
386
+ # event # => Aws::QBusiness::Types::textEvent
387
+ # end
388
+ # out_stream.on_metadata_event_event do |event|
389
+ # event # => Aws::QBusiness::Types::metadataEvent
390
+ # end
391
+ # out_stream.on_action_review_event_event do |event|
392
+ # event # => Aws::QBusiness::Types::actionReviewEvent
393
+ # end
394
+ # out_stream.on_failed_attachment_event_event do |event|
395
+ # event # => Aws::QBusiness::Types::failedAttachmentEvent
396
+ # end
397
+ # out_stream.on_auth_challenge_request_event_event do |event|
398
+ # event # => Aws::QBusiness::Types::authChallengeRequestEvent
399
+ # end
400
+ #
401
+ # end
402
+ # # => Aws::Seahorse::Client::AsyncResponse
403
+ #
404
+ # # signal events
405
+ # input_stream.signal_configuration_event_event( ... )
406
+ # input_stream.signal_text_event_event( ... )
407
+ # input_stream.signal_attachment_event_event( ... )
408
+ # input_stream.signal_action_execution_event_event( ... )
409
+ # input_stream.signal_end_of_input_event_event( ... )
410
+ # input_stream.signal_auth_challenge_response_event_event( ... )
411
+ #
412
+ # # make sure to signal :end_stream at the end
413
+ # input_stream.signal_end_stream
414
+ #
415
+ # # wait until stream is closed before finalizing the sync response
416
+ # resp = async_resp.wait
417
+ # # Or close the stream and finalize sync response immediately
418
+ # # resp = async_resp.join!
419
+ #
420
+ # You can also provide an Aws::QBusiness::EventStreams::ChatOutputStream object to register callbacks
421
+ # before initializing the request instead of processing from the request block.
422
+ #
423
+ # output_stream = Aws::QBusiness::EventStreams::ChatOutputStream.new
424
+ # # register callbacks for output events
425
+ # output_stream.on_text_event_event do |event|
426
+ # event # => Aws::QBusiness::Types::textEvent
427
+ # end
428
+ # output_stream.on_metadata_event_event do |event|
429
+ # event # => Aws::QBusiness::Types::metadataEvent
430
+ # end
431
+ # output_stream.on_action_review_event_event do |event|
432
+ # event # => Aws::QBusiness::Types::actionReviewEvent
433
+ # end
434
+ # output_stream.on_failed_attachment_event_event do |event|
435
+ # event # => Aws::QBusiness::Types::failedAttachmentEvent
436
+ # end
437
+ # output_stream.on_auth_challenge_request_event_event do |event|
438
+ # event # => Aws::QBusiness::Types::authChallengeRequestEvent
439
+ # end
440
+ # output_stream.on_error_event do |event|
441
+ # # catch unmodeled error event in the stream
442
+ # raise event
443
+ # # => Aws::Errors::EventError
444
+ # # event.event_type => :error
445
+ # # event.error_code => String
446
+ # # event.error_message => String
447
+ # end
448
+ #
449
+ # async_resp = client.chat (
450
+ # # params input
451
+ # input_event_stream_handler: input_stream
452
+ # output_event_stream_handler: output_stream
453
+ # )
454
+ #
455
+ # resp = async_resp.join!
456
+ #
457
+ # You can also iterate through events after the response is complete.
458
+ #
459
+ # Events are available at resp.output_stream # => Enumerator
460
+ #
461
+ # @example Request syntax with placeholder values
462
+ #
463
+ # async_resp = async_client.chat({
464
+ # application_id: "ApplicationId", # required
465
+ # user_id: "UserId",
466
+ # user_groups: ["String"],
467
+ # conversation_id: "ConversationId",
468
+ # parent_message_id: "MessageId",
469
+ # client_token: "ClientToken",
470
+ # input_event_stream_hander: EventStreams::ChatInputStream.new,
471
+ # })
472
+ # # => Seahorse::Client::AsyncResponse
473
+ # async_resp.wait
474
+ # # => Seahorse::Client::Response
475
+ # # Or use async_resp.join!
476
+ #
477
+ # @example Response structure
478
+ #
479
+ # All events are available at resp.output_stream:
480
+ # resp.output_stream #=> Enumerator
481
+ # resp.output_stream.event_types #=> [:text_event, :metadata_event, :action_review_event, :failed_attachment_event, :auth_challenge_request_event]
482
+ #
483
+ # For :text_event event available at #on_text_event_event callback and response eventstream enumerator:
484
+ # event.conversation_id #=> String
485
+ # event.user_message_id #=> String
486
+ # event.system_message_id #=> String
487
+ # event.system_message #=> String
488
+ #
489
+ # For :metadata_event event available at #on_metadata_event_event callback and response eventstream enumerator:
490
+ # event.conversation_id #=> String
491
+ # event.user_message_id #=> String
492
+ # event.system_message_id #=> String
493
+ # event.source_attributions #=> Array
494
+ # event.source_attributions[0].title #=> String
495
+ # event.source_attributions[0].snippet #=> String
496
+ # event.source_attributions[0].url #=> String
497
+ # event.source_attributions[0].citation_number #=> Integer
498
+ # event.source_attributions[0].updated_at #=> Time
499
+ # event.source_attributions[0].text_message_segments #=> Array
500
+ # event.source_attributions[0].text_message_segments[0].begin_offset #=> Integer
501
+ # event.source_attributions[0].text_message_segments[0].end_offset #=> Integer
502
+ # event.source_attributions[0].text_message_segments[0].snippet_excerpt.text #=> String
503
+ # event.final_text_message #=> String
504
+ #
505
+ # For :action_review_event event available at #on_action_review_event_event callback and response eventstream enumerator:
506
+ # event.conversation_id #=> String
507
+ # event.user_message_id #=> String
508
+ # event.system_message_id #=> String
509
+ # event.plugin_id #=> String
510
+ # event.plugin_type #=> String, one of "SERVICE_NOW", "SALESFORCE", "JIRA", "ZENDESK", "CUSTOM"
511
+ # event.payload #=> Hash
512
+ # event.payload["ActionPayloadFieldKey"].display_name #=> String
513
+ # event.payload["ActionPayloadFieldKey"].display_order #=> Integer
514
+ # event.payload["ActionPayloadFieldKey"].display_description #=> String
515
+ # event.payload["ActionPayloadFieldKey"].type #=> String, one of "STRING", "NUMBER", "ARRAY", "BOOLEAN"
516
+ # event.payload["ActionPayloadFieldKey"].allowed_values #=> Array
517
+ # event.payload["ActionPayloadFieldKey"].allowed_format #=> String
518
+ # event.payload["ActionPayloadFieldKey"].required #=> Boolean
519
+ # event.payload_field_name_separator #=> String
520
+ #
521
+ # For :failed_attachment_event event available at #on_failed_attachment_event_event callback and response eventstream enumerator:
522
+ # event.conversation_id #=> String
523
+ # event.user_message_id #=> String
524
+ # event.system_message_id #=> String
525
+ # event.attachment.name #=> String
526
+ # event.attachment.status #=> String, one of "FAILED", "SUCCEEDED"
527
+ # event.attachment.error.error_message #=> String
528
+ # event.attachment.error.error_code #=> String, one of "InternalError", "InvalidRequest", "ResourceInactive", "ResourceNotFound"
529
+ #
530
+ # For :auth_challenge_request_event event available at #on_auth_challenge_request_event_event callback and response eventstream enumerator:
531
+ # event.authorization_url #=> String
532
+ #
533
+ # @see http://docs.aws.amazon.com/goto/WebAPI/qbusiness-2023-11-27/Chat AWS API Documentation
534
+ #
535
+ # @overload chat(params = {})
536
+ # @param [Hash] params ({})
537
+ def chat(params = {}, options = {}, &block)
538
+ params = params.dup
539
+ input_event_stream_handler = _event_stream_handler(
540
+ :input,
541
+ params.delete(:input_event_stream_handler),
542
+ EventStreams::ChatInputStream
543
+ )
544
+ output_event_stream_handler = _event_stream_handler(
545
+ :output,
546
+ params.delete(:output_event_stream_handler) || params.delete(:event_stream_handler),
547
+ EventStreams::ChatOutputStream
548
+ )
549
+
550
+ yield(output_event_stream_handler) if block_given?
551
+
552
+ req = build_request(:chat, params)
553
+
554
+ req.context[:input_event_stream_handler] = input_event_stream_handler
555
+ req.handlers.add(Aws::Binary::EncodeHandler, priority: 55)
556
+ req.context[:output_event_stream_handler] = output_event_stream_handler
557
+ req.handlers.add(Aws::Binary::DecodeHandler, priority: 55)
558
+
559
+ req.send_request(options, &block)
560
+ end
561
+
562
+ # @!endgroup
563
+
564
+ # @param params ({})
565
+ # @api private
566
+ def build_request(operation_name, params = {})
567
+ handlers = @handlers.for(operation_name)
568
+ context = Seahorse::Client::RequestContext.new(
569
+ operation_name: operation_name,
570
+ operation: config.api.operation(operation_name),
571
+ client: self,
572
+ params: params,
573
+ http_response: Seahorse::Client::Http::AsyncResponse.new,
574
+ config: config)
575
+ context[:gem_name] = 'aws-sdk-qbusiness'
576
+ context[:gem_version] = '1.6.0'
577
+ Seahorse::Client::Request.new(handlers, context)
578
+ end
579
+
580
+ private
581
+
582
+ def _event_stream_handler(type, handler, event_stream_class)
583
+ case handler
584
+ when event_stream_class then handler
585
+ when Proc then event_stream_class.new.tap(&handler)
586
+ when nil then event_stream_class.new
587
+ else
588
+ msg = "expected #{type}_event_stream_handler to be a block or "\
589
+ "instance of Aws::QBusiness::#{event_stream_class}"\
590
+ ", got `#{handler.inspect}` instead"
591
+ raise ArgumentError, msg
592
+ end
593
+ end
594
+
595
+ class << self
596
+
597
+ # @api private
598
+ attr_reader :identifier
599
+
600
+ # @api private
601
+ def errors_module
602
+ Errors
603
+ end
604
+
605
+ end
606
+ end
607
+ end