@Generated(value="by gapic-generator-java") public class SpeechClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
Recognizer response = speechClient.getRecognizer(name);
}
Note: close() needs to be called on the SpeechClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
| CreateRecognizer | Creates a [Recognizer][google.cloud.speech.v2.Recognizer]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| ListRecognizers | Lists Recognizers. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetRecognizer | Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested Recognizer doesn't exist. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| UpdateRecognizer | Updates the [Recognizer][google.cloud.speech.v2.Recognizer]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| DeleteRecognizer | Deletes the [Recognizer][google.cloud.speech.v2.Recognizer]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| UndeleteRecognizer | Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| Recognize | Performs synchronous Speech recognition: receive results after all audio has been sent and processed. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| StreamingRecognize | Performs bidirectional streaming speech recognition: receive results while sending audio. This method is only available via the gRPC API (not REST). |
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| BatchRecognize | Performs batch asynchronous speech recognition: send a request with N audio files and receive a long running operation that can be polled to see when the transcriptions are finished. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetConfig | Returns the requested [Config][google.cloud.speech.v2.Config]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| UpdateConfig | Updates the [Config][google.cloud.speech.v2.Config]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| CreateCustomClass | Creates a [CustomClass][google.cloud.speech.v2.CustomClass]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| ListCustomClasses | Lists CustomClasses. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetCustomClass | Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| UpdateCustomClass | Updates the [CustomClass][google.cloud.speech.v2.CustomClass]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| DeleteCustomClass | Deletes the [CustomClass][google.cloud.speech.v2.CustomClass]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| UndeleteCustomClass | Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| CreatePhraseSet | Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| ListPhraseSets | Lists PhraseSets. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetPhraseSet | Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| UpdatePhraseSet | Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| DeletePhraseSet | Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| UndeletePhraseSet | Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| ListLocations | Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
| GetLocation | Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of SpeechSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SpeechSettings speechSettings =
SpeechSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SpeechClient speechClient = SpeechClient.create(speechSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SpeechSettings speechSettings = SpeechSettings.newBuilder().setEndpoint(myEndpoint).build();
SpeechClient speechClient = SpeechClient.create(speechSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SpeechSettings speechSettings = SpeechSettings.newHttpJsonBuilder().build();
SpeechClient speechClient = SpeechClient.create(speechSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
SpeechClient.ListCustomClassesFixedSizeCollection |
static class |
SpeechClient.ListCustomClassesPage |
static class |
SpeechClient.ListCustomClassesPagedResponse |
static class |
SpeechClient.ListLocationsFixedSizeCollection |
static class |
SpeechClient.ListLocationsPage |
static class |
SpeechClient.ListLocationsPagedResponse |
static class |
SpeechClient.ListPhraseSetsFixedSizeCollection |
static class |
SpeechClient.ListPhraseSetsPage |
static class |
SpeechClient.ListPhraseSetsPagedResponse |
static class |
SpeechClient.ListRecognizersFixedSizeCollection |
static class |
SpeechClient.ListRecognizersPage |
static class |
SpeechClient.ListRecognizersPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
SpeechClient(SpeechSettings settings)
Constructs an instance of SpeechClient, using the given settings.
|
protected |
SpeechClient(SpeechStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
com.google.api.gax.longrunning.OperationFuture<BatchRecognizeResponse,OperationMetadata> |
batchRecognizeAsync(BatchRecognizeRequest request)
Performs batch asynchronous speech recognition: send a request with N audio files and receive a
long running operation that can be polled to see when the transcriptions are finished.
|
com.google.api.gax.longrunning.OperationFuture<BatchRecognizeResponse,OperationMetadata> |
batchRecognizeAsync(RecognizerName recognizer,
RecognitionConfig config,
com.google.protobuf.FieldMask configMask,
List<BatchRecognizeFileMetadata> files)
Performs batch asynchronous speech recognition: send a request with N audio files and receive a
long running operation that can be polled to see when the transcriptions are finished.
|
com.google.api.gax.longrunning.OperationFuture<BatchRecognizeResponse,OperationMetadata> |
batchRecognizeAsync(String recognizer,
RecognitionConfig config,
com.google.protobuf.FieldMask configMask,
List<BatchRecognizeFileMetadata> files)
Performs batch asynchronous speech recognition: send a request with N audio files and receive a
long running operation that can be polled to see when the transcriptions are finished.
|
com.google.api.gax.rpc.UnaryCallable<BatchRecognizeRequest,com.google.longrunning.Operation> |
batchRecognizeCallable()
Performs batch asynchronous speech recognition: send a request with N audio files and receive a
long running operation that can be polled to see when the transcriptions are finished.
|
com.google.api.gax.rpc.OperationCallable<BatchRecognizeRequest,BatchRecognizeResponse,OperationMetadata> |
batchRecognizeOperationCallable()
Performs batch asynchronous speech recognition: send a request with N audio files and receive a
long running operation that can be polled to see when the transcriptions are finished.
|
void |
close() |
static SpeechClient |
create()
Constructs an instance of SpeechClient with default settings.
|
static SpeechClient |
create(SpeechSettings settings)
Constructs an instance of SpeechClient, using the given settings.
|
static SpeechClient |
create(SpeechStub stub)
Constructs an instance of SpeechClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
createCustomClassAsync(CreateCustomClassRequest request)
Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
createCustomClassAsync(LocationName parent,
CustomClass customClass,
String customClassId)
Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
createCustomClassAsync(String parent,
CustomClass customClass,
String customClassId)
Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.rpc.UnaryCallable<CreateCustomClassRequest,com.google.longrunning.Operation> |
createCustomClassCallable()
Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.rpc.OperationCallable<CreateCustomClassRequest,CustomClass,OperationMetadata> |
createCustomClassOperationCallable()
Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
createPhraseSetAsync(CreatePhraseSetRequest request)
Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
createPhraseSetAsync(LocationName parent,
PhraseSet phraseSet,
String phraseSetId)
Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
createPhraseSetAsync(String parent,
PhraseSet phraseSet,
String phraseSetId)
Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.rpc.UnaryCallable<CreatePhraseSetRequest,com.google.longrunning.Operation> |
createPhraseSetCallable()
Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.rpc.OperationCallable<CreatePhraseSetRequest,PhraseSet,OperationMetadata> |
createPhraseSetOperationCallable()
Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
createRecognizerAsync(CreateRecognizerRequest request)
Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
createRecognizerAsync(LocationName parent,
Recognizer recognizer,
String recognizerId)
Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
createRecognizerAsync(String parent,
Recognizer recognizer,
String recognizerId)
Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.rpc.UnaryCallable<CreateRecognizerRequest,com.google.longrunning.Operation> |
createRecognizerCallable()
Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.rpc.OperationCallable<CreateRecognizerRequest,Recognizer,OperationMetadata> |
createRecognizerOperationCallable()
Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
deleteCustomClassAsync(CustomClassName name)
Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
deleteCustomClassAsync(DeleteCustomClassRequest request)
Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
deleteCustomClassAsync(String name)
Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.rpc.UnaryCallable<DeleteCustomClassRequest,com.google.longrunning.Operation> |
deleteCustomClassCallable()
Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.rpc.OperationCallable<DeleteCustomClassRequest,CustomClass,OperationMetadata> |
deleteCustomClassOperationCallable()
Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
deletePhraseSetAsync(DeletePhraseSetRequest request)
Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
deletePhraseSetAsync(PhraseSetName name)
Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
deletePhraseSetAsync(String name)
Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.rpc.UnaryCallable<DeletePhraseSetRequest,com.google.longrunning.Operation> |
deletePhraseSetCallable()
Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.rpc.OperationCallable<DeletePhraseSetRequest,PhraseSet,OperationMetadata> |
deletePhraseSetOperationCallable()
Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
deleteRecognizerAsync(DeleteRecognizerRequest request)
Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
deleteRecognizerAsync(RecognizerName name)
Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
deleteRecognizerAsync(String name)
Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.rpc.UnaryCallable<DeleteRecognizerRequest,com.google.longrunning.Operation> |
deleteRecognizerCallable()
Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.rpc.OperationCallable<DeleteRecognizerRequest,Recognizer,OperationMetadata> |
deleteRecognizerOperationCallable()
Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
Config |
getConfig(ConfigName name)
Returns the requested [Config][google.cloud.speech.v2.Config].
|
Config |
getConfig(GetConfigRequest request)
Returns the requested [Config][google.cloud.speech.v2.Config].
|
Config |
getConfig(String name)
Returns the requested [Config][google.cloud.speech.v2.Config].
|
com.google.api.gax.rpc.UnaryCallable<GetConfigRequest,Config> |
getConfigCallable()
Returns the requested [Config][google.cloud.speech.v2.Config].
|
CustomClass |
getCustomClass(CustomClassName name)
Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass].
|
CustomClass |
getCustomClass(GetCustomClassRequest request)
Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass].
|
CustomClass |
getCustomClass(String name)
Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.rpc.UnaryCallable<GetCustomClassRequest,CustomClass> |
getCustomClassCallable()
Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
PhraseSet |
getPhraseSet(GetPhraseSetRequest request)
Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
PhraseSet |
getPhraseSet(PhraseSetName name)
Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
PhraseSet |
getPhraseSet(String name)
Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.rpc.UnaryCallable<GetPhraseSetRequest,PhraseSet> |
getPhraseSetCallable()
Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
Recognizer |
getRecognizer(GetRecognizerRequest request)
Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer].
|
Recognizer |
getRecognizer(RecognizerName name)
Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer].
|
Recognizer |
getRecognizer(String name)
Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.rpc.UnaryCallable<GetRecognizerRequest,Recognizer> |
getRecognizerCallable()
Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer].
|
SpeechSettings |
getSettings() |
SpeechStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
SpeechClient.ListCustomClassesPagedResponse |
listCustomClasses(ListCustomClassesRequest request)
Lists CustomClasses.
|
SpeechClient.ListCustomClassesPagedResponse |
listCustomClasses(LocationName parent)
Lists CustomClasses.
|
SpeechClient.ListCustomClassesPagedResponse |
listCustomClasses(String parent)
Lists CustomClasses.
|
com.google.api.gax.rpc.UnaryCallable<ListCustomClassesRequest,ListCustomClassesResponse> |
listCustomClassesCallable()
Lists CustomClasses.
|
com.google.api.gax.rpc.UnaryCallable<ListCustomClassesRequest,SpeechClient.ListCustomClassesPagedResponse> |
listCustomClassesPagedCallable()
Lists CustomClasses.
|
SpeechClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,SpeechClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
SpeechClient.ListPhraseSetsPagedResponse |
listPhraseSets(ListPhraseSetsRequest request)
Lists PhraseSets.
|
SpeechClient.ListPhraseSetsPagedResponse |
listPhraseSets(LocationName parent)
Lists PhraseSets.
|
SpeechClient.ListPhraseSetsPagedResponse |
listPhraseSets(String parent)
Lists PhraseSets.
|
com.google.api.gax.rpc.UnaryCallable<ListPhraseSetsRequest,ListPhraseSetsResponse> |
listPhraseSetsCallable()
Lists PhraseSets.
|
com.google.api.gax.rpc.UnaryCallable<ListPhraseSetsRequest,SpeechClient.ListPhraseSetsPagedResponse> |
listPhraseSetsPagedCallable()
Lists PhraseSets.
|
SpeechClient.ListRecognizersPagedResponse |
listRecognizers(ListRecognizersRequest request)
Lists Recognizers.
|
SpeechClient.ListRecognizersPagedResponse |
listRecognizers(LocationName parent)
Lists Recognizers.
|
SpeechClient.ListRecognizersPagedResponse |
listRecognizers(String parent)
Lists Recognizers.
|
com.google.api.gax.rpc.UnaryCallable<ListRecognizersRequest,ListRecognizersResponse> |
listRecognizersCallable()
Lists Recognizers.
|
com.google.api.gax.rpc.UnaryCallable<ListRecognizersRequest,SpeechClient.ListRecognizersPagedResponse> |
listRecognizersPagedCallable()
Lists Recognizers.
|
RecognizeResponse |
recognize(RecognizeRequest request)
Performs synchronous Speech recognition: receive results after all audio has been sent and
processed.
|
RecognizeResponse |
recognize(RecognizerName recognizer,
RecognitionConfig config,
com.google.protobuf.FieldMask configMask,
com.google.protobuf.ByteString content)
Performs synchronous Speech recognition: receive results after all audio has been sent and
processed.
|
RecognizeResponse |
recognize(RecognizerName recognizer,
RecognitionConfig config,
com.google.protobuf.FieldMask configMask,
String uri)
Performs synchronous Speech recognition: receive results after all audio has been sent and
processed.
|
RecognizeResponse |
recognize(String recognizer,
RecognitionConfig config,
com.google.protobuf.FieldMask configMask,
com.google.protobuf.ByteString content)
Performs synchronous Speech recognition: receive results after all audio has been sent and
processed.
|
RecognizeResponse |
recognize(String recognizer,
RecognitionConfig config,
com.google.protobuf.FieldMask configMask,
String uri)
Performs synchronous Speech recognition: receive results after all audio has been sent and
processed.
|
com.google.api.gax.rpc.UnaryCallable<RecognizeRequest,RecognizeResponse> |
recognizeCallable()
Performs synchronous Speech recognition: receive results after all audio has been sent and
processed.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.rpc.BidiStreamingCallable<StreamingRecognizeRequest,StreamingRecognizeResponse> |
streamingRecognizeCallable()
Performs bidirectional streaming speech recognition: receive results while sending audio.
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
undeleteCustomClassAsync(CustomClassName name)
Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
undeleteCustomClassAsync(String name)
Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
undeleteCustomClassAsync(UndeleteCustomClassRequest request)
Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.rpc.UnaryCallable<UndeleteCustomClassRequest,com.google.longrunning.Operation> |
undeleteCustomClassCallable()
Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.rpc.OperationCallable<UndeleteCustomClassRequest,CustomClass,OperationMetadata> |
undeleteCustomClassOperationCallable()
Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
undeletePhraseSetAsync(PhraseSetName name)
Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
undeletePhraseSetAsync(String name)
Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
undeletePhraseSetAsync(UndeletePhraseSetRequest request)
Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.rpc.UnaryCallable<UndeletePhraseSetRequest,com.google.longrunning.Operation> |
undeletePhraseSetCallable()
Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.rpc.OperationCallable<UndeletePhraseSetRequest,PhraseSet,OperationMetadata> |
undeletePhraseSetOperationCallable()
Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
undeleteRecognizerAsync(RecognizerName name)
Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
undeleteRecognizerAsync(String name)
Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
undeleteRecognizerAsync(UndeleteRecognizerRequest request)
Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.rpc.UnaryCallable<UndeleteRecognizerRequest,com.google.longrunning.Operation> |
undeleteRecognizerCallable()
Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.rpc.OperationCallable<UndeleteRecognizerRequest,Recognizer,OperationMetadata> |
undeleteRecognizerOperationCallable()
Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
|
Config |
updateConfig(Config config,
com.google.protobuf.FieldMask updateMask)
Updates the [Config][google.cloud.speech.v2.Config].
|
Config |
updateConfig(UpdateConfigRequest request)
Updates the [Config][google.cloud.speech.v2.Config].
|
com.google.api.gax.rpc.UnaryCallable<UpdateConfigRequest,Config> |
updateConfigCallable()
Updates the [Config][google.cloud.speech.v2.Config].
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
updateCustomClassAsync(CustomClass customClass,
com.google.protobuf.FieldMask updateMask)
Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> |
updateCustomClassAsync(UpdateCustomClassRequest request)
Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.rpc.UnaryCallable<UpdateCustomClassRequest,com.google.longrunning.Operation> |
updateCustomClassCallable()
Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.rpc.OperationCallable<UpdateCustomClassRequest,CustomClass,OperationMetadata> |
updateCustomClassOperationCallable()
Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
updatePhraseSetAsync(PhraseSet phraseSet,
com.google.protobuf.FieldMask updateMask)
Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> |
updatePhraseSetAsync(UpdatePhraseSetRequest request)
Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.rpc.UnaryCallable<UpdatePhraseSetRequest,com.google.longrunning.Operation> |
updatePhraseSetCallable()
Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.rpc.OperationCallable<UpdatePhraseSetRequest,PhraseSet,OperationMetadata> |
updatePhraseSetOperationCallable()
Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
updateRecognizerAsync(Recognizer recognizer,
com.google.protobuf.FieldMask updateMask)
Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> |
updateRecognizerAsync(UpdateRecognizerRequest request)
Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.rpc.UnaryCallable<UpdateRecognizerRequest,com.google.longrunning.Operation> |
updateRecognizerCallable()
Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
|
com.google.api.gax.rpc.OperationCallable<UpdateRecognizerRequest,Recognizer,OperationMetadata> |
updateRecognizerOperationCallable()
Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
|
protected SpeechClient(SpeechSettings settings) throws IOException
IOExceptionprotected SpeechClient(SpeechStub stub)
public static final SpeechClient create() throws IOException
IOExceptionpublic static final SpeechClient create(SpeechSettings settings) throws IOException
IOExceptionpublic static final SpeechClient create(SpeechStub stub)
public final SpeechSettings getSettings()
public SpeechStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> createRecognizerAsync(LocationName parent, Recognizer recognizer, String recognizerId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Recognizer recognizer = Recognizer.newBuilder().build();
String recognizerId = "recognizerId771963359";
Recognizer response =
speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get();
}
parent - Required. The project and location where this Recognizer will be created. The
expected format is `projects/{project}/locations/{location}`.recognizer - Required. The Recognizer to create.recognizerId - The ID to use for the Recognizer, which will become the final component of
the Recognizer's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> createRecognizerAsync(String parent, Recognizer recognizer, String recognizerId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
Recognizer recognizer = Recognizer.newBuilder().build();
String recognizerId = "recognizerId771963359";
Recognizer response =
speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get();
}
parent - Required. The project and location where this Recognizer will be created. The
expected format is `projects/{project}/locations/{location}`.recognizer - Required. The Recognizer to create.recognizerId - The ID to use for the Recognizer, which will become the final component of
the Recognizer's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> createRecognizerAsync(CreateRecognizerRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CreateRecognizerRequest request =
CreateRecognizerRequest.newBuilder()
.setRecognizer(Recognizer.newBuilder().build())
.setValidateOnly(true)
.setRecognizerId("recognizerId771963359")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
Recognizer response = speechClient.createRecognizerAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateRecognizerRequest,Recognizer,OperationMetadata> createRecognizerOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CreateRecognizerRequest request =
CreateRecognizerRequest.newBuilder()
.setRecognizer(Recognizer.newBuilder().build())
.setValidateOnly(true)
.setRecognizerId("recognizerId771963359")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
OperationFuture<Recognizer, OperationMetadata> future =
speechClient.createRecognizerOperationCallable().futureCall(request);
// Do something.
Recognizer response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateRecognizerRequest,com.google.longrunning.Operation> createRecognizerCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CreateRecognizerRequest request =
CreateRecognizerRequest.newBuilder()
.setRecognizer(Recognizer.newBuilder().build())
.setValidateOnly(true)
.setRecognizerId("recognizerId771963359")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ApiFuture<Operation> future = speechClient.createRecognizerCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final SpeechClient.ListRecognizersPagedResponse listRecognizers(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The project and location of Recognizers to list. The expected format is
`projects/{project}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SpeechClient.ListRecognizersPagedResponse listRecognizers(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The project and location of Recognizers to list. The expected format is
`projects/{project}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SpeechClient.ListRecognizersPagedResponse listRecognizers(ListRecognizersRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListRecognizersRequest request =
ListRecognizersRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
for (Recognizer element : speechClient.listRecognizers(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListRecognizersRequest,SpeechClient.ListRecognizersPagedResponse> listRecognizersPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListRecognizersRequest request =
ListRecognizersRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
ApiFuture<Recognizer> future =
speechClient.listRecognizersPagedCallable().futureCall(request);
// Do something.
for (Recognizer element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListRecognizersRequest,ListRecognizersResponse> listRecognizersCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListRecognizersRequest request =
ListRecognizersRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
while (true) {
ListRecognizersResponse response = speechClient.listRecognizersCallable().call(request);
for (Recognizer element : response.getRecognizersList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Recognizer getRecognizer(RecognizerName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
Recognizer response = speechClient.getRecognizer(name);
}
name - Required. The name of the Recognizer to retrieve. The expected format is
`projects/{project}/locations/{location}/recognizers/{recognizer}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Recognizer getRecognizer(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
Recognizer response = speechClient.getRecognizer(name);
}
name - Required. The name of the Recognizer to retrieve. The expected format is
`projects/{project}/locations/{location}/recognizers/{recognizer}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Recognizer getRecognizer(GetRecognizerRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetRecognizerRequest request =
GetRecognizerRequest.newBuilder()
.setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.build();
Recognizer response = speechClient.getRecognizer(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetRecognizerRequest,Recognizer> getRecognizerCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetRecognizerRequest request =
GetRecognizerRequest.newBuilder()
.setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.build();
ApiFuture<Recognizer> future = speechClient.getRecognizerCallable().futureCall(request);
// Do something.
Recognizer response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> updateRecognizerAsync(Recognizer recognizer, com.google.protobuf.FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
Recognizer recognizer = Recognizer.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Recognizer response = speechClient.updateRecognizerAsync(recognizer, updateMask).get();
}
recognizer - Required. The Recognizer to update.
The Recognizer's `name` field is used to identify the Recognizer to update. Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
updateMask - The list of fields to update. If empty, all non-default valued fields are
considered for update. Use `*` to update the entire Recognizer resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> updateRecognizerAsync(UpdateRecognizerRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdateRecognizerRequest request =
UpdateRecognizerRequest.newBuilder()
.setRecognizer(Recognizer.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
Recognizer response = speechClient.updateRecognizerAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateRecognizerRequest,Recognizer,OperationMetadata> updateRecognizerOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdateRecognizerRequest request =
UpdateRecognizerRequest.newBuilder()
.setRecognizer(Recognizer.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
OperationFuture<Recognizer, OperationMetadata> future =
speechClient.updateRecognizerOperationCallable().futureCall(request);
// Do something.
Recognizer response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateRecognizerRequest,com.google.longrunning.Operation> updateRecognizerCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdateRecognizerRequest request =
UpdateRecognizerRequest.newBuilder()
.setRecognizer(Recognizer.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Operation> future = speechClient.updateRecognizerCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> deleteRecognizerAsync(RecognizerName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
Recognizer response = speechClient.deleteRecognizerAsync(name).get();
}
name - Required. The name of the Recognizer to delete. Format:
`projects/{project}/locations/{location}/recognizers/{recognizer}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> deleteRecognizerAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
Recognizer response = speechClient.deleteRecognizerAsync(name).get();
}
name - Required. The name of the Recognizer to delete. Format:
`projects/{project}/locations/{location}/recognizers/{recognizer}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> deleteRecognizerAsync(DeleteRecognizerRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
DeleteRecognizerRequest request =
DeleteRecognizerRequest.newBuilder()
.setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setValidateOnly(true)
.setAllowMissing(true)
.setEtag("etag3123477")
.build();
Recognizer response = speechClient.deleteRecognizerAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteRecognizerRequest,Recognizer,OperationMetadata> deleteRecognizerOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
DeleteRecognizerRequest request =
DeleteRecognizerRequest.newBuilder()
.setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setValidateOnly(true)
.setAllowMissing(true)
.setEtag("etag3123477")
.build();
OperationFuture<Recognizer, OperationMetadata> future =
speechClient.deleteRecognizerOperationCallable().futureCall(request);
// Do something.
Recognizer response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteRecognizerRequest,com.google.longrunning.Operation> deleteRecognizerCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
DeleteRecognizerRequest request =
DeleteRecognizerRequest.newBuilder()
.setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setValidateOnly(true)
.setAllowMissing(true)
.setEtag("etag3123477")
.build();
ApiFuture<Operation> future = speechClient.deleteRecognizerCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> undeleteRecognizerAsync(RecognizerName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
Recognizer response = speechClient.undeleteRecognizerAsync(name).get();
}
name - Required. The name of the Recognizer to undelete. Format:
`projects/{project}/locations/{location}/recognizers/{recognizer}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> undeleteRecognizerAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
Recognizer response = speechClient.undeleteRecognizerAsync(name).get();
}
name - Required. The name of the Recognizer to undelete. Format:
`projects/{project}/locations/{location}/recognizers/{recognizer}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Recognizer,OperationMetadata> undeleteRecognizerAsync(UndeleteRecognizerRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UndeleteRecognizerRequest request =
UndeleteRecognizerRequest.newBuilder()
.setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
Recognizer response = speechClient.undeleteRecognizerAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UndeleteRecognizerRequest,Recognizer,OperationMetadata> undeleteRecognizerOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UndeleteRecognizerRequest request =
UndeleteRecognizerRequest.newBuilder()
.setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
OperationFuture<Recognizer, OperationMetadata> future =
speechClient.undeleteRecognizerOperationCallable().futureCall(request);
// Do something.
Recognizer response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UndeleteRecognizerRequest,com.google.longrunning.Operation> undeleteRecognizerCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UndeleteRecognizerRequest request =
UndeleteRecognizerRequest.newBuilder()
.setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
ApiFuture<Operation> future = speechClient.undeleteRecognizerCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final RecognizeResponse recognize(RecognizerName recognizer, RecognitionConfig config, com.google.protobuf.FieldMask configMask, com.google.protobuf.ByteString content)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
RecognitionConfig config = RecognitionConfig.newBuilder().build();
FieldMask configMask = FieldMask.newBuilder().build();
ByteString content = ByteString.EMPTY;
RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content);
}
recognizer - Required. The name of the Recognizer to use during recognition. The expected
format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
{recognizer} segment may be set to `_` to use an empty implicit Recognizer.config - Features and audio metadata to use for the Automatic Speech Recognition. This
field in combination with the
[config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to
override parts of the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the Recognizer resource.configMask - The list of fields in
[config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the recognizer during this recognition request. If no mask is provided, all non-default
valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the
values in the recognizer for this recognition request. If a mask is provided, only the
fields listed in the mask override the config in the recognizer for this recognition
request. If a wildcard (`*`) is provided,
[config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces
the config in the recognizer for this recognition request.content - The audio data bytes encoded as specified in
[RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As with all bytes fields,
proto buffers use a pure binary representation, whereas JSON representations use base64.com.google.api.gax.rpc.ApiException - if the remote call failspublic final RecognizeResponse recognize(RecognizerName recognizer, RecognitionConfig config, com.google.protobuf.FieldMask configMask, String uri)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
RecognitionConfig config = RecognitionConfig.newBuilder().build();
FieldMask configMask = FieldMask.newBuilder().build();
String uri = "uri116076";
RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri);
}
recognizer - Required. The name of the Recognizer to use during recognition. The expected
format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
{recognizer} segment may be set to `_` to use an empty implicit Recognizer.config - Features and audio metadata to use for the Automatic Speech Recognition. This
field in combination with the
[config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to
override parts of the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the Recognizer resource.configMask - The list of fields in
[config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the recognizer during this recognition request. If no mask is provided, all non-default
valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the
values in the recognizer for this recognition request. If a mask is provided, only the
fields listed in the mask override the config in the recognizer for this recognition
request. If a wildcard (`*`) is provided,
[config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces
the config in the recognizer for this recognition request.uri - URI that points to a file that contains audio data bytes as specified in
[RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file must not be
compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported,
which must be specified in the following format: `gs://bucket_name/object_name` (other URI
formats return [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information,
see [Request URIs](https://cloud.google.com/storage/docs/reference-uris).com.google.api.gax.rpc.ApiException - if the remote call failspublic final RecognizeResponse recognize(String recognizer, RecognitionConfig config, com.google.protobuf.FieldMask configMask, com.google.protobuf.ByteString content)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
RecognitionConfig config = RecognitionConfig.newBuilder().build();
FieldMask configMask = FieldMask.newBuilder().build();
ByteString content = ByteString.EMPTY;
RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content);
}
recognizer - Required. The name of the Recognizer to use during recognition. The expected
format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
{recognizer} segment may be set to `_` to use an empty implicit Recognizer.config - Features and audio metadata to use for the Automatic Speech Recognition. This
field in combination with the
[config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to
override parts of the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the Recognizer resource.configMask - The list of fields in
[config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the recognizer during this recognition request. If no mask is provided, all non-default
valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the
values in the recognizer for this recognition request. If a mask is provided, only the
fields listed in the mask override the config in the recognizer for this recognition
request. If a wildcard (`*`) is provided,
[config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces
the config in the recognizer for this recognition request.content - The audio data bytes encoded as specified in
[RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As with all bytes fields,
proto buffers use a pure binary representation, whereas JSON representations use base64.com.google.api.gax.rpc.ApiException - if the remote call failspublic final RecognizeResponse recognize(String recognizer, RecognitionConfig config, com.google.protobuf.FieldMask configMask, String uri)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
RecognitionConfig config = RecognitionConfig.newBuilder().build();
FieldMask configMask = FieldMask.newBuilder().build();
String uri = "uri116076";
RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri);
}
recognizer - Required. The name of the Recognizer to use during recognition. The expected
format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
{recognizer} segment may be set to `_` to use an empty implicit Recognizer.config - Features and audio metadata to use for the Automatic Speech Recognition. This
field in combination with the
[config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to
override parts of the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the Recognizer resource.configMask - The list of fields in
[config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the recognizer during this recognition request. If no mask is provided, all non-default
valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the
values in the recognizer for this recognition request. If a mask is provided, only the
fields listed in the mask override the config in the recognizer for this recognition
request. If a wildcard (`*`) is provided,
[config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces
the config in the recognizer for this recognition request.uri - URI that points to a file that contains audio data bytes as specified in
[RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file must not be
compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported,
which must be specified in the following format: `gs://bucket_name/object_name` (other URI
formats return [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information,
see [Request URIs](https://cloud.google.com/storage/docs/reference-uris).com.google.api.gax.rpc.ApiException - if the remote call failspublic final RecognizeResponse recognize(RecognizeRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
RecognizeRequest request =
RecognizeRequest.newBuilder()
.setRecognizer(
RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setConfig(RecognitionConfig.newBuilder().build())
.setConfigMask(FieldMask.newBuilder().build())
.build();
RecognizeResponse response = speechClient.recognize(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<RecognizeRequest,RecognizeResponse> recognizeCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
RecognizeRequest request =
RecognizeRequest.newBuilder()
.setRecognizer(
RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setConfig(RecognitionConfig.newBuilder().build())
.setConfigMask(FieldMask.newBuilder().build())
.build();
ApiFuture<RecognizeResponse> future = speechClient.recognizeCallable().futureCall(request);
// Do something.
RecognizeResponse response = future.get();
}
public final com.google.api.gax.rpc.BidiStreamingCallable<StreamingRecognizeRequest,StreamingRecognizeResponse> streamingRecognizeCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
BidiStream<StreamingRecognizeRequest, StreamingRecognizeResponse> bidiStream =
speechClient.streamingRecognizeCallable().call();
StreamingRecognizeRequest request =
StreamingRecognizeRequest.newBuilder()
.setRecognizer(
RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.build();
bidiStream.send(request);
for (StreamingRecognizeResponse response : bidiStream) {
// Do something when a response is received.
}
}
public final com.google.api.gax.longrunning.OperationFuture<BatchRecognizeResponse,OperationMetadata> batchRecognizeAsync(RecognizerName recognizer, RecognitionConfig config, com.google.protobuf.FieldMask configMask, List<BatchRecognizeFileMetadata> files)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
RecognitionConfig config = RecognitionConfig.newBuilder().build();
FieldMask configMask = FieldMask.newBuilder().build();
List<BatchRecognizeFileMetadata> files = new ArrayList<>();
BatchRecognizeResponse response =
speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get();
}
recognizer - Required. The name of the Recognizer to use during recognition. The expected
format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
{recognizer} segment may be set to `_` to use an empty implicit Recognizer.config - Features and audio metadata to use for the Automatic Speech Recognition. This
field in combination with the
[config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask] field can be used
to override parts of the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the Recognizer resource.configMask - The list of fields in
[config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override the values in
the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the recognizer during this recognition request. If no mask is provided, all given fields
in [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the values in the
recognizer for this recognition request. If a mask is provided, only the fields listed in
the mask override the config in the recognizer for this recognition request. If a wildcard
(`*`) is provided, [config][google.cloud.speech.v2.BatchRecognizeRequest.config]
completely overrides and replaces the config in the recognizer for this recognition
request.files - Audio files with file metadata for ASR. The maximum number of files allowed to be
specified is 5.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<BatchRecognizeResponse,OperationMetadata> batchRecognizeAsync(String recognizer, RecognitionConfig config, com.google.protobuf.FieldMask configMask, List<BatchRecognizeFileMetadata> files)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
RecognitionConfig config = RecognitionConfig.newBuilder().build();
FieldMask configMask = FieldMask.newBuilder().build();
List<BatchRecognizeFileMetadata> files = new ArrayList<>();
BatchRecognizeResponse response =
speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get();
}
recognizer - Required. The name of the Recognizer to use during recognition. The expected
format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
{recognizer} segment may be set to `_` to use an empty implicit Recognizer.config - Features and audio metadata to use for the Automatic Speech Recognition. This
field in combination with the
[config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask] field can be used
to override parts of the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the Recognizer resource.configMask - The list of fields in
[config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override the values in
the
[default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
of the recognizer during this recognition request. If no mask is provided, all given fields
in [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the values in the
recognizer for this recognition request. If a mask is provided, only the fields listed in
the mask override the config in the recognizer for this recognition request. If a wildcard
(`*`) is provided, [config][google.cloud.speech.v2.BatchRecognizeRequest.config]
completely overrides and replaces the config in the recognizer for this recognition
request.files - Audio files with file metadata for ASR. The maximum number of files allowed to be
specified is 5.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<BatchRecognizeResponse,OperationMetadata> batchRecognizeAsync(BatchRecognizeRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
BatchRecognizeRequest request =
BatchRecognizeRequest.newBuilder()
.setRecognizer(
RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setConfig(RecognitionConfig.newBuilder().build())
.setConfigMask(FieldMask.newBuilder().build())
.addAllFiles(new ArrayList<BatchRecognizeFileMetadata>())
.setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
.build();
BatchRecognizeResponse response = speechClient.batchRecognizeAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<BatchRecognizeRequest,BatchRecognizeResponse,OperationMetadata> batchRecognizeOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
BatchRecognizeRequest request =
BatchRecognizeRequest.newBuilder()
.setRecognizer(
RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setConfig(RecognitionConfig.newBuilder().build())
.setConfigMask(FieldMask.newBuilder().build())
.addAllFiles(new ArrayList<BatchRecognizeFileMetadata>())
.setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
.build();
OperationFuture<BatchRecognizeResponse, OperationMetadata> future =
speechClient.batchRecognizeOperationCallable().futureCall(request);
// Do something.
BatchRecognizeResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<BatchRecognizeRequest,com.google.longrunning.Operation> batchRecognizeCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
BatchRecognizeRequest request =
BatchRecognizeRequest.newBuilder()
.setRecognizer(
RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
.setConfig(RecognitionConfig.newBuilder().build())
.setConfigMask(FieldMask.newBuilder().build())
.addAllFiles(new ArrayList<BatchRecognizeFileMetadata>())
.setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
.build();
ApiFuture<Operation> future = speechClient.batchRecognizeCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final Config getConfig(ConfigName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ConfigName name = ConfigName.of("[PROJECT]", "[LOCATION]");
Config response = speechClient.getConfig(name);
}
name - Required. The name of the config to retrieve. There is exactly one config resource
per project per location. The expected format is
`projects/{project}/locations/{location}/config`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Config getConfig(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = ConfigName.of("[PROJECT]", "[LOCATION]").toString();
Config response = speechClient.getConfig(name);
}
name - Required. The name of the config to retrieve. There is exactly one config resource
per project per location. The expected format is
`projects/{project}/locations/{location}/config`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Config getConfig(GetConfigRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetConfigRequest request =
GetConfigRequest.newBuilder()
.setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString())
.build();
Config response = speechClient.getConfig(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetConfigRequest,Config> getConfigCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetConfigRequest request =
GetConfigRequest.newBuilder()
.setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ApiFuture<Config> future = speechClient.getConfigCallable().futureCall(request);
// Do something.
Config response = future.get();
}
public final Config updateConfig(Config config, com.google.protobuf.FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
Config config = Config.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Config response = speechClient.updateConfig(config, updateMask);
}
config - Required. The config to update.
The config's `name` field is used to identify the config to be updated. The expected format is `projects/{project}/locations/{location}/config`.
updateMask - The list of fields to be updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Config updateConfig(UpdateConfigRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdateConfigRequest request =
UpdateConfigRequest.newBuilder()
.setConfig(Config.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Config response = speechClient.updateConfig(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateConfigRequest,Config> updateConfigCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdateConfigRequest request =
UpdateConfigRequest.newBuilder()
.setConfig(Config.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Config> future = speechClient.updateConfigCallable().futureCall(request);
// Do something.
Config response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> createCustomClassAsync(LocationName parent, CustomClass customClass, String customClassId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
CustomClass customClass = CustomClass.newBuilder().build();
String customClassId = "customClassId1871032322";
CustomClass response =
speechClient.createCustomClassAsync(parent, customClass, customClassId).get();
}
parent - Required. The project and location where this CustomClass will be created. The
expected format is `projects/{project}/locations/{location}`.customClass - Required. The CustomClass to create.customClassId - The ID to use for the CustomClass, which will become the final component
of the CustomClass's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> createCustomClassAsync(String parent, CustomClass customClass, String customClassId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
CustomClass customClass = CustomClass.newBuilder().build();
String customClassId = "customClassId1871032322";
CustomClass response =
speechClient.createCustomClassAsync(parent, customClass, customClassId).get();
}
parent - Required. The project and location where this CustomClass will be created. The
expected format is `projects/{project}/locations/{location}`.customClass - Required. The CustomClass to create.customClassId - The ID to use for the CustomClass, which will become the final component
of the CustomClass's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> createCustomClassAsync(CreateCustomClassRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CreateCustomClassRequest request =
CreateCustomClassRequest.newBuilder()
.setCustomClass(CustomClass.newBuilder().build())
.setValidateOnly(true)
.setCustomClassId("customClassId1871032322")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
CustomClass response = speechClient.createCustomClassAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateCustomClassRequest,CustomClass,OperationMetadata> createCustomClassOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CreateCustomClassRequest request =
CreateCustomClassRequest.newBuilder()
.setCustomClass(CustomClass.newBuilder().build())
.setValidateOnly(true)
.setCustomClassId("customClassId1871032322")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
OperationFuture<CustomClass, OperationMetadata> future =
speechClient.createCustomClassOperationCallable().futureCall(request);
// Do something.
CustomClass response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateCustomClassRequest,com.google.longrunning.Operation> createCustomClassCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CreateCustomClassRequest request =
CreateCustomClassRequest.newBuilder()
.setCustomClass(CustomClass.newBuilder().build())
.setValidateOnly(true)
.setCustomClassId("customClassId1871032322")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ApiFuture<Operation> future = speechClient.createCustomClassCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final SpeechClient.ListCustomClassesPagedResponse listCustomClasses(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The project and location of CustomClass resources to list. The expected
format is `projects/{project}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SpeechClient.ListCustomClassesPagedResponse listCustomClasses(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The project and location of CustomClass resources to list. The expected
format is `projects/{project}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SpeechClient.ListCustomClassesPagedResponse listCustomClasses(ListCustomClassesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListCustomClassesRequest request =
ListCustomClassesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
for (CustomClass element : speechClient.listCustomClasses(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListCustomClassesRequest,SpeechClient.ListCustomClassesPagedResponse> listCustomClassesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListCustomClassesRequest request =
ListCustomClassesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
ApiFuture<CustomClass> future =
speechClient.listCustomClassesPagedCallable().futureCall(request);
// Do something.
for (CustomClass element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListCustomClassesRequest,ListCustomClassesResponse> listCustomClassesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListCustomClassesRequest request =
ListCustomClassesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
while (true) {
ListCustomClassesResponse response = speechClient.listCustomClassesCallable().call(request);
for (CustomClass element : response.getCustomClassesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final CustomClass getCustomClass(CustomClassName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
CustomClass response = speechClient.getCustomClass(name);
}
name - Required. The name of the CustomClass to retrieve. The expected format is
`projects/{project}/locations/{location}/customClasses/{custom_class}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CustomClass getCustomClass(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
CustomClass response = speechClient.getCustomClass(name);
}
name - Required. The name of the CustomClass to retrieve. The expected format is
`projects/{project}/locations/{location}/customClasses/{custom_class}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CustomClass getCustomClass(GetCustomClassRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetCustomClassRequest request =
GetCustomClassRequest.newBuilder()
.setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
.build();
CustomClass response = speechClient.getCustomClass(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetCustomClassRequest,CustomClass> getCustomClassCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetCustomClassRequest request =
GetCustomClassRequest.newBuilder()
.setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
.build();
ApiFuture<CustomClass> future = speechClient.getCustomClassCallable().futureCall(request);
// Do something.
CustomClass response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> updateCustomClassAsync(CustomClass customClass, com.google.protobuf.FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CustomClass customClass = CustomClass.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
CustomClass response = speechClient.updateCustomClassAsync(customClass, updateMask).get();
}
customClass - Required. The CustomClass to update.
The CustomClass's `name` field is used to identify the CustomClass to update. Format: `projects/{project}/locations/{location}/customClasses/{custom_class}`.
updateMask - The list of fields to be updated. If empty, all fields are considered for
update.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> updateCustomClassAsync(UpdateCustomClassRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdateCustomClassRequest request =
UpdateCustomClassRequest.newBuilder()
.setCustomClass(CustomClass.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
CustomClass response = speechClient.updateCustomClassAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateCustomClassRequest,CustomClass,OperationMetadata> updateCustomClassOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdateCustomClassRequest request =
UpdateCustomClassRequest.newBuilder()
.setCustomClass(CustomClass.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
OperationFuture<CustomClass, OperationMetadata> future =
speechClient.updateCustomClassOperationCallable().futureCall(request);
// Do something.
CustomClass response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateCustomClassRequest,com.google.longrunning.Operation> updateCustomClassCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdateCustomClassRequest request =
UpdateCustomClassRequest.newBuilder()
.setCustomClass(CustomClass.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Operation> future = speechClient.updateCustomClassCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> deleteCustomClassAsync(CustomClassName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
CustomClass response = speechClient.deleteCustomClassAsync(name).get();
}
name - Required. The name of the CustomClass to delete. Format:
`projects/{project}/locations/{location}/customClasses/{custom_class}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> deleteCustomClassAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
CustomClass response = speechClient.deleteCustomClassAsync(name).get();
}
name - Required. The name of the CustomClass to delete. Format:
`projects/{project}/locations/{location}/customClasses/{custom_class}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> deleteCustomClassAsync(DeleteCustomClassRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
DeleteCustomClassRequest request =
DeleteCustomClassRequest.newBuilder()
.setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
.setValidateOnly(true)
.setAllowMissing(true)
.setEtag("etag3123477")
.build();
CustomClass response = speechClient.deleteCustomClassAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteCustomClassRequest,CustomClass,OperationMetadata> deleteCustomClassOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
DeleteCustomClassRequest request =
DeleteCustomClassRequest.newBuilder()
.setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
.setValidateOnly(true)
.setAllowMissing(true)
.setEtag("etag3123477")
.build();
OperationFuture<CustomClass, OperationMetadata> future =
speechClient.deleteCustomClassOperationCallable().futureCall(request);
// Do something.
CustomClass response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteCustomClassRequest,com.google.longrunning.Operation> deleteCustomClassCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
DeleteCustomClassRequest request =
DeleteCustomClassRequest.newBuilder()
.setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
.setValidateOnly(true)
.setAllowMissing(true)
.setEtag("etag3123477")
.build();
ApiFuture<Operation> future = speechClient.deleteCustomClassCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> undeleteCustomClassAsync(CustomClassName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
CustomClass response = speechClient.undeleteCustomClassAsync(name).get();
}
name - Required. The name of the CustomClass to undelete. Format:
`projects/{project}/locations/{location}/customClasses/{custom_class}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> undeleteCustomClassAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
CustomClass response = speechClient.undeleteCustomClassAsync(name).get();
}
name - Required. The name of the CustomClass to undelete. Format:
`projects/{project}/locations/{location}/customClasses/{custom_class}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<CustomClass,OperationMetadata> undeleteCustomClassAsync(UndeleteCustomClassRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UndeleteCustomClassRequest request =
UndeleteCustomClassRequest.newBuilder()
.setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
CustomClass response = speechClient.undeleteCustomClassAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UndeleteCustomClassRequest,CustomClass,OperationMetadata> undeleteCustomClassOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UndeleteCustomClassRequest request =
UndeleteCustomClassRequest.newBuilder()
.setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
OperationFuture<CustomClass, OperationMetadata> future =
speechClient.undeleteCustomClassOperationCallable().futureCall(request);
// Do something.
CustomClass response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UndeleteCustomClassRequest,com.google.longrunning.Operation> undeleteCustomClassCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UndeleteCustomClassRequest request =
UndeleteCustomClassRequest.newBuilder()
.setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
ApiFuture<Operation> future = speechClient.undeleteCustomClassCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> createPhraseSetAsync(LocationName parent, PhraseSet phraseSet, String phraseSetId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
PhraseSet phraseSet = PhraseSet.newBuilder().build();
String phraseSetId = "phraseSetId959902180";
PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get();
}
parent - Required. The project and location where this PhraseSet will be created. The
expected format is `projects/{project}/locations/{location}`.phraseSet - Required. The PhraseSet to create.phraseSetId - The ID to use for the PhraseSet, which will become the final component of
the PhraseSet's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> createPhraseSetAsync(String parent, PhraseSet phraseSet, String phraseSetId)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
PhraseSet phraseSet = PhraseSet.newBuilder().build();
String phraseSetId = "phraseSetId959902180";
PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get();
}
parent - Required. The project and location where this PhraseSet will be created. The
expected format is `projects/{project}/locations/{location}`.phraseSet - Required. The PhraseSet to create.phraseSetId - The ID to use for the PhraseSet, which will become the final component of
the PhraseSet's resource name.
This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> createPhraseSetAsync(CreatePhraseSetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CreatePhraseSetRequest request =
CreatePhraseSetRequest.newBuilder()
.setPhraseSet(PhraseSet.newBuilder().build())
.setValidateOnly(true)
.setPhraseSetId("phraseSetId959902180")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
PhraseSet response = speechClient.createPhraseSetAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreatePhraseSetRequest,PhraseSet,OperationMetadata> createPhraseSetOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CreatePhraseSetRequest request =
CreatePhraseSetRequest.newBuilder()
.setPhraseSet(PhraseSet.newBuilder().build())
.setValidateOnly(true)
.setPhraseSetId("phraseSetId959902180")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
OperationFuture<PhraseSet, OperationMetadata> future =
speechClient.createPhraseSetOperationCallable().futureCall(request);
// Do something.
PhraseSet response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreatePhraseSetRequest,com.google.longrunning.Operation> createPhraseSetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
CreatePhraseSetRequest request =
CreatePhraseSetRequest.newBuilder()
.setPhraseSet(PhraseSet.newBuilder().build())
.setValidateOnly(true)
.setPhraseSetId("phraseSetId959902180")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ApiFuture<Operation> future = speechClient.createPhraseSetCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final SpeechClient.ListPhraseSetsPagedResponse listPhraseSets(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The project and location of PhraseSet resources to list. The expected
format is `projects/{project}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SpeechClient.ListPhraseSetsPagedResponse listPhraseSets(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The project and location of PhraseSet resources to list. The expected
format is `projects/{project}/locations/{location}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SpeechClient.ListPhraseSetsPagedResponse listPhraseSets(ListPhraseSetsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListPhraseSetsRequest request =
ListPhraseSetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
for (PhraseSet element : speechClient.listPhraseSets(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListPhraseSetsRequest,SpeechClient.ListPhraseSetsPagedResponse> listPhraseSetsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListPhraseSetsRequest request =
ListPhraseSetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
ApiFuture<PhraseSet> future = speechClient.listPhraseSetsPagedCallable().futureCall(request);
// Do something.
for (PhraseSet element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListPhraseSetsRequest,ListPhraseSetsResponse> listPhraseSetsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListPhraseSetsRequest request =
ListPhraseSetsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setShowDeleted(true)
.build();
while (true) {
ListPhraseSetsResponse response = speechClient.listPhraseSetsCallable().call(request);
for (PhraseSet element : response.getPhraseSetsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final PhraseSet getPhraseSet(PhraseSetName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
PhraseSet response = speechClient.getPhraseSet(name);
}
name - Required. The name of the PhraseSet to retrieve. The expected format is
`projects/{project}/locations/{location}/phraseSets/{phrase_set}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PhraseSet getPhraseSet(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
PhraseSet response = speechClient.getPhraseSet(name);
}
name - Required. The name of the PhraseSet to retrieve. The expected format is
`projects/{project}/locations/{location}/phraseSets/{phrase_set}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final PhraseSet getPhraseSet(GetPhraseSetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetPhraseSetRequest request =
GetPhraseSetRequest.newBuilder()
.setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
.build();
PhraseSet response = speechClient.getPhraseSet(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetPhraseSetRequest,PhraseSet> getPhraseSetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetPhraseSetRequest request =
GetPhraseSetRequest.newBuilder()
.setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
.build();
ApiFuture<PhraseSet> future = speechClient.getPhraseSetCallable().futureCall(request);
// Do something.
PhraseSet response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> updatePhraseSetAsync(PhraseSet phraseSet, com.google.protobuf.FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
PhraseSet phraseSet = PhraseSet.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
PhraseSet response = speechClient.updatePhraseSetAsync(phraseSet, updateMask).get();
}
phraseSet - Required. The PhraseSet to update.
The PhraseSet's `name` field is used to identify the PhraseSet to update. Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
updateMask - The list of fields to update. If empty, all non-default valued fields are
considered for update. Use `*` to update the entire PhraseSet resource.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> updatePhraseSetAsync(UpdatePhraseSetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdatePhraseSetRequest request =
UpdatePhraseSetRequest.newBuilder()
.setPhraseSet(PhraseSet.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
PhraseSet response = speechClient.updatePhraseSetAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdatePhraseSetRequest,PhraseSet,OperationMetadata> updatePhraseSetOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdatePhraseSetRequest request =
UpdatePhraseSetRequest.newBuilder()
.setPhraseSet(PhraseSet.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
OperationFuture<PhraseSet, OperationMetadata> future =
speechClient.updatePhraseSetOperationCallable().futureCall(request);
// Do something.
PhraseSet response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdatePhraseSetRequest,com.google.longrunning.Operation> updatePhraseSetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UpdatePhraseSetRequest request =
UpdatePhraseSetRequest.newBuilder()
.setPhraseSet(PhraseSet.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.setValidateOnly(true)
.build();
ApiFuture<Operation> future = speechClient.updatePhraseSetCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> deletePhraseSetAsync(PhraseSetName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
PhraseSet response = speechClient.deletePhraseSetAsync(name).get();
}
name - Required. The name of the PhraseSet to delete. Format:
`projects/{project}/locations/{location}/phraseSets/{phrase_set}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> deletePhraseSetAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
PhraseSet response = speechClient.deletePhraseSetAsync(name).get();
}
name - Required. The name of the PhraseSet to delete. Format:
`projects/{project}/locations/{location}/phraseSets/{phrase_set}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> deletePhraseSetAsync(DeletePhraseSetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
DeletePhraseSetRequest request =
DeletePhraseSetRequest.newBuilder()
.setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
.setValidateOnly(true)
.setAllowMissing(true)
.setEtag("etag3123477")
.build();
PhraseSet response = speechClient.deletePhraseSetAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeletePhraseSetRequest,PhraseSet,OperationMetadata> deletePhraseSetOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
DeletePhraseSetRequest request =
DeletePhraseSetRequest.newBuilder()
.setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
.setValidateOnly(true)
.setAllowMissing(true)
.setEtag("etag3123477")
.build();
OperationFuture<PhraseSet, OperationMetadata> future =
speechClient.deletePhraseSetOperationCallable().futureCall(request);
// Do something.
PhraseSet response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeletePhraseSetRequest,com.google.longrunning.Operation> deletePhraseSetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
DeletePhraseSetRequest request =
DeletePhraseSetRequest.newBuilder()
.setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
.setValidateOnly(true)
.setAllowMissing(true)
.setEtag("etag3123477")
.build();
ApiFuture<Operation> future = speechClient.deletePhraseSetCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> undeletePhraseSetAsync(PhraseSetName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
PhraseSet response = speechClient.undeletePhraseSetAsync(name).get();
}
name - Required. The name of the PhraseSet to undelete. Format:
`projects/{project}/locations/{location}/phraseSets/{phrase_set}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> undeletePhraseSetAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
PhraseSet response = speechClient.undeletePhraseSetAsync(name).get();
}
name - Required. The name of the PhraseSet to undelete. Format:
`projects/{project}/locations/{location}/phraseSets/{phrase_set}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<PhraseSet,OperationMetadata> undeletePhraseSetAsync(UndeletePhraseSetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UndeletePhraseSetRequest request =
UndeletePhraseSetRequest.newBuilder()
.setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
PhraseSet response = speechClient.undeletePhraseSetAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UndeletePhraseSetRequest,PhraseSet,OperationMetadata> undeletePhraseSetOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UndeletePhraseSetRequest request =
UndeletePhraseSetRequest.newBuilder()
.setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
OperationFuture<PhraseSet, OperationMetadata> future =
speechClient.undeletePhraseSetOperationCallable().futureCall(request);
// Do something.
PhraseSet response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UndeletePhraseSetRequest,com.google.longrunning.Operation> undeletePhraseSetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
UndeletePhraseSetRequest request =
UndeletePhraseSetRequest.newBuilder()
.setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
.setValidateOnly(true)
.setEtag("etag3123477")
.build();
ApiFuture<Operation> future = speechClient.undeletePhraseSetCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final SpeechClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : speechClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,SpeechClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future = speechClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = speechClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = speechClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SpeechClient speechClient = SpeechClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = speechClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.