pub struct Client { /* private fields */ }
Expand description

Client for Amazon Polly

Client for invoking operations on Amazon Polly. Each operation on Amazon Polly is a method on this this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.

Examples

Constructing a client and invoking an operation

    // create a shared configuration. This can be used & shared between multiple service clients.
    let shared_config = aws_config::load_from_env().await;
    let client = aws_sdk_polly::Client::new(&shared_config);
    // invoke an operation
    /* let rsp = client
        .<operation_name>().
        .<param>("some value")
        .send().await; */

Constructing a client with custom configuration

use aws_config::RetryConfig;
let shared_config = aws_config::load_from_env().await;
let config = aws_sdk_polly::config::Builder::from(&shared_config)
  .retry_config(RetryConfig::disabled())
  .build();
let client = aws_sdk_polly::Client::from_conf(config);

Implementations

Creates a client with the given service configuration.

Returns the client’s configuration.

Constructs a fluent builder for the DeleteLexicon operation.

Constructs a fluent builder for the DescribeVoices operation.

Constructs a fluent builder for the GetLexicon operation.

Constructs a fluent builder for the GetSpeechSynthesisTask operation.

Constructs a fluent builder for the ListLexicons operation.

Constructs a fluent builder for the ListSpeechSynthesisTasks operation. This operation supports pagination; See into_paginator().

Constructs a fluent builder for the PutLexicon operation.

Constructs a fluent builder for the StartSpeechSynthesisTask operation.

Constructs a fluent builder for the SynthesizeSpeech operation.

  • The fluent builder is configurable:
    • engine(Engine) / set_engine(Option<Engine>):

      Specifies the engine (standard or neural) for Amazon Polly to use when processing input text for speech synthesis. For information on Amazon Polly voices and which voices are available in standard-only, NTTS-only, and both standard and NTTS formats, see Available Voices.

      NTTS-only voices

      When using NTTS-only voices such as Kevin (en-US), this parameter is required and must be set to neural. If the engine is not specified, or is set to standard, this will result in an error.

      Type: String

      Valid Values: standard | neural

      Required: Yes

      Standard voices

      For standard voices, this is not required; the engine parameter defaults to standard. If the engine is not specified, or is set to standard and an NTTS-only voice is selected, this will result in an error.

    • language_code(LanguageCode) / set_language_code(Option<LanguageCode>):

      Optional language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).

      If a bilingual voice is used and no language code is specified, Amazon Polly uses the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.

    • lexicon_names(Vec<String>) / set_lexicon_names(Option<Vec<String>>):

      List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. For information about storing lexicons, see PutLexicon.

    • output_format(OutputFormat) / set_output_format(Option<OutputFormat>):

      The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.

      When pcm is used, the content returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.

    • sample_rate(impl Into<String>) / set_sample_rate(Option<String>):

      The audio frequency specified in Hz.

      The valid values for mp3 and ogg_vorbis are “8000”, “16000”, “22050”, and “24000”. The default value for standard voices is “22050”. The default value for neural voices is “24000”.

      Valid values for pcm are “8000” and “16000” The default value is “16000”.

    • speech_mark_types(Vec<SpeechMarkType>) / set_speech_mark_types(Option<Vec<SpeechMarkType>>):

      The type of speech marks returned for the input text.

    • text(impl Into<String>) / set_text(Option<String>):

      Input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.

    • text_type(TextType) / set_text_type(Option<TextType>):

      Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see Using SSML.

    • voice_id(VoiceId) / set_voice_id(Option<VoiceId>):

      Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the DescribeVoices operation.

  • On success, responds with SynthesizeSpeechOutput with field(s):
    • audio_stream(byte_stream::ByteStream):

      Stream containing the synthesized speech.

    • content_type(Option<String>):

      Specifies the type audio stream. This should reflect the OutputFormat parameter in your request.

      • If you request mp3 as the OutputFormat, the ContentType returned is audio/mpeg.

      • If you request ogg_vorbis as the OutputFormat, the ContentType returned is audio/ogg.

      • If you request pcm as the OutputFormat, the ContentType returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.

      • If you request json as the OutputFormat, the ContentType returned is application/x-json-stream.

    • request_characters(i32):

      Number of characters synthesized.

  • On failure, responds with SdkError<SynthesizeSpeechError>

Creates a client with the given service config and connector override.

Creates a new client from a shared config.

Creates a new client from the service Config.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more