All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.polly.PollyClient Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Polly module holds the client classes that are used for communicating with Amazon Polly.

There is a newer version: 2.29.15
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.polly;

import java.nio.file.Path;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.awscore.AwsClient;
import software.amazon.awssdk.awscore.exception.AwsServiceException;
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.ResponseInputStream;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.sync.ResponseTransformer;
import software.amazon.awssdk.regions.ServiceMetadata;
import software.amazon.awssdk.services.polly.model.DeleteLexiconRequest;
import software.amazon.awssdk.services.polly.model.DeleteLexiconResponse;
import software.amazon.awssdk.services.polly.model.DescribeVoicesRequest;
import software.amazon.awssdk.services.polly.model.DescribeVoicesResponse;
import software.amazon.awssdk.services.polly.model.EngineNotSupportedException;
import software.amazon.awssdk.services.polly.model.GetLexiconRequest;
import software.amazon.awssdk.services.polly.model.GetLexiconResponse;
import software.amazon.awssdk.services.polly.model.GetSpeechSynthesisTaskRequest;
import software.amazon.awssdk.services.polly.model.GetSpeechSynthesisTaskResponse;
import software.amazon.awssdk.services.polly.model.InvalidLexiconException;
import software.amazon.awssdk.services.polly.model.InvalidNextTokenException;
import software.amazon.awssdk.services.polly.model.InvalidS3BucketException;
import software.amazon.awssdk.services.polly.model.InvalidS3KeyException;
import software.amazon.awssdk.services.polly.model.InvalidSampleRateException;
import software.amazon.awssdk.services.polly.model.InvalidSnsTopicArnException;
import software.amazon.awssdk.services.polly.model.InvalidSsmlException;
import software.amazon.awssdk.services.polly.model.InvalidTaskIdException;
import software.amazon.awssdk.services.polly.model.LanguageNotSupportedException;
import software.amazon.awssdk.services.polly.model.LexiconNotFoundException;
import software.amazon.awssdk.services.polly.model.LexiconSizeExceededException;
import software.amazon.awssdk.services.polly.model.ListLexiconsRequest;
import software.amazon.awssdk.services.polly.model.ListLexiconsResponse;
import software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest;
import software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse;
import software.amazon.awssdk.services.polly.model.MarksNotSupportedForFormatException;
import software.amazon.awssdk.services.polly.model.MaxLexemeLengthExceededException;
import software.amazon.awssdk.services.polly.model.MaxLexiconsNumberExceededException;
import software.amazon.awssdk.services.polly.model.PollyException;
import software.amazon.awssdk.services.polly.model.PutLexiconRequest;
import software.amazon.awssdk.services.polly.model.PutLexiconResponse;
import software.amazon.awssdk.services.polly.model.ServiceFailureException;
import software.amazon.awssdk.services.polly.model.SsmlMarksNotSupportedForTextTypeException;
import software.amazon.awssdk.services.polly.model.StartSpeechSynthesisTaskRequest;
import software.amazon.awssdk.services.polly.model.StartSpeechSynthesisTaskResponse;
import software.amazon.awssdk.services.polly.model.SynthesisTaskNotFoundException;
import software.amazon.awssdk.services.polly.model.SynthesizeSpeechRequest;
import software.amazon.awssdk.services.polly.model.SynthesizeSpeechResponse;
import software.amazon.awssdk.services.polly.model.TextLengthExceededException;
import software.amazon.awssdk.services.polly.model.UnsupportedPlsAlphabetException;
import software.amazon.awssdk.services.polly.model.UnsupportedPlsLanguageException;
import software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable;

/**
 * Service client for accessing Amazon Polly. This can be created using the static {@link #builder()} method.
 *
 * 

* Amazon Polly is a web service that makes it easy to synthesize speech from text. *

*

* The Amazon Polly service provides API operations for synthesizing high-quality speech from plain text and Speech * Synthesis Markup Language (SSML), along with managing pronunciations lexicons that enable you to get the best results * for your application domain. *

*/ @Generated("software.amazon.awssdk:codegen") @SdkPublicApi @ThreadSafe public interface PollyClient extends AwsClient { String SERVICE_NAME = "polly"; /** * Value for looking up the service's metadata from the * {@link software.amazon.awssdk.regions.ServiceMetadataProvider}. */ String SERVICE_METADATA_ID = "polly"; /** *

* Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been * deleted is not available for speech synthesis, nor is it possible to retrieve it using either the * GetLexicon or ListLexicon APIs. *

*

* For more information, see Managing * Lexicons. *

* * @param deleteLexiconRequest * @return Result of the DeleteLexicon operation returned by the service. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.DeleteLexicon * @see AWS API * Documentation */ default DeleteLexiconResponse deleteLexicon(DeleteLexiconRequest deleteLexiconRequest) throws LexiconNotFoundException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { throw new UnsupportedOperationException(); } /** *

* Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been * deleted is not available for speech synthesis, nor is it possible to retrieve it using either the * GetLexicon or ListLexicon APIs. *

*

* For more information, see Managing * Lexicons. *

*
*

* This is a convenience which creates an instance of the {@link DeleteLexiconRequest.Builder} avoiding the need to * create one manually via {@link DeleteLexiconRequest#builder()} *

* * @param deleteLexiconRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.DeleteLexiconRequest.Builder} to create a request. * @return Result of the DeleteLexicon operation returned by the service. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.DeleteLexicon * @see AWS API * Documentation */ default DeleteLexiconResponse deleteLexicon(Consumer deleteLexiconRequest) throws LexiconNotFoundException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return deleteLexicon(DeleteLexiconRequest.builder().applyMutation(deleteLexiconRequest).build()); } /** *

* Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a * specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice * name. *

*

* When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from * the list of voices returned by DescribeVoices. *

*

* For example, you want your news reader application to read news in a specific language, but giving a user the * option to choose the voice. Using the DescribeVoices operation you can provide the user with a list * of available voices to select from. *

*

* You can optionally specify a language code to filter the available voices. For example, if you specify * en-US, the operation returns a list of all available US English voices. *

*

* This operation requires permissions to perform the polly:DescribeVoices action. *

* * @param describeVoicesRequest * @return Result of the DescribeVoices operation returned by the service. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.DescribeVoices * @see AWS API * Documentation */ default DescribeVoicesResponse describeVoices(DescribeVoicesRequest describeVoicesRequest) throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { throw new UnsupportedOperationException(); } /** *

* Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a * specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice * name. *

*

* When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from * the list of voices returned by DescribeVoices. *

*

* For example, you want your news reader application to read news in a specific language, but giving a user the * option to choose the voice. Using the DescribeVoices operation you can provide the user with a list * of available voices to select from. *

*

* You can optionally specify a language code to filter the available voices. For example, if you specify * en-US, the operation returns a list of all available US English voices. *

*

* This operation requires permissions to perform the polly:DescribeVoices action. *

*
*

* This is a convenience which creates an instance of the {@link DescribeVoicesRequest.Builder} avoiding the need to * create one manually via {@link DescribeVoicesRequest#builder()} *

* * @param describeVoicesRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.DescribeVoicesRequest.Builder} to create a request. * @return Result of the DescribeVoices operation returned by the service. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.DescribeVoices * @see AWS API * Documentation */ default DescribeVoicesResponse describeVoices(Consumer describeVoicesRequest) throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return describeVoices(DescribeVoicesRequest.builder().applyMutation(describeVoicesRequest).build()); } /** *

* Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a * specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice * name. *

*

* When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from * the list of voices returned by DescribeVoices. *

*

* For example, you want your news reader application to read news in a specific language, but giving a user the * option to choose the voice. Using the DescribeVoices operation you can provide the user with a list * of available voices to select from. *

*

* You can optionally specify a language code to filter the available voices. For example, if you specify * en-US, the operation returns a list of all available US English voices. *

*

* This operation requires permissions to perform the polly:DescribeVoices action. *

* * @return Result of the DescribeVoices operation returned by the service. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.DescribeVoices * @see #describeVoices(DescribeVoicesRequest) * @see AWS API * Documentation */ default DescribeVoicesResponse describeVoices() throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return describeVoices(DescribeVoicesRequest.builder().build()); } /** *

* Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more * information, see Managing * Lexicons. *

* * @param getLexiconRequest * @return Result of the GetLexicon operation returned by the service. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.GetLexicon * @see AWS API * Documentation */ default GetLexiconResponse getLexicon(GetLexiconRequest getLexiconRequest) throws LexiconNotFoundException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { throw new UnsupportedOperationException(); } /** *

* Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more * information, see Managing * Lexicons. *

*
*

* This is a convenience which creates an instance of the {@link GetLexiconRequest.Builder} avoiding the need to * create one manually via {@link GetLexiconRequest#builder()} *

* * @param getLexiconRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.GetLexiconRequest.Builder} to create a request. * @return Result of the GetLexicon operation returned by the service. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.GetLexicon * @see AWS API * Documentation */ default GetLexiconResponse getLexicon(Consumer getLexiconRequest) throws LexiconNotFoundException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return getLexicon(GetLexiconRequest.builder().applyMutation(getLexiconRequest).build()); } /** *

* Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the * given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output * of the task. *

* * @param getSpeechSynthesisTaskRequest * @return Result of the GetSpeechSynthesisTask operation returned by the service. * @throws InvalidTaskIdException * The provided Task ID is not valid. Please provide a valid Task ID and try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SynthesisTaskNotFoundException * The Speech Synthesis task with requested Task ID cannot be found. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.GetSpeechSynthesisTask * @see AWS * API Documentation */ default GetSpeechSynthesisTaskResponse getSpeechSynthesisTask(GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest) throws InvalidTaskIdException, ServiceFailureException, SynthesisTaskNotFoundException, AwsServiceException, SdkClientException, PollyException { throw new UnsupportedOperationException(); } /** *

* Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the * given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output * of the task. *

*
*

* This is a convenience which creates an instance of the {@link GetSpeechSynthesisTaskRequest.Builder} avoiding the * need to create one manually via {@link GetSpeechSynthesisTaskRequest#builder()} *

* * @param getSpeechSynthesisTaskRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.GetSpeechSynthesisTaskRequest.Builder} to create a * request. * @return Result of the GetSpeechSynthesisTask operation returned by the service. * @throws InvalidTaskIdException * The provided Task ID is not valid. Please provide a valid Task ID and try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SynthesisTaskNotFoundException * The Speech Synthesis task with requested Task ID cannot be found. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.GetSpeechSynthesisTask * @see AWS * API Documentation */ default GetSpeechSynthesisTaskResponse getSpeechSynthesisTask( Consumer getSpeechSynthesisTaskRequest) throws InvalidTaskIdException, ServiceFailureException, SynthesisTaskNotFoundException, AwsServiceException, SdkClientException, PollyException { return getSpeechSynthesisTask(GetSpeechSynthesisTaskRequest.builder().applyMutation(getSpeechSynthesisTaskRequest) .build()); } /** *

* Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons. *

* * @param listLexiconsRequest * @return Result of the ListLexicons operation returned by the service. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.ListLexicons * @see AWS API * Documentation */ default ListLexiconsResponse listLexicons(ListLexiconsRequest listLexiconsRequest) throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { throw new UnsupportedOperationException(); } /** *

* Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons. *

*
*

* This is a convenience which creates an instance of the {@link ListLexiconsRequest.Builder} avoiding the need to * create one manually via {@link ListLexiconsRequest#builder()} *

* * @param listLexiconsRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.ListLexiconsRequest.Builder} to create a request. * @return Result of the ListLexicons operation returned by the service. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.ListLexicons * @see AWS API * Documentation */ default ListLexiconsResponse listLexicons(Consumer listLexiconsRequest) throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return listLexicons(ListLexiconsRequest.builder().applyMutation(listLexiconsRequest).build()); } /** *

* Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons. *

* * @return Result of the ListLexicons operation returned by the service. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.ListLexicons * @see #listLexicons(ListLexiconsRequest) * @see AWS API * Documentation */ default ListLexiconsResponse listLexicons() throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return listLexicons(ListLexiconsRequest.builder().build()); } /** *

* Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks * by their status, for example, allowing users to list only tasks that are completed. *

* * @param listSpeechSynthesisTasksRequest * @return Result of the ListSpeechSynthesisTasks operation returned by the service. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.ListSpeechSynthesisTasks * @see AWS API Documentation */ default ListSpeechSynthesisTasksResponse listSpeechSynthesisTasks( ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { throw new UnsupportedOperationException(); } /** *

* Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks * by their status, for example, allowing users to list only tasks that are completed. *

*
*

* This is a convenience which creates an instance of the {@link ListSpeechSynthesisTasksRequest.Builder} avoiding * the need to create one manually via {@link ListSpeechSynthesisTasksRequest#builder()} *

* * @param listSpeechSynthesisTasksRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest.Builder} to create a * request. * @return Result of the ListSpeechSynthesisTasks operation returned by the service. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.ListSpeechSynthesisTasks * @see AWS API Documentation */ default ListSpeechSynthesisTasksResponse listSpeechSynthesisTasks( Consumer listSpeechSynthesisTasksRequest) throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return listSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest.builder().applyMutation(listSpeechSynthesisTasksRequest) .build()); } /** *

* Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks * by their status, for example, allowing users to list only tasks that are completed. *

* * @return Result of the ListSpeechSynthesisTasks operation returned by the service. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.ListSpeechSynthesisTasks * @see #listSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest) * @see AWS API Documentation */ default ListSpeechSynthesisTasksResponse listSpeechSynthesisTasks() throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return listSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest.builder().build()); } /** *

* This is a variant of * {@link #listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable responses = client.listSpeechSynthesisTasksPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable responses = client
     *             .listSpeechSynthesisTasksPaginator(request);
     *     for (software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable responses = client.listSpeechSynthesisTasksPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of MaxResults won't limit the number of results you get with the * paginator. It only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)} * operation. *

* * @return A custom iterable that can be used to iterate through all the response pages. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.ListSpeechSynthesisTasks * @see #listSpeechSynthesisTasksPaginator(ListSpeechSynthesisTasksRequest) * @see AWS API Documentation */ default ListSpeechSynthesisTasksIterable listSpeechSynthesisTasksPaginator() throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return listSpeechSynthesisTasksPaginator(ListSpeechSynthesisTasksRequest.builder().build()); } /** *

* This is a variant of * {@link #listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable responses = client.listSpeechSynthesisTasksPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable responses = client
     *             .listSpeechSynthesisTasksPaginator(request);
     *     for (software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable responses = client.listSpeechSynthesisTasksPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of MaxResults won't limit the number of results you get with the * paginator. It only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)} * operation. *

* * @param listSpeechSynthesisTasksRequest * @return A custom iterable that can be used to iterate through all the response pages. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.ListSpeechSynthesisTasks * @see AWS API Documentation */ default ListSpeechSynthesisTasksIterable listSpeechSynthesisTasksPaginator( ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return new ListSpeechSynthesisTasksIterable(this, listSpeechSynthesisTasksRequest); } /** *

* This is a variant of * {@link #listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)} * operation. The return type is a custom iterable that can be used to iterate through all the pages. SDK will * internally handle making service calls for you. *

*

* When this operation is called, a custom iterable is returned but no service calls are made yet. So there is no * guarantee that the request is valid. As you iterate through the iterable, SDK will start lazily loading response * pages by making service calls until there are no pages left or your iteration stops. If there are errors in your * request, you will see the failures only after you start iterating through the iterable. *

* *

* The following are few ways to iterate through the response pages: *

* 1) Using a Stream * *
     * {@code
     * software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable responses = client.listSpeechSynthesisTasksPaginator(request);
     * responses.stream().forEach(....);
     * }
     * 
* * 2) Using For loop * *
     * {
     *     @code
     *     software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable responses = client
     *             .listSpeechSynthesisTasksPaginator(request);
     *     for (software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response : responses) {
     *         // do something;
     *     }
     * }
     * 
* * 3) Use iterator directly * *
     * {@code
     * software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksIterable responses = client.listSpeechSynthesisTasksPaginator(request);
     * responses.iterator().forEachRemaining(....);
     * }
     * 
*

* Please notice that the configuration of MaxResults won't limit the number of results you get with the * paginator. It only limits the number of results in each page. *

*

* Note: If you prefer to have control on service calls, use the * {@link #listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)} * operation. *

*
*

* This is a convenience which creates an instance of the {@link ListSpeechSynthesisTasksRequest.Builder} avoiding * the need to create one manually via {@link ListSpeechSynthesisTasksRequest#builder()} *

* * @param listSpeechSynthesisTasksRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest.Builder} to create a * request. * @return A custom iterable that can be used to iterate through all the response pages. * @throws InvalidNextTokenException * The NextToken is invalid. Verify that it's spelled correctly, and then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.ListSpeechSynthesisTasks * @see AWS API Documentation */ default ListSpeechSynthesisTasksIterable listSpeechSynthesisTasksPaginator( Consumer listSpeechSynthesisTasksRequest) throws InvalidNextTokenException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return listSpeechSynthesisTasksPaginator(ListSpeechSynthesisTasksRequest.builder() .applyMutation(listSpeechSynthesisTasksRequest).build()); } /** *

* Stores a pronunciation lexicon in an Amazon Web Services Region. If a lexicon with the same name already exists * in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it * might take some time before the lexicon is available to the SynthesizeSpeech operation. *

*

* For more information, see Managing * Lexicons. *

* * @param putLexiconRequest * @return Result of the PutLexicon operation returned by the service. * @throws InvalidLexiconException * Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled correctly, and * then try again. * @throws UnsupportedPlsAlphabetException * The alphabet specified by the lexicon is not a supported alphabet. Valid values are x-sampa * and ipa. * @throws UnsupportedPlsLanguageException * The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes. * @throws LexiconSizeExceededException * The maximum size of the specified lexicon would be exceeded by this operation. * @throws MaxLexemeLengthExceededException * The maximum size of the lexeme would be exceeded by this operation. * @throws MaxLexiconsNumberExceededException * The maximum number of lexicons would be exceeded by this operation. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.PutLexicon * @see AWS API * Documentation */ default PutLexiconResponse putLexicon(PutLexiconRequest putLexiconRequest) throws InvalidLexiconException, UnsupportedPlsAlphabetException, UnsupportedPlsLanguageException, LexiconSizeExceededException, MaxLexemeLengthExceededException, MaxLexiconsNumberExceededException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { throw new UnsupportedOperationException(); } /** *

* Stores a pronunciation lexicon in an Amazon Web Services Region. If a lexicon with the same name already exists * in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it * might take some time before the lexicon is available to the SynthesizeSpeech operation. *

*

* For more information, see Managing * Lexicons. *

*
*

* This is a convenience which creates an instance of the {@link PutLexiconRequest.Builder} avoiding the need to * create one manually via {@link PutLexiconRequest#builder()} *

* * @param putLexiconRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.PutLexiconRequest.Builder} to create a request. * @return Result of the PutLexicon operation returned by the service. * @throws InvalidLexiconException * Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled correctly, and * then try again. * @throws UnsupportedPlsAlphabetException * The alphabet specified by the lexicon is not a supported alphabet. Valid values are x-sampa * and ipa. * @throws UnsupportedPlsLanguageException * The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes. * @throws LexiconSizeExceededException * The maximum size of the specified lexicon would be exceeded by this operation. * @throws MaxLexemeLengthExceededException * The maximum size of the lexeme would be exceeded by this operation. * @throws MaxLexiconsNumberExceededException * The maximum number of lexicons would be exceeded by this operation. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.PutLexicon * @see AWS API * Documentation */ default PutLexiconResponse putLexicon(Consumer putLexiconRequest) throws InvalidLexiconException, UnsupportedPlsAlphabetException, UnsupportedPlsLanguageException, LexiconSizeExceededException, MaxLexemeLengthExceededException, MaxLexiconsNumberExceededException, ServiceFailureException, AwsServiceException, SdkClientException, PollyException { return putLexicon(PutLexiconRequest.builder().applyMutation(putLexiconRequest).build()); } /** *

* Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This * operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket * for the service to store the output of the synthesis task and two optional parameters ( * OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation * will return a SpeechSynthesisTask object, which will include an identifier of this task as well as * the current status. The SpeechSynthesisTask object is available for 72 hours after starting the * asynchronous synthesis task. *

* * @param startSpeechSynthesisTaskRequest * @return Result of the StartSpeechSynthesisTask operation returned by the service. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidS3BucketException * The provided Amazon S3 bucket name is invalid. Please check your input with S3 bucket naming requirements * and try again. * @throws InvalidS3KeyException * The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object key name. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSnsTopicArnException * The provided SNS topic ARN is invalid. Please provide a valid SNS topic ARN and try again. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.StartSpeechSynthesisTask * @see AWS API Documentation */ default StartSpeechSynthesisTaskResponse startSpeechSynthesisTask( StartSpeechSynthesisTaskRequest startSpeechSynthesisTaskRequest) throws TextLengthExceededException, InvalidS3BucketException, InvalidS3KeyException, InvalidSampleRateException, InvalidSnsTopicArnException, InvalidSsmlException, EngineNotSupportedException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, AwsServiceException, SdkClientException, PollyException { throw new UnsupportedOperationException(); } /** *

* Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This * operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket * for the service to store the output of the synthesis task and two optional parameters ( * OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation * will return a SpeechSynthesisTask object, which will include an identifier of this task as well as * the current status. The SpeechSynthesisTask object is available for 72 hours after starting the * asynchronous synthesis task. *

*
*

* This is a convenience which creates an instance of the {@link StartSpeechSynthesisTaskRequest.Builder} avoiding * the need to create one manually via {@link StartSpeechSynthesisTaskRequest#builder()} *

* * @param startSpeechSynthesisTaskRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.StartSpeechSynthesisTaskRequest.Builder} to create a * request. * @return Result of the StartSpeechSynthesisTask operation returned by the service. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidS3BucketException * The provided Amazon S3 bucket name is invalid. Please check your input with S3 bucket naming requirements * and try again. * @throws InvalidS3KeyException * The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object key name. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSnsTopicArnException * The provided SNS topic ARN is invalid. Please provide a valid SNS topic ARN and try again. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.StartSpeechSynthesisTask * @see AWS API Documentation */ default StartSpeechSynthesisTaskResponse startSpeechSynthesisTask( Consumer startSpeechSynthesisTaskRequest) throws TextLengthExceededException, InvalidS3BucketException, InvalidS3KeyException, InvalidSampleRateException, InvalidSnsTopicArnException, InvalidSsmlException, EngineNotSupportedException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, AwsServiceException, SdkClientException, PollyException { return startSpeechSynthesisTask(StartSpeechSynthesisTaskRequest.builder().applyMutation(startSpeechSynthesisTaskRequest) .build()); } /** *

* Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. * Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by * English voices) unless phoneme mapping is used. For more information, see How it Works. *

* * @param synthesizeSpeechRequest * @param responseTransformer * Functional interface for processing the streamed response content. The unmarshalled * SynthesizeSpeechResponse and an InputStream to the response content are provided as parameters to the * callback. The callback may return a transformed type which will be the return value of this method. See * {@link software.amazon.awssdk.core.sync.ResponseTransformer} for details on implementing this interface * and for links to pre-canned implementations for common scenarios like downloading to a file. The service * documentation for the response content is as follows ' *

* Stream containing the synthesized speech. *

* '. * @return The transformed result of the ResponseTransformer. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.SynthesizeSpeech * @see AWS API * Documentation */ default ReturnT synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest, ResponseTransformer responseTransformer) throws TextLengthExceededException, InvalidSampleRateException, InvalidSsmlException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, EngineNotSupportedException, AwsServiceException, SdkClientException, PollyException { throw new UnsupportedOperationException(); } /** *

* Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. * Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by * English voices) unless phoneme mapping is used. For more information, see How it Works. *

*
*

* This is a convenience which creates an instance of the {@link SynthesizeSpeechRequest.Builder} avoiding the need * to create one manually via {@link SynthesizeSpeechRequest#builder()} *

* * @param synthesizeSpeechRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.SynthesizeSpeechRequest.Builder} to create a request. * @param responseTransformer * Functional interface for processing the streamed response content. The unmarshalled * SynthesizeSpeechResponse and an InputStream to the response content are provided as parameters to the * callback. The callback may return a transformed type which will be the return value of this method. See * {@link software.amazon.awssdk.core.sync.ResponseTransformer} for details on implementing this interface * and for links to pre-canned implementations for common scenarios like downloading to a file. The service * documentation for the response content is as follows ' *

* Stream containing the synthesized speech. *

* '. * @return The transformed result of the ResponseTransformer. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.SynthesizeSpeech * @see AWS API * Documentation */ default ReturnT synthesizeSpeech(Consumer synthesizeSpeechRequest, ResponseTransformer responseTransformer) throws TextLengthExceededException, InvalidSampleRateException, InvalidSsmlException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, EngineNotSupportedException, AwsServiceException, SdkClientException, PollyException { return synthesizeSpeech(SynthesizeSpeechRequest.builder().applyMutation(synthesizeSpeechRequest).build(), responseTransformer); } /** *

* Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. * Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by * English voices) unless phoneme mapping is used. For more information, see How it Works. *

* * @param synthesizeSpeechRequest * @param destinationPath * {@link Path} to file that response contents will be written to. The file must not exist or this method * will throw an exception. If the file is not writable by the current user then an exception will be thrown. * The service documentation for the response content is as follows ' *

* Stream containing the synthesized speech. *

* '. * @return The transformed result of the ResponseTransformer. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.SynthesizeSpeech * @see #synthesizeSpeech(SynthesizeSpeechRequest, ResponseTransformer) * @see AWS API * Documentation */ default SynthesizeSpeechResponse synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest, Path destinationPath) throws TextLengthExceededException, InvalidSampleRateException, InvalidSsmlException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, EngineNotSupportedException, AwsServiceException, SdkClientException, PollyException { return synthesizeSpeech(synthesizeSpeechRequest, ResponseTransformer.toFile(destinationPath)); } /** *

* Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. * Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by * English voices) unless phoneme mapping is used. For more information, see How it Works. *

*
*

* This is a convenience which creates an instance of the {@link SynthesizeSpeechRequest.Builder} avoiding the need * to create one manually via {@link SynthesizeSpeechRequest#builder()} *

* * @param synthesizeSpeechRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.SynthesizeSpeechRequest.Builder} to create a request. * @param destinationPath * {@link Path} to file that response contents will be written to. The file must not exist or this method * will throw an exception. If the file is not writable by the current user then an exception will be thrown. * The service documentation for the response content is as follows ' *

* Stream containing the synthesized speech. *

* '. * @return The transformed result of the ResponseTransformer. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.SynthesizeSpeech * @see #synthesizeSpeech(SynthesizeSpeechRequest, ResponseTransformer) * @see AWS API * Documentation */ default SynthesizeSpeechResponse synthesizeSpeech(Consumer synthesizeSpeechRequest, Path destinationPath) throws TextLengthExceededException, InvalidSampleRateException, InvalidSsmlException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, EngineNotSupportedException, AwsServiceException, SdkClientException, PollyException { return synthesizeSpeech(SynthesizeSpeechRequest.builder().applyMutation(synthesizeSpeechRequest).build(), destinationPath); } /** *

* Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. * Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by * English voices) unless phoneme mapping is used. For more information, see How it Works. *

* * @param synthesizeSpeechRequest * @return A {@link ResponseInputStream} containing data streamed from service. Note that this is an unmanaged * reference to the underlying HTTP connection so great care must be taken to ensure all data if fully read * from the input stream and that it is properly closed. Failure to do so may result in sub-optimal behavior * and exhausting connections in the connection pool. The unmarshalled response object can be obtained via * {@link ResponseInputStream#response()}. The service documentation for the response content is as follows * ' *

* Stream containing the synthesized speech. *

* '. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.SynthesizeSpeech * @see #getObject(synthesizeSpeech, ResponseTransformer) * @see AWS API * Documentation */ default ResponseInputStream synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest) throws TextLengthExceededException, InvalidSampleRateException, InvalidSsmlException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, EngineNotSupportedException, AwsServiceException, SdkClientException, PollyException { return synthesizeSpeech(synthesizeSpeechRequest, ResponseTransformer.toInputStream()); } /** *

* Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. * Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by * English voices) unless phoneme mapping is used. For more information, see How it Works. *

*
*

* This is a convenience which creates an instance of the {@link SynthesizeSpeechRequest.Builder} avoiding the need * to create one manually via {@link SynthesizeSpeechRequest#builder()} *

* * @param synthesizeSpeechRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.SynthesizeSpeechRequest.Builder} to create a request. * @return A {@link ResponseInputStream} containing data streamed from service. Note that this is an unmanaged * reference to the underlying HTTP connection so great care must be taken to ensure all data if fully read * from the input stream and that it is properly closed. Failure to do so may result in sub-optimal behavior * and exhausting connections in the connection pool. The unmarshalled response object can be obtained via * {@link ResponseInputStream#response()}. The service documentation for the response content is as follows * ' *

* Stream containing the synthesized speech. *

* '. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.SynthesizeSpeech * @see #getObject(synthesizeSpeech, ResponseTransformer) * @see AWS API * Documentation */ default ResponseInputStream synthesizeSpeech( Consumer synthesizeSpeechRequest) throws TextLengthExceededException, InvalidSampleRateException, InvalidSsmlException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, EngineNotSupportedException, AwsServiceException, SdkClientException, PollyException { return synthesizeSpeech(SynthesizeSpeechRequest.builder().applyMutation(synthesizeSpeechRequest).build()); } /** *

* Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. * Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by * English voices) unless phoneme mapping is used. For more information, see How it Works. *

* * @param synthesizeSpeechRequest * @return A {@link ResponseBytes} that loads the data streamed from the service into memory and exposes it in * convenient in-memory representations like a byte buffer or string. The unmarshalled response object can * be obtained via {@link ResponseBytes#response()}. The service documentation for the response content is * as follows ' *

* Stream containing the synthesized speech. *

* '. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.SynthesizeSpeech * @see #getObject(synthesizeSpeech, ResponseTransformer) * @see AWS API * Documentation */ default ResponseBytes synthesizeSpeechAsBytes(SynthesizeSpeechRequest synthesizeSpeechRequest) throws TextLengthExceededException, InvalidSampleRateException, InvalidSsmlException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, EngineNotSupportedException, AwsServiceException, SdkClientException, PollyException { return synthesizeSpeech(synthesizeSpeechRequest, ResponseTransformer.toBytes()); } /** *

* Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. * Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by * English voices) unless phoneme mapping is used. For more information, see How it Works. *

*
*

* This is a convenience which creates an instance of the {@link SynthesizeSpeechRequest.Builder} avoiding the need * to create one manually via {@link SynthesizeSpeechRequest#builder()} *

* * @param synthesizeSpeechRequest * A {@link Consumer} that will call methods on * {@link software.amazon.awssdk.services.polly.model.SynthesizeSpeechRequest.Builder} to create a request. * @return A {@link ResponseBytes} that loads the data streamed from the service into memory and exposes it in * convenient in-memory representations like a byte buffer or string. The unmarshalled response object can * be obtained via {@link ResponseBytes#response()}. The service documentation for the response content is * as follows ' *

* Stream containing the synthesized speech. *

* '. * @throws TextLengthExceededException * The value of the "Text" parameter is longer than the accepted limits. For the * SynthesizeSpeech API, the limit for input text is a maximum of 6000 characters total, of * which no more than 3000 can be billed characters. For the StartSpeechSynthesisTask API, the * maximum is 200,000 characters, of which no more than 100,000 can be billed characters. SSML tags are not * counted as billed characters. * @throws InvalidSampleRateException * The specified sample rate is not valid. * @throws InvalidSsmlException * The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try * again. * @throws LexiconNotFoundException * Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its * name is misspelled or specifying a lexicon that is in a different region.

*

* Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name * is spelled correctly. Then try again. * @throws ServiceFailureException * An unknown condition has caused a service failure. * @throws MarksNotSupportedForFormatException * Speech marks are not supported for the OutputFormat selected. Speech marks are only * available for content in json format. * @throws SsmlMarksNotSupportedForTextTypeException * SSML speech marks are not supported for plain text-type input. * @throws LanguageNotSupportedException * The language specified is not currently supported by Amazon Polly in this capacity. * @throws EngineNotSupportedException * This engine is not compatible with the voice that you have designated. Choose a new voice that is * compatible with the engine or change the engine and restart the operation. * @throws SdkException * Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for * catch all scenarios. * @throws SdkClientException * If any client side error occurs such as an IO related failure, failure to get credentials, etc. * @throws PollyException * Base class for all service exceptions. Unknown exceptions will be thrown as an instance of this type. * @sample PollyClient.SynthesizeSpeech * @see #getObject(synthesizeSpeech, ResponseTransformer) * @see AWS API * Documentation */ default ResponseBytes synthesizeSpeechAsBytes( Consumer synthesizeSpeechRequest) throws TextLengthExceededException, InvalidSampleRateException, InvalidSsmlException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, LanguageNotSupportedException, EngineNotSupportedException, AwsServiceException, SdkClientException, PollyException { return synthesizeSpeechAsBytes(SynthesizeSpeechRequest.builder().applyMutation(synthesizeSpeechRequest).build()); } /** * Create a {@link PollyClient} with the region loaded from the * {@link software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain} and credentials loaded from the * {@link software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider}. */ static PollyClient create() { return builder().build(); } /** * Create a builder that can be used to configure and create a {@link PollyClient}. */ static PollyClientBuilder builder() { return new DefaultPollyClientBuilder(); } static ServiceMetadata serviceMetadata() { return ServiceMetadata.of(SERVICE_METADATA_ID); } @Override default PollyServiceClientConfiguration serviceClientConfiguration() { throw new UnsupportedOperationException(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy