Class AdaptationClient (2.5.2)

public class AdaptationClient implements BackgroundResource

Service Description: Service that implements Google Cloud Speech Adaptation API.

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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   PhraseSet phraseSet = PhraseSet.newBuilder().build();
   String phraseSetId = "phraseSetId959902180";
   PhraseSet response = adaptationClient.createPhraseSet(parent, phraseSet, phraseSetId);
 }
 

Note: close() needs to be called on the AdaptationClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns 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 AdaptationSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 AdaptationSettings adaptationSettings =
     AdaptationSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 AdaptationClient adaptationClient = AdaptationClient.create(adaptationSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 AdaptationSettings adaptationSettings =
     AdaptationSettings.newBuilder().setEndpoint(myEndpoint).build();
 AdaptationClient adaptationClient = AdaptationClient.create(adaptationSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 AdaptationSettings adaptationSettings =
     AdaptationSettings.newBuilder()
         .setTransportChannelProvider(
             AdaptationSettings.defaultHttpJsonTransportProviderBuilder().build())
         .build();
 AdaptationClient adaptationClient = AdaptationClient.create(adaptationSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > AdaptationClient

Implements

BackgroundResource

Static Methods

create()

public static final AdaptationClient create()

Constructs an instance of AdaptationClient with default settings.

Returns
TypeDescription
AdaptationClient
Exceptions
TypeDescription
IOException

create(AdaptationSettings settings)

public static final AdaptationClient create(AdaptationSettings settings)

Constructs an instance of AdaptationClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsAdaptationSettings
Returns
TypeDescription
AdaptationClient
Exceptions
TypeDescription
IOException

create(AdaptationStub stub)

public static final AdaptationClient create(AdaptationStub stub)

Constructs an instance of AdaptationClient, using the given stub for making calls. This is for advanced usage - prefer using create(AdaptationSettings).

Parameter
NameDescription
stubAdaptationStub
Returns
TypeDescription
AdaptationClient

Constructors

AdaptationClient(AdaptationSettings settings)

protected AdaptationClient(AdaptationSettings settings)

Constructs an instance of AdaptationClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsAdaptationSettings

AdaptationClient(AdaptationStub stub)

protected AdaptationClient(AdaptationStub stub)
Parameter
NameDescription
stubAdaptationStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createCustomClass(CreateCustomClassRequest request)

public final CustomClass createCustomClass(CreateCustomClassRequest request)

Create a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   CreateCustomClassRequest request =
       CreateCustomClassRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setCustomClassId("customClassId1871032322")
           .setCustomClass(CustomClass.newBuilder().build())
           .build();
   CustomClass response = adaptationClient.createCustomClass(request);
 }
 
Parameter
NameDescription
requestCreateCustomClassRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
CustomClass

createCustomClass(LocationName parent, CustomClass customClass, String customClassId)

public final CustomClass createCustomClass(LocationName parent, CustomClass customClass, String customClassId)

Create a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   CustomClass customClass = CustomClass.newBuilder().build();
   String customClassId = "customClassId1871032322";
   CustomClass response = adaptationClient.createCustomClass(parent, customClass, customClassId);
 }
 
Parameters
NameDescription
parentLocationName

Required. The parent resource where this custom class will be created. Format:

projects/{project}/locations/{location}/customClasses

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

customClassCustomClass

Required. The custom class to create.

customClassIdString

Required. The ID to use for the custom class, which will become the final component of the custom class' resource name.

This value should restrict to letters, numbers, and hyphens, with the first character a letter, the last a letter or a number, and be 4-63 characters.

Returns
TypeDescription
CustomClass

createCustomClass(String parent, CustomClass customClass, String customClassId)

public final CustomClass createCustomClass(String parent, CustomClass customClass, String customClassId)

Create a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   CustomClass customClass = CustomClass.newBuilder().build();
   String customClassId = "customClassId1871032322";
   CustomClass response = adaptationClient.createCustomClass(parent, customClass, customClassId);
 }
 
Parameters
NameDescription
parentString

Required. The parent resource where this custom class will be created. Format:

projects/{project}/locations/{location}/customClasses

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

customClassCustomClass

Required. The custom class to create.

customClassIdString

Required. The ID to use for the custom class, which will become the final component of the custom class' resource name.

This value should restrict to letters, numbers, and hyphens, with the first character a letter, the last a letter or a number, and be 4-63 characters.

Returns
TypeDescription
CustomClass

createCustomClassCallable()

public final UnaryCallable<CreateCustomClassRequest,CustomClass> createCustomClassCallable()

Create a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   CreateCustomClassRequest request =
       CreateCustomClassRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setCustomClassId("customClassId1871032322")
           .setCustomClass(CustomClass.newBuilder().build())
           .build();
   ApiFuture<CustomClass> future =
       adaptationClient.createCustomClassCallable().futureCall(request);
   // Do something.
   CustomClass response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateCustomClassRequest,CustomClass>

createPhraseSet(CreatePhraseSetRequest request)

public final PhraseSet createPhraseSet(CreatePhraseSetRequest request)

Create a set of phrase hints. Each item in the set can be a single word or a multi-word phrase. The items in the PhraseSet are favored by the recognition model when you send a call that includes the PhraseSet.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   CreatePhraseSetRequest request =
       CreatePhraseSetRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPhraseSetId("phraseSetId959902180")
           .setPhraseSet(PhraseSet.newBuilder().build())
           .build();
   PhraseSet response = adaptationClient.createPhraseSet(request);
 }
 
Parameter
NameDescription
requestCreatePhraseSetRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
PhraseSet

createPhraseSet(LocationName parent, PhraseSet phraseSet, String phraseSetId)

public final PhraseSet createPhraseSet(LocationName parent, PhraseSet phraseSet, String phraseSetId)

Create a set of phrase hints. Each item in the set can be a single word or a multi-word phrase. The items in the PhraseSet are favored by the recognition model when you send a call that includes the PhraseSet.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   PhraseSet phraseSet = PhraseSet.newBuilder().build();
   String phraseSetId = "phraseSetId959902180";
   PhraseSet response = adaptationClient.createPhraseSet(parent, phraseSet, phraseSetId);
 }
 
Parameters
NameDescription
parentLocationName

Required. The parent resource where this phrase set will be created. Format:

projects/{project}/locations/{location}/phraseSets

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

phraseSetPhraseSet

Required. The phrase set to create.

phraseSetIdString

Required. The ID to use for the phrase set, which will become the final component of the phrase set's resource name.

This value should restrict to letters, numbers, and hyphens, with the first character a letter, the last a letter or a number, and be 4-63 characters.

Returns
TypeDescription
PhraseSet

createPhraseSet(String parent, PhraseSet phraseSet, String phraseSetId)

public final PhraseSet createPhraseSet(String parent, PhraseSet phraseSet, String phraseSetId)

Create a set of phrase hints. Each item in the set can be a single word or a multi-word phrase. The items in the PhraseSet are favored by the recognition model when you send a call that includes the PhraseSet.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   PhraseSet phraseSet = PhraseSet.newBuilder().build();
   String phraseSetId = "phraseSetId959902180";
   PhraseSet response = adaptationClient.createPhraseSet(parent, phraseSet, phraseSetId);
 }
 
Parameters
NameDescription
parentString

Required. The parent resource where this phrase set will be created. Format:

projects/{project}/locations/{location}/phraseSets

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

phraseSetPhraseSet

Required. The phrase set to create.

phraseSetIdString

Required. The ID to use for the phrase set, which will become the final component of the phrase set's resource name.

This value should restrict to letters, numbers, and hyphens, with the first character a letter, the last a letter or a number, and be 4-63 characters.

Returns
TypeDescription
PhraseSet

createPhraseSetCallable()

public final UnaryCallable<CreatePhraseSetRequest,PhraseSet> createPhraseSetCallable()

Create a set of phrase hints. Each item in the set can be a single word or a multi-word phrase. The items in the PhraseSet are favored by the recognition model when you send a call that includes the PhraseSet.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   CreatePhraseSetRequest request =
       CreatePhraseSetRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPhraseSetId("phraseSetId959902180")
           .setPhraseSet(PhraseSet.newBuilder().build())
           .build();
   ApiFuture<PhraseSet> future = adaptationClient.createPhraseSetCallable().futureCall(request);
   // Do something.
   PhraseSet response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreatePhraseSetRequest,PhraseSet>

deleteCustomClass(CustomClassName name)

public final void deleteCustomClass(CustomClassName name)

Delete a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
   adaptationClient.deleteCustomClass(name);
 }
 
Parameter
NameDescription
nameCustomClassName

Required. The name of the custom class to delete. Format:

projects/{project}/locations/{location}/customClasses/{custom_class}

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

deleteCustomClass(DeleteCustomClassRequest request)

public final void deleteCustomClass(DeleteCustomClassRequest request)

Delete a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   DeleteCustomClassRequest request =
       DeleteCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .build();
   adaptationClient.deleteCustomClass(request);
 }
 
Parameter
NameDescription
requestDeleteCustomClassRequest

The request object containing all of the parameters for the API call.

deleteCustomClass(String name)

public final void deleteCustomClass(String name)

Delete a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
   adaptationClient.deleteCustomClass(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the custom class to delete. Format:

projects/{project}/locations/{location}/customClasses/{custom_class}

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

deleteCustomClassCallable()

public final UnaryCallable<DeleteCustomClassRequest,Empty> deleteCustomClassCallable()

Delete a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   DeleteCustomClassRequest request =
       DeleteCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .build();
   ApiFuture<Empty> future = adaptationClient.deleteCustomClassCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteCustomClassRequest,Empty>

deletePhraseSet(DeletePhraseSetRequest request)

public final void deletePhraseSet(DeletePhraseSetRequest request)

Delete a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   DeletePhraseSetRequest request =
       DeletePhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .build();
   adaptationClient.deletePhraseSet(request);
 }
 
Parameter
NameDescription
requestDeletePhraseSetRequest

The request object containing all of the parameters for the API call.

deletePhraseSet(PhraseSetName name)

public final void deletePhraseSet(PhraseSetName name)

Delete a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
   adaptationClient.deletePhraseSet(name);
 }
 
Parameter
NameDescription
namePhraseSetName

Required. The name of the phrase set to delete. Format:

projects/{project}/locations/{location}/phraseSets/{phrase_set}

deletePhraseSet(String name)

public final void deletePhraseSet(String name)

Delete a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
   adaptationClient.deletePhraseSet(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the phrase set to delete. Format:

projects/{project}/locations/{location}/phraseSets/{phrase_set}

deletePhraseSetCallable()

public final UnaryCallable<DeletePhraseSetRequest,Empty> deletePhraseSetCallable()

Delete a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   DeletePhraseSetRequest request =
       DeletePhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .build();
   ApiFuture<Empty> future = adaptationClient.deletePhraseSetCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeletePhraseSetRequest,Empty>

getCustomClass(CustomClassName name)

public final CustomClass getCustomClass(CustomClassName name)

Get a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
   CustomClass response = adaptationClient.getCustomClass(name);
 }
 
Parameter
NameDescription
nameCustomClassName

Required. The name of the custom class to retrieve. Format:

projects/{project}/locations/{location}/customClasses/{custom_class}

Returns
TypeDescription
CustomClass

getCustomClass(GetCustomClassRequest request)

public final CustomClass getCustomClass(GetCustomClassRequest request)

Get a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   GetCustomClassRequest request =
       GetCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .build();
   CustomClass response = adaptationClient.getCustomClass(request);
 }
 
Parameter
NameDescription
requestGetCustomClassRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
CustomClass

getCustomClass(String name)

public final CustomClass getCustomClass(String name)

Get a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
   CustomClass response = adaptationClient.getCustomClass(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the custom class to retrieve. Format:

projects/{project}/locations/{location}/customClasses/{custom_class}

Returns
TypeDescription
CustomClass

getCustomClassCallable()

public final UnaryCallable<GetCustomClassRequest,CustomClass> getCustomClassCallable()

Get a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   GetCustomClassRequest request =
       GetCustomClassRequest.newBuilder()
           .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
           .build();
   ApiFuture<CustomClass> future = adaptationClient.getCustomClassCallable().futureCall(request);
   // Do something.
   CustomClass response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetCustomClassRequest,CustomClass>

getPhraseSet(GetPhraseSetRequest request)

public final PhraseSet getPhraseSet(GetPhraseSetRequest request)

Get a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   GetPhraseSetRequest request =
       GetPhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .build();
   PhraseSet response = adaptationClient.getPhraseSet(request);
 }
 
Parameter
NameDescription
requestGetPhraseSetRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
PhraseSet

getPhraseSet(PhraseSetName name)

public final PhraseSet getPhraseSet(PhraseSetName name)

Get a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
   PhraseSet response = adaptationClient.getPhraseSet(name);
 }
 
Parameter
NameDescription
namePhraseSetName

Required. The name of the phrase set to retrieve. Format:

projects/{project}/locations/{location}/phraseSets/{phrase_set}

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

Returns
TypeDescription
PhraseSet

getPhraseSet(String name)

public final PhraseSet getPhraseSet(String name)

Get a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
   PhraseSet response = adaptationClient.getPhraseSet(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the phrase set to retrieve. Format:

projects/{project}/locations/{location}/phraseSets/{phrase_set}

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

Returns
TypeDescription
PhraseSet

getPhraseSetCallable()

public final UnaryCallable<GetPhraseSetRequest,PhraseSet> getPhraseSetCallable()

Get a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   GetPhraseSetRequest request =
       GetPhraseSetRequest.newBuilder()
           .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
           .build();
   ApiFuture<PhraseSet> future = adaptationClient.getPhraseSetCallable().futureCall(request);
   // Do something.
   PhraseSet response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetPhraseSetRequest,PhraseSet>

getSettings()

public final AdaptationSettings getSettings()
Returns
TypeDescription
AdaptationSettings

getStub()

public AdaptationStub getStub()
Returns
TypeDescription
AdaptationStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listCustomClasses(ListCustomClassesRequest request)

public final AdaptationClient.ListCustomClassesPagedResponse listCustomClasses(ListCustomClassesRequest request)

List custom classes.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   ListCustomClassesRequest request =
       ListCustomClassesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (CustomClass element : adaptationClient.listCustomClasses(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListCustomClassesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
AdaptationClient.ListCustomClassesPagedResponse

listCustomClasses(LocationName parent)

public final AdaptationClient.ListCustomClassesPagedResponse listCustomClasses(LocationName parent)

List custom classes.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (CustomClass element : adaptationClient.listCustomClasses(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The parent, which owns this collection of custom classes. Format:

projects/{project}/locations/{location}/customClasses

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

Returns
TypeDescription
AdaptationClient.ListCustomClassesPagedResponse

listCustomClasses(String parent)

public final AdaptationClient.ListCustomClassesPagedResponse listCustomClasses(String parent)

List custom classes.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (CustomClass element : adaptationClient.listCustomClasses(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The parent, which owns this collection of custom classes. Format:

projects/{project}/locations/{location}/customClasses

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

Returns
TypeDescription
AdaptationClient.ListCustomClassesPagedResponse

listCustomClassesCallable()

public final UnaryCallable<ListCustomClassesRequest,ListCustomClassesResponse> listCustomClassesCallable()

List custom classes.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   ListCustomClassesRequest request =
       ListCustomClassesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListCustomClassesResponse response =
         adaptationClient.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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListCustomClassesRequest,ListCustomClassesResponse>

listCustomClassesPagedCallable()

public final UnaryCallable<ListCustomClassesRequest,AdaptationClient.ListCustomClassesPagedResponse> listCustomClassesPagedCallable()

List custom classes.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   ListCustomClassesRequest request =
       ListCustomClassesRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<CustomClass> future =
       adaptationClient.listCustomClassesPagedCallable().futureCall(request);
   // Do something.
   for (CustomClass element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListCustomClassesRequest,ListCustomClassesPagedResponse>

listPhraseSet(ListPhraseSetRequest request)

public final AdaptationClient.ListPhraseSetPagedResponse listPhraseSet(ListPhraseSetRequest request)

List phrase sets.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   ListPhraseSetRequest request =
       ListPhraseSetRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (PhraseSet element : adaptationClient.listPhraseSet(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListPhraseSetRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
AdaptationClient.ListPhraseSetPagedResponse

listPhraseSet(LocationName parent)

public final AdaptationClient.ListPhraseSetPagedResponse listPhraseSet(LocationName parent)

List phrase sets.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (PhraseSet element : adaptationClient.listPhraseSet(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The parent, which owns this collection of phrase set. Format:

projects/{project}/locations/{location}

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

Returns
TypeDescription
AdaptationClient.ListPhraseSetPagedResponse

listPhraseSet(String parent)

public final AdaptationClient.ListPhraseSetPagedResponse listPhraseSet(String parent)

List phrase sets.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (PhraseSet element : adaptationClient.listPhraseSet(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The parent, which owns this collection of phrase set. Format:

projects/{project}/locations/{location}

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

Returns
TypeDescription
AdaptationClient.ListPhraseSetPagedResponse

listPhraseSetCallable()

public final UnaryCallable<ListPhraseSetRequest,ListPhraseSetResponse> listPhraseSetCallable()

List phrase sets.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   ListPhraseSetRequest request =
       ListPhraseSetRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListPhraseSetResponse response = adaptationClient.listPhraseSetCallable().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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListPhraseSetRequest,ListPhraseSetResponse>

listPhraseSetPagedCallable()

public final UnaryCallable<ListPhraseSetRequest,AdaptationClient.ListPhraseSetPagedResponse> listPhraseSetPagedCallable()

List phrase sets.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   ListPhraseSetRequest request =
       ListPhraseSetRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<PhraseSet> future =
       adaptationClient.listPhraseSetPagedCallable().futureCall(request);
   // Do something.
   for (PhraseSet element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListPhraseSetRequest,ListPhraseSetPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateCustomClass(CustomClass customClass, FieldMask updateMask)

public final CustomClass updateCustomClass(CustomClass customClass, FieldMask updateMask)

Update a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   CustomClass customClass = CustomClass.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   CustomClass response = adaptationClient.updateCustomClass(customClass, updateMask);
 }
 
Parameters
NameDescription
customClassCustomClass

Required. The custom class to update.

The custom class's name field is used to identify the custom class to be updated. Format:

projects/{project}/locations/{location}/customClasses/{custom_class}

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

updateMaskFieldMask

The list of fields to be updated.

Returns
TypeDescription
CustomClass

updateCustomClass(UpdateCustomClassRequest request)

public final CustomClass updateCustomClass(UpdateCustomClassRequest request)

Update a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   UpdateCustomClassRequest request =
       UpdateCustomClassRequest.newBuilder()
           .setCustomClass(CustomClass.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   CustomClass response = adaptationClient.updateCustomClass(request);
 }
 
Parameter
NameDescription
requestUpdateCustomClassRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
CustomClass

updateCustomClassCallable()

public final UnaryCallable<UpdateCustomClassRequest,CustomClass> updateCustomClassCallable()

Update a custom class.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   UpdateCustomClassRequest request =
       UpdateCustomClassRequest.newBuilder()
           .setCustomClass(CustomClass.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<CustomClass> future =
       adaptationClient.updateCustomClassCallable().futureCall(request);
   // Do something.
   CustomClass response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateCustomClassRequest,CustomClass>

updatePhraseSet(PhraseSet phraseSet, FieldMask updateMask)

public final PhraseSet updatePhraseSet(PhraseSet phraseSet, FieldMask updateMask)

Update a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   PhraseSet phraseSet = PhraseSet.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   PhraseSet response = adaptationClient.updatePhraseSet(phraseSet, updateMask);
 }
 
Parameters
NameDescription
phraseSetPhraseSet

Required. The phrase set to update.

The phrase set's name field is used to identify the set to be updated. Format:

projects/{project}/locations/{location}/phraseSets/{phrase_set}

Speech-to-Text supports three locations: global, us (US North America), and eu (Europe). If you are calling the speech.googleapis.com endpoint, use the global location. To specify a region, use a regional endpoint with matching us or eu location value.

updateMaskFieldMask

The list of fields to be updated.

Returns
TypeDescription
PhraseSet

updatePhraseSet(UpdatePhraseSetRequest request)

public final PhraseSet updatePhraseSet(UpdatePhraseSetRequest request)

Update a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   UpdatePhraseSetRequest request =
       UpdatePhraseSetRequest.newBuilder()
           .setPhraseSet(PhraseSet.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   PhraseSet response = adaptationClient.updatePhraseSet(request);
 }
 
Parameter
NameDescription
requestUpdatePhraseSetRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
PhraseSet

updatePhraseSetCallable()

public final UnaryCallable<UpdatePhraseSetRequest,PhraseSet> updatePhraseSetCallable()

Update a phrase set.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (AdaptationClient adaptationClient = AdaptationClient.create()) {
   UpdatePhraseSetRequest request =
       UpdatePhraseSetRequest.newBuilder()
           .setPhraseSet(PhraseSet.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<PhraseSet> future = adaptationClient.updatePhraseSetCallable().futureCall(request);
   // Do something.
   PhraseSet response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdatePhraseSetRequest,PhraseSet>