
software.amazon.awssdk.services.transcribestreaming.TranscribeStreamingAsyncClient Maven / Gradle / Ivy
/*
* 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.transcribestreaming;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.reactivestreams.Publisher;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.ThreadSafe;
import software.amazon.awssdk.core.SdkClient;
import software.amazon.awssdk.services.transcribestreaming.model.AudioStream;
import software.amazon.awssdk.services.transcribestreaming.model.StartMedicalStreamTranscriptionRequest;
import software.amazon.awssdk.services.transcribestreaming.model.StartMedicalStreamTranscriptionResponseHandler;
import software.amazon.awssdk.services.transcribestreaming.model.StartStreamTranscriptionRequest;
import software.amazon.awssdk.services.transcribestreaming.model.StartStreamTranscriptionResponseHandler;
/**
* Service client for accessing Amazon Transcribe Streaming Service asynchronously. This can be created using the static
* {@link #builder()} method.
*
*
* Operations and objects for transcribing streaming speech to text.
*
*/
@Generated("software.amazon.awssdk:codegen")
@SdkPublicApi
@ThreadSafe
public interface TranscribeStreamingAsyncClient extends SdkClient {
String SERVICE_NAME = "transcribe";
/**
* Value for looking up the service's metadata from the
* {@link software.amazon.awssdk.regions.ServiceMetadataProvider}.
*/
String SERVICE_METADATA_ID = "transcribestreaming";
/**
* Create a {@link TranscribeStreamingAsyncClient} 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 TranscribeStreamingAsyncClient create() {
return builder().build();
}
/**
* Create a builder that can be used to configure and create a {@link TranscribeStreamingAsyncClient}.
*/
static TranscribeStreamingAsyncClientBuilder builder() {
return new DefaultTranscribeStreamingAsyncClientBuilder();
}
/**
*
* Starts a bidirectional HTTP/2 stream where audio is streamed to Amazon Transcribe Medical and the transcription
* results are streamed to your application.
*
*
* @param startMedicalStreamTranscriptionRequest
* @return A Java Future containing the result of the StartMedicalStreamTranscription operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BadRequestException One or more arguments to the
StartStreamTranscription
or
* StartMedicalStreamTranscription
operation was invalid. For example,
* MediaEncoding
was not set to a valid encoding, or LanguageCode
was not set to a
* valid code. Check the parameters and try your request again.
* - LimitExceededException You have exceeded the maximum number of concurrent transcription streams, are
* starting transcription streams too quickly, or the maximum audio length of 4 hours. Wait until a stream
* has finished processing, or break your audio stream into smaller chunks and try your request again.
* - InternalFailureException A problem occurred while processing the audio. Amazon Transcribe or Amazon
* Transcribe Medical terminated processing. Try your request again.
* - ConflictException A new stream started with the same session ID. The current stream has been
* terminated.
* - ServiceUnavailableException Service is currently unavailable. Try your request later.
* - 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.
* - TranscribeStreamingException Base class for all service exceptions. Unknown exceptions will be thrown
* as an instance of this type.
*
* @sample TranscribeStreamingAsyncClient.StartMedicalStreamTranscription
* @see AWS API Documentation
*/
default CompletableFuture startMedicalStreamTranscription(
StartMedicalStreamTranscriptionRequest startMedicalStreamTranscriptionRequest, Publisher requestStream,
StartMedicalStreamTranscriptionResponseHandler asyncResponseHandler) {
throw new UnsupportedOperationException();
}
/**
*
* Starts a bidirectional HTTP/2 stream where audio is streamed to Amazon Transcribe Medical and the transcription
* results are streamed to your application.
*
*
*
* This is a convenience which creates an instance of the {@link StartMedicalStreamTranscriptionRequest.Builder}
* avoiding the need to create one manually via {@link StartMedicalStreamTranscriptionRequest#builder()}
*
*
* @param startMedicalStreamTranscriptionRequest
* A {@link Consumer} that will call methods on {@link StartMedicalStreamTranscriptionRequest.Builder} to
* create a request.
* @return A Java Future containing the result of the StartMedicalStreamTranscription operation returned by the
* service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BadRequestException One or more arguments to the
StartStreamTranscription
or
* StartMedicalStreamTranscription
operation was invalid. For example,
* MediaEncoding
was not set to a valid encoding, or LanguageCode
was not set to a
* valid code. Check the parameters and try your request again.
* - LimitExceededException You have exceeded the maximum number of concurrent transcription streams, are
* starting transcription streams too quickly, or the maximum audio length of 4 hours. Wait until a stream
* has finished processing, or break your audio stream into smaller chunks and try your request again.
* - InternalFailureException A problem occurred while processing the audio. Amazon Transcribe or Amazon
* Transcribe Medical terminated processing. Try your request again.
* - ConflictException A new stream started with the same session ID. The current stream has been
* terminated.
* - ServiceUnavailableException Service is currently unavailable. Try your request later.
* - 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.
* - TranscribeStreamingException Base class for all service exceptions. Unknown exceptions will be thrown
* as an instance of this type.
*
* @sample TranscribeStreamingAsyncClient.StartMedicalStreamTranscription
* @see AWS API Documentation
*/
default CompletableFuture startMedicalStreamTranscription(
Consumer startMedicalStreamTranscriptionRequest,
Publisher requestStream, StartMedicalStreamTranscriptionResponseHandler asyncResponseHandler) {
return startMedicalStreamTranscription(
StartMedicalStreamTranscriptionRequest.builder().applyMutation(startMedicalStreamTranscriptionRequest).build(),
requestStream, asyncResponseHandler);
}
/**
*
* Starts a bidirectional HTTP2 stream where audio is streamed to Amazon Transcribe and the transcription results
* are streamed to your application.
*
*
* The following are encoded as HTTP2 headers:
*
*
* -
*
* x-amzn-transcribe-language-code
*
*
* -
*
* x-amzn-transcribe-media-encoding
*
*
* -
*
* x-amzn-transcribe-sample-rate
*
*
* -
*
* x-amzn-transcribe-session-id
*
*
*
*
* @param startStreamTranscriptionRequest
* @return A Java Future containing the result of the StartStreamTranscription operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BadRequestException One or more arguments to the
StartStreamTranscription
or
* StartMedicalStreamTranscription
operation was invalid. For example,
* MediaEncoding
was not set to a valid encoding, or LanguageCode
was not set to a
* valid code. Check the parameters and try your request again.
* - LimitExceededException You have exceeded the maximum number of concurrent transcription streams, are
* starting transcription streams too quickly, or the maximum audio length of 4 hours. Wait until a stream
* has finished processing, or break your audio stream into smaller chunks and try your request again.
* - InternalFailureException A problem occurred while processing the audio. Amazon Transcribe or Amazon
* Transcribe Medical terminated processing. Try your request again.
* - ConflictException A new stream started with the same session ID. The current stream has been
* terminated.
* - ServiceUnavailableException Service is currently unavailable. Try your request later.
* - 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.
* - TranscribeStreamingException Base class for all service exceptions. Unknown exceptions will be thrown
* as an instance of this type.
*
* @sample TranscribeStreamingAsyncClient.StartStreamTranscription
* @see AWS API Documentation
*/
default CompletableFuture startStreamTranscription(StartStreamTranscriptionRequest startStreamTranscriptionRequest,
Publisher requestStream, StartStreamTranscriptionResponseHandler asyncResponseHandler) {
throw new UnsupportedOperationException();
}
/**
*
* Starts a bidirectional HTTP2 stream where audio is streamed to Amazon Transcribe and the transcription results
* are streamed to your application.
*
*
* The following are encoded as HTTP2 headers:
*
*
* -
*
* x-amzn-transcribe-language-code
*
*
* -
*
* x-amzn-transcribe-media-encoding
*
*
* -
*
* x-amzn-transcribe-sample-rate
*
*
* -
*
* x-amzn-transcribe-session-id
*
*
*
*
*
* This is a convenience which creates an instance of the {@link StartStreamTranscriptionRequest.Builder} avoiding
* the need to create one manually via {@link StartStreamTranscriptionRequest#builder()}
*
*
* @param startStreamTranscriptionRequest
* A {@link Consumer} that will call methods on {@link StartStreamTranscriptionRequest.Builder} to create a
* request.
* @return A Java Future containing the result of the StartStreamTranscription operation returned by the service.
* The CompletableFuture returned by this method can be completed exceptionally with the following
* exceptions.
*
* - BadRequestException One or more arguments to the
StartStreamTranscription
or
* StartMedicalStreamTranscription
operation was invalid. For example,
* MediaEncoding
was not set to a valid encoding, or LanguageCode
was not set to a
* valid code. Check the parameters and try your request again.
* - LimitExceededException You have exceeded the maximum number of concurrent transcription streams, are
* starting transcription streams too quickly, or the maximum audio length of 4 hours. Wait until a stream
* has finished processing, or break your audio stream into smaller chunks and try your request again.
* - InternalFailureException A problem occurred while processing the audio. Amazon Transcribe or Amazon
* Transcribe Medical terminated processing. Try your request again.
* - ConflictException A new stream started with the same session ID. The current stream has been
* terminated.
* - ServiceUnavailableException Service is currently unavailable. Try your request later.
* - 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.
* - TranscribeStreamingException Base class for all service exceptions. Unknown exceptions will be thrown
* as an instance of this type.
*
* @sample TranscribeStreamingAsyncClient.StartStreamTranscription
* @see AWS API Documentation
*/
default CompletableFuture startStreamTranscription(
Consumer startStreamTranscriptionRequest,
Publisher requestStream, StartStreamTranscriptionResponseHandler asyncResponseHandler) {
return startStreamTranscription(StartStreamTranscriptionRequest.builder().applyMutation(startStreamTranscriptionRequest)
.build(), requestStream, asyncResponseHandler);
}
}