Class: Aws::Polly::AsyncClient
- Inherits:
-
Seahorse::Client::AsyncBase
- Object
- Seahorse::Client::AsyncBase
- Aws::Polly::AsyncClient
- Includes:
- AsyncClientStubs
- Defined in:
- lib/aws-sdk-polly/async_client.rb
Overview
An API async client for Polly. To construct an async client, you need to configure a ‘:region` and `:credentials`.
async_client = Aws::Polly::AsyncClient.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
See #initialize for a full list of supported configuration options.
Class Attribute Summary collapse
- .identifier ⇒ Object readonly private
API Operations collapse
-
#start_speech_synthesis_stream(params = {}) ⇒ Types::StartSpeechSynthesisStreamOutput
Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection.
Class Method Summary collapse
- .errors_module ⇒ Object private
Instance Method Summary collapse
- #build_request(operation_name, params = {}) ⇒ Object private
-
#initialize(options) ⇒ AsyncClient
constructor
A new instance of AsyncClient.
Constructor Details
#initialize(options) ⇒ AsyncClient
Returns a new instance of AsyncClient.
403 404 405 406 407 408 |
# File 'lib/aws-sdk-polly/async_client.rb', line 403 def initialize(*args) unless Kernel.const_defined?("HTTP2") raise "Must include http/2 gem to use AsyncClient instances." end super end |
Class Attribute Details
.identifier ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
680 681 682 |
# File 'lib/aws-sdk-polly/async_client.rb', line 680 def identifier @identifier end |
Class Method Details
.errors_module ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
683 684 685 |
# File 'lib/aws-sdk-polly/async_client.rb', line 683 def errors_module Errors end |
Instance Method Details
#build_request(operation_name, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 |
# File 'lib/aws-sdk-polly/async_client.rb', line 643 def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) tracer = config.telemetry_provider.tracer_provider.tracer( Aws::Telemetry.module_to_tracer_name('Aws::Polly') ) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, http_response: Seahorse::Client::Http::AsyncResponse.new, config: config, tracer: tracer ) context[:gem_name] = 'aws-sdk-polly' context[:gem_version] = '1.125.0' Seahorse::Client::Request.new(handlers, context) end |
#start_speech_synthesis_stream(params = {}) ⇒ Types::StartSpeechSynthesisStreamOutput
Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection. Specify synthesis parameters in HTTP/2 headers, send text incrementally as events on the input stream, and receive synthesized audio as it becomes available.
This operation serves as a bidirectional counterpart to ‘SynthesizeSpeech`:
- SynthesizeSpeech][1
^
[1]: docs.aws.amazon.com/polly/latest/API/API_SynthesizeSpeech.html
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
# File 'lib/aws-sdk-polly/async_client.rb', line 614 def start_speech_synthesis_stream(params = {}, = {}, &block) params = params.dup input_event_stream_handler = _event_stream_handler( :input, params.delete(:input_event_stream_handler), EventStreams::StartSpeechSynthesisStreamActionStream ) output_event_stream_handler = _event_stream_handler( :output, params.delete(:output_event_stream_handler) || params.delete(:event_stream_handler), EventStreams::StartSpeechSynthesisStreamEventStream ) yield(output_event_stream_handler) if block_given? req = build_request(:start_speech_synthesis_stream, params) req.context[:input_event_stream_handler] = input_event_stream_handler req.handlers.add(Aws::Binary::EncodeHandler, priority: 55) req.context[:output_event_stream_handler] = output_event_stream_handler req.handlers.add(Aws::Binary::DecodeHandler, priority: 55) req.send_request(, &block) end |