software.amazon.awssdk.services.polly.PollyAsyncClient Maven / Gradle / Ivy
Show all versions of polly Show documentation
/*
* 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.concurrent.CompletableFuture;
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.core.async.AsyncResponseTransformer;
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.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.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.PutLexiconRequest;
import software.amazon.awssdk.services.polly.model.PutLexiconResponse;
import software.amazon.awssdk.services.polly.model.StartSpeechSynthesisTaskRequest;
import software.amazon.awssdk.services.polly.model.StartSpeechSynthesisTaskResponse;
import software.amazon.awssdk.services.polly.model.SynthesizeSpeechRequest;
import software.amazon.awssdk.services.polly.model.SynthesizeSpeechResponse;
import software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher;
/**
* Service client for accessing Amazon Polly asynchronously. This can be created using the static {@link #builder()}
* method.The asynchronous client performs non-blocking I/O when configured with any {@code SdkAsyncHttpClient}
* supported in the SDK. However, full non-blocking is not guaranteed as the async client may perform blocking calls in
* some cases such as credentials retrieval and endpoint discovery as part of the async API call.
*
*
* 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 PollyAsyncClient 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 A Java Future containing the result of the DeleteLexicon operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.DeleteLexicon
* @see AWS API
* Documentation
*/
default CompletableFuture deleteLexicon(DeleteLexiconRequest deleteLexiconRequest) {
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 A Java Future containing the result of the DeleteLexicon operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.DeleteLexicon
* @see AWS API
* Documentation
*/
default CompletableFuture deleteLexicon(Consumer deleteLexiconRequest) {
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 A Java Future containing the result of the DescribeVoices operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.DescribeVoices
* @see AWS API
* Documentation
*/
default CompletableFuture describeVoices(DescribeVoicesRequest describeVoicesRequest) {
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 A Java Future containing the result of the DescribeVoices operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.DescribeVoices
* @see AWS API
* Documentation
*/
default CompletableFuture describeVoices(Consumer describeVoicesRequest) {
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 A Java Future containing the result of the DescribeVoices operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.DescribeVoices
* @see AWS API
* Documentation
*/
default CompletableFuture describeVoices() {
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 A Java Future containing the result of the GetLexicon operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.GetLexicon
* @see AWS API
* Documentation
*/
default CompletableFuture getLexicon(GetLexiconRequest getLexiconRequest) {
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 A Java Future containing the result of the GetLexicon operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.GetLexicon
* @see AWS API
* Documentation
*/
default CompletableFuture getLexicon(Consumer getLexiconRequest) {
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 A Java Future containing the result of the GetSpeechSynthesisTask operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidTaskIdException The provided Task ID is not valid. Please provide a valid Task ID and try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SynthesisTaskNotFoundException The Speech Synthesis task with requested Task ID cannot be found.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.GetSpeechSynthesisTask
* @see AWS
* API Documentation
*/
default CompletableFuture getSpeechSynthesisTask(
GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest) {
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 A Java Future containing the result of the GetSpeechSynthesisTask operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidTaskIdException The provided Task ID is not valid. Please provide a valid Task ID and try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SynthesisTaskNotFoundException The Speech Synthesis task with requested Task ID cannot be found.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.GetSpeechSynthesisTask
* @see AWS
* API Documentation
*/
default CompletableFuture getSpeechSynthesisTask(
Consumer getSpeechSynthesisTaskRequest) {
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 A Java Future containing the result of the ListLexicons operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.ListLexicons
* @see AWS API
* Documentation
*/
default CompletableFuture listLexicons(ListLexiconsRequest listLexiconsRequest) {
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 A Java Future containing the result of the ListLexicons operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.ListLexicons
* @see AWS API
* Documentation
*/
default CompletableFuture listLexicons(Consumer listLexiconsRequest) {
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 A Java Future containing the result of the ListLexicons operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.ListLexicons
* @see AWS API
* Documentation
*/
default CompletableFuture listLexicons() {
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 A Java Future containing the result of the ListSpeechSynthesisTasks operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.ListSpeechSynthesisTasks
* @see AWS API Documentation
*/
default CompletableFuture listSpeechSynthesisTasks(
ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) {
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 A Java Future containing the result of the ListSpeechSynthesisTasks operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.ListSpeechSynthesisTasks
* @see AWS API Documentation
*/
default CompletableFuture listSpeechSynthesisTasks(
Consumer listSpeechSynthesisTasksRequest) {
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 A Java Future containing the result of the ListSpeechSynthesisTasks operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.ListSpeechSynthesisTasks
* @see AWS API Documentation
*/
default CompletableFuture listSpeechSynthesisTasks() {
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 publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* 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 publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.ListSpeechSynthesisTasks
* @see AWS API Documentation
*/
default ListSpeechSynthesisTasksPublisher listSpeechSynthesisTasksPaginator() {
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 publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* 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 publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.ListSpeechSynthesisTasks
* @see AWS API Documentation
*/
default ListSpeechSynthesisTasksPublisher listSpeechSynthesisTasksPaginator(
ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) {
return new ListSpeechSynthesisTasksPublisher(this, listSpeechSynthesisTasksRequest);
}
/**
*
* This is a variant of
* {@link #listSpeechSynthesisTasks(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksRequest)}
* operation. The return type is a custom publisher that can be subscribed to request a stream of response pages.
* SDK will internally handle making service calls for you.
*
*
* When the operation is called, an instance of this class is returned. At this point, no service calls are made yet
* and so there is no guarantee that the request is valid. If there are errors in your request, you will see the
* failures only after you start streaming the data. The subscribe method should be called as a request to start
* streaming data. For more info, see
* {@link org.reactivestreams.Publisher#subscribe(org.reactivestreams.Subscriber)}. Each call to the subscribe
* method will result in a new {@link org.reactivestreams.Subscription} i.e., a new contract to stream data from the
* starting request.
*
*
*
* The following are few ways to use the response class:
*
* 1) Using the subscribe helper method
*
*
* {@code
* software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
* CompletableFuture future = publisher.subscribe(res -> { // Do something with the response });
* future.get();
* }
*
*
* 2) Using a custom subscriber
*
*
* {@code
* software.amazon.awssdk.services.polly.paginators.ListSpeechSynthesisTasksPublisher publisher = client.listSpeechSynthesisTasksPaginator(request);
* publisher.subscribe(new Subscriber() {
*
* public void onSubscribe(org.reactivestreams.Subscriber subscription) { //... };
*
*
* public void onNext(software.amazon.awssdk.services.polly.model.ListSpeechSynthesisTasksResponse response) { //... };
* });}
*
*
* As the response is a publisher, it can work well with third party reactive streams implementations like RxJava2.
*
* 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 publisher that can be subscribed to request a stream of response pages.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidNextTokenException The NextToken is invalid. Verify that it's spelled correctly, and then try
* again.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.ListSpeechSynthesisTasks
* @see AWS API Documentation
*/
default ListSpeechSynthesisTasksPublisher listSpeechSynthesisTasksPaginator(
Consumer listSpeechSynthesisTasksRequest) {
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 A Java Future containing the result of the PutLexicon operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidLexiconException Amazon Polly can't find the specified lexicon. Verify that the lexicon's name
* is spelled correctly, and then try again.
* - UnsupportedPlsAlphabetException The alphabet specified by the lexicon is not a supported alphabet.
* Valid values are
x-sampa
and ipa
.
* - UnsupportedPlsLanguageException The language specified in the lexicon is unsupported. For a list of
* supported languages, see Lexicon Attributes.
* - LexiconSizeExceededException The maximum size of the specified lexicon would be exceeded by this
* operation.
* - MaxLexemeLengthExceededException The maximum size of the lexeme would be exceeded by this operation.
* - MaxLexiconsNumberExceededException The maximum number of lexicons would be exceeded by this
* operation.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.PutLexicon
* @see AWS API
* Documentation
*/
default CompletableFuture putLexicon(PutLexiconRequest putLexiconRequest) {
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 A Java Future containing the result of the PutLexicon operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - InvalidLexiconException Amazon Polly can't find the specified lexicon. Verify that the lexicon's name
* is spelled correctly, and then try again.
* - UnsupportedPlsAlphabetException The alphabet specified by the lexicon is not a supported alphabet.
* Valid values are
x-sampa
and ipa
.
* - UnsupportedPlsLanguageException The language specified in the lexicon is unsupported. For a list of
* supported languages, see Lexicon Attributes.
* - LexiconSizeExceededException The maximum size of the specified lexicon would be exceeded by this
* operation.
* - MaxLexemeLengthExceededException The maximum size of the lexeme would be exceeded by this operation.
* - MaxLexiconsNumberExceededException The maximum number of lexicons would be exceeded by this
* operation.
* - ServiceFailureException An unknown condition has caused a service failure.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.PutLexicon
* @see AWS API
* Documentation
*/
default CompletableFuture putLexicon(Consumer putLexiconRequest) {
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 A Java Future containing the result of the StartSpeechSynthesisTask operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - InvalidS3BucketException The provided Amazon S3 bucket name is invalid. Please check your input with
* S3 bucket naming requirements and try again.
* - InvalidS3KeyException The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object
* key name.
* - InvalidSampleRateException The specified sample rate is not valid.
* - InvalidSnsTopicArnException The provided SNS topic ARN is invalid. Please provide a valid SNS topic
* ARN and try again.
* - InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and
* values, and then try again.
* - 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.
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormat
* selected. Speech marks are only available for content in json
format.
* - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type
* input.
* - LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in
* this capacity.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.StartSpeechSynthesisTask
* @see AWS API Documentation
*/
default CompletableFuture startSpeechSynthesisTask(
StartSpeechSynthesisTaskRequest startSpeechSynthesisTaskRequest) {
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 A Java Future containing the result of the StartSpeechSynthesisTask operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - InvalidS3BucketException The provided Amazon S3 bucket name is invalid. Please check your input with
* S3 bucket naming requirements and try again.
* - InvalidS3KeyException The provided Amazon S3 key prefix is invalid. Please provide a valid S3 object
* key name.
* - InvalidSampleRateException The specified sample rate is not valid.
* - InvalidSnsTopicArnException The provided SNS topic ARN is invalid. Please provide a valid SNS topic
* ARN and try again.
* - InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and
* values, and then try again.
* - 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.
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormat
* selected. Speech marks are only available for content in json
format.
* - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type
* input.
* - LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in
* this capacity.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.StartSpeechSynthesisTask
* @see AWS API Documentation
*/
default CompletableFuture startSpeechSynthesisTask(
Consumer startSpeechSynthesisTaskRequest) {
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 asyncResponseTransformer
* The response transformer for processing the streaming response in a non-blocking manner. See
* {@link AsyncResponseTransformer} for details on how this callback should be implemented and for links to
* precanned 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 A future to the transformed result of the AsyncResponseTransformer.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - InvalidSampleRateException The specified sample rate is not valid.
* - InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and
* values, and then try again.
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormat
* selected. Speech marks are only available for content in json
format.
* - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type
* input.
* - LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in
* this capacity.
* - 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.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.SynthesizeSpeech
* @see AWS API
* Documentation
*/
default CompletableFuture synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest,
AsyncResponseTransformer asyncResponseTransformer) {
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 asyncResponseTransformer
* The response transformer for processing the streaming response in a non-blocking manner. See
* {@link AsyncResponseTransformer} for details on how this callback should be implemented and for links to
* precanned 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 A future to the transformed result of the AsyncResponseTransformer.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - InvalidSampleRateException The specified sample rate is not valid.
* - InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and
* values, and then try again.
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormat
* selected. Speech marks are only available for content in json
format.
* - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type
* input.
* - LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in
* this capacity.
* - 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.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.SynthesizeSpeech
* @see AWS API
* Documentation
*/
default CompletableFuture synthesizeSpeech(
Consumer synthesizeSpeechRequest,
AsyncResponseTransformer asyncResponseTransformer) {
return synthesizeSpeech(SynthesizeSpeechRequest.builder().applyMutation(synthesizeSpeechRequest).build(),
asyncResponseTransformer);
}
/**
*
* 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 A future to the transformed result of the AsyncResponseTransformer.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - InvalidSampleRateException The specified sample rate is not valid.
* - InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and
* values, and then try again.
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormat
* selected. Speech marks are only available for content in json
format.
* - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type
* input.
* - LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in
* this capacity.
* - 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.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.SynthesizeSpeech
* @see AWS API
* Documentation
*/
default CompletableFuture synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest,
Path destinationPath) {
return synthesizeSpeech(synthesizeSpeechRequest, AsyncResponseTransformer.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 A future to the transformed result of the AsyncResponseTransformer.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions. The exception returned is wrapped with CompletionException, so you need to invoke
* {@link Throwable#getCause} to retrieve the underlying exception.
*
* - 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.
* - InvalidSampleRateException The specified sample rate is not valid.
* - InvalidSsmlException The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and
* values, and then try again.
* - 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.
* - ServiceFailureException An unknown condition has caused a service failure.
* - MarksNotSupportedForFormatException Speech marks are not supported for the
OutputFormat
* selected. Speech marks are only available for content in json
format.
* - SsmlMarksNotSupportedForTextTypeException SSML speech marks are not supported for plain text-type
* input.
* - LanguageNotSupportedException The language specified is not currently supported by Amazon Polly in
* this capacity.
* - 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.
* - SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
* Can be used for catch all scenarios.
* - SdkClientException If any client side error occurs such as an IO related failure, failure to get
* credentials, etc.
* - PollyException Base class for all service exceptions. Unknown exceptions will be thrown as an
* instance of this type.
*
* @sample PollyAsyncClient.SynthesizeSpeech
* @see AWS API
* Documentation
*/
default CompletableFuture synthesizeSpeech(
Consumer synthesizeSpeechRequest, Path destinationPath) {
return synthesizeSpeech(SynthesizeSpeechRequest.builder().applyMutation(synthesizeSpeechRequest).build(), destinationPath);
}
@Override
default PollyServiceClientConfiguration serviceClientConfiguration() {
throw new UnsupportedOperationException();
}
/**
* Create a {@link PollyAsyncClient} 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 PollyAsyncClient create() {
return builder().build();
}
/**
* Create a builder that can be used to configure and create a {@link PollyAsyncClient}.
*/
static PollyAsyncClientBuilder builder() {
return new DefaultPollyAsyncClientBuilder();
}
}