Class AdaptationClient
- java.lang.Object
-
- com.google.cloud.speech.v1p1beta1.AdaptationClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@BetaApi @Generated("by gapic-generator-java") public class AdaptationClient extends Object implements com.google.api.gax.core.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 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 (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:
- 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.
- 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.
- 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 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 AdaptationSettings adaptationSettings = AdaptationSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); AdaptationClient adaptationClient = AdaptationClient.create(adaptationSettings);
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 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 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 AdaptationSettings adaptationSettings = AdaptationSettings.newHttpJsonBuilder().build(); AdaptationClient adaptationClient = AdaptationClient.create(adaptationSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AdaptationClient.ListCustomClassesFixedSizeCollection
static class
AdaptationClient.ListCustomClassesPage
static class
AdaptationClient.ListCustomClassesPagedResponse
static class
AdaptationClient.ListPhraseSetFixedSizeCollection
static class
AdaptationClient.ListPhraseSetPage
static class
AdaptationClient.ListPhraseSetPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
AdaptationClient(AdaptationSettings settings)
Constructs an instance of AdaptationClient, using the given settings.protected
AdaptationClient(AdaptationStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static AdaptationClient
create()
Constructs an instance of AdaptationClient with default settings.static AdaptationClient
create(AdaptationSettings settings)
Constructs an instance of AdaptationClient, using the given settings.static AdaptationClient
create(AdaptationStub stub)
Constructs an instance of AdaptationClient, using the given stub for making calls.CustomClass
createCustomClass(CreateCustomClassRequest request)
Create a custom class.CustomClass
createCustomClass(LocationName parent, CustomClass customClass, String customClassId)
Create a custom class.CustomClass
createCustomClass(String parent, CustomClass customClass, String customClassId)
Create a custom class.com.google.api.gax.rpc.UnaryCallable<CreateCustomClassRequest,CustomClass>
createCustomClassCallable()
Create a custom class.PhraseSet
createPhraseSet(CreatePhraseSetRequest request)
Create a set of phrase hints.PhraseSet
createPhraseSet(LocationName parent, PhraseSet phraseSet, String phraseSetId)
Create a set of phrase hints.PhraseSet
createPhraseSet(String parent, PhraseSet phraseSet, String phraseSetId)
Create a set of phrase hints.com.google.api.gax.rpc.UnaryCallable<CreatePhraseSetRequest,PhraseSet>
createPhraseSetCallable()
Create a set of phrase hints.void
deleteCustomClass(CustomClassName name)
Delete a custom class.void
deleteCustomClass(DeleteCustomClassRequest request)
Delete a custom class.void
deleteCustomClass(String name)
Delete a custom class.com.google.api.gax.rpc.UnaryCallable<DeleteCustomClassRequest,com.google.protobuf.Empty>
deleteCustomClassCallable()
Delete a custom class.void
deletePhraseSet(DeletePhraseSetRequest request)
Delete a phrase set.void
deletePhraseSet(PhraseSetName name)
Delete a phrase set.void
deletePhraseSet(String name)
Delete a phrase set.com.google.api.gax.rpc.UnaryCallable<DeletePhraseSetRequest,com.google.protobuf.Empty>
deletePhraseSetCallable()
Delete a phrase set.CustomClass
getCustomClass(CustomClassName name)
Get a custom class.CustomClass
getCustomClass(GetCustomClassRequest request)
Get a custom class.CustomClass
getCustomClass(String name)
Get a custom class.com.google.api.gax.rpc.UnaryCallable<GetCustomClassRequest,CustomClass>
getCustomClassCallable()
Get a custom class.PhraseSet
getPhraseSet(GetPhraseSetRequest request)
Get a phrase set.PhraseSet
getPhraseSet(PhraseSetName name)
Get a phrase set.PhraseSet
getPhraseSet(String name)
Get a phrase set.com.google.api.gax.rpc.UnaryCallable<GetPhraseSetRequest,PhraseSet>
getPhraseSetCallable()
Get a phrase set.AdaptationSettings
getSettings()
AdaptationStub
getStub()
boolean
isShutdown()
boolean
isTerminated()
AdaptationClient.ListCustomClassesPagedResponse
listCustomClasses(ListCustomClassesRequest request)
List custom classes.AdaptationClient.ListCustomClassesPagedResponse
listCustomClasses(LocationName parent)
List custom classes.AdaptationClient.ListCustomClassesPagedResponse
listCustomClasses(String parent)
List custom classes.com.google.api.gax.rpc.UnaryCallable<ListCustomClassesRequest,ListCustomClassesResponse>
listCustomClassesCallable()
List custom classes.com.google.api.gax.rpc.UnaryCallable<ListCustomClassesRequest,AdaptationClient.ListCustomClassesPagedResponse>
listCustomClassesPagedCallable()
List custom classes.AdaptationClient.ListPhraseSetPagedResponse
listPhraseSet(ListPhraseSetRequest request)
List phrase sets.AdaptationClient.ListPhraseSetPagedResponse
listPhraseSet(LocationName parent)
List phrase sets.AdaptationClient.ListPhraseSetPagedResponse
listPhraseSet(String parent)
List phrase sets.com.google.api.gax.rpc.UnaryCallable<ListPhraseSetRequest,ListPhraseSetResponse>
listPhraseSetCallable()
List phrase sets.com.google.api.gax.rpc.UnaryCallable<ListPhraseSetRequest,AdaptationClient.ListPhraseSetPagedResponse>
listPhraseSetPagedCallable()
List phrase sets.void
shutdown()
void
shutdownNow()
CustomClass
updateCustomClass(CustomClass customClass, com.google.protobuf.FieldMask updateMask)
Update a custom class.CustomClass
updateCustomClass(UpdateCustomClassRequest request)
Update a custom class.com.google.api.gax.rpc.UnaryCallable<UpdateCustomClassRequest,CustomClass>
updateCustomClassCallable()
Update a custom class.PhraseSet
updatePhraseSet(PhraseSet phraseSet, com.google.protobuf.FieldMask updateMask)
Update a phrase set.PhraseSet
updatePhraseSet(UpdatePhraseSetRequest request)
Update a phrase set.com.google.api.gax.rpc.UnaryCallable<UpdatePhraseSetRequest,PhraseSet>
updatePhraseSetCallable()
Update a phrase set.
-
-
-
Constructor Detail
-
AdaptationClient
protected AdaptationClient(AdaptationSettings settings) throws IOException
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.- Throws:
IOException
-
AdaptationClient
protected AdaptationClient(AdaptationStub stub)
-
-
Method Detail
-
create
public static final AdaptationClient create() throws IOException
Constructs an instance of AdaptationClient with default settings.- Throws:
IOException
-
create
public static final AdaptationClient create(AdaptationSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final AdaptationSettings getSettings()
-
getStub
public AdaptationStub getStub()
-
createPhraseSet
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 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 (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:
parent
- Required. The parent resource where this phrase set will be created. 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
phraseSet
- Required. The phrase set to create.phraseSetId
- 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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createPhraseSet
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 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 (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:
parent
- Required. The parent resource where this phrase set will be created. 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
phraseSet
- Required. The phrase set to create.phraseSetId
- 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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createPhraseSet
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 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 (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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createPhraseSetCallable
public final com.google.api.gax.rpc.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 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 (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(); }
-
getPhraseSet
public final PhraseSet getPhraseSet(PhraseSetName name)
Get a phrase set.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); PhraseSet response = adaptationClient.getPhraseSet(name); }
- Parameters:
name
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getPhraseSet
public final PhraseSet getPhraseSet(String name)
Get a phrase set.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString(); PhraseSet response = adaptationClient.getPhraseSet(name); }
- Parameters:
name
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getPhraseSet
public final PhraseSet getPhraseSet(GetPhraseSetRequest request)
Get a phrase set.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { GetPhraseSetRequest request = GetPhraseSetRequest.newBuilder() .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) .build(); PhraseSet response = adaptationClient.getPhraseSet(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getPhraseSetCallable
public final com.google.api.gax.rpc.UnaryCallable<GetPhraseSetRequest,PhraseSet> getPhraseSetCallable()
Get a phrase set.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 (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(); }
-
listPhraseSet
public final AdaptationClient.ListPhraseSetPagedResponse listPhraseSet(LocationName parent)
List phrase sets.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (PhraseSet element : adaptationClient.listPhraseSet(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listPhraseSet
public final AdaptationClient.ListPhraseSetPagedResponse listPhraseSet(String parent)
List phrase sets.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (PhraseSet element : adaptationClient.listPhraseSet(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listPhraseSet
public final AdaptationClient.ListPhraseSetPagedResponse listPhraseSet(ListPhraseSetRequest request)
List phrase sets.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 (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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listPhraseSetPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListPhraseSetRequest,AdaptationClient.ListPhraseSetPagedResponse> listPhraseSetPagedCallable()
List phrase sets.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 (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); } }
-
listPhraseSetCallable
public final com.google.api.gax.rpc.UnaryCallable<ListPhraseSetRequest,ListPhraseSetResponse> listPhraseSetCallable()
List phrase sets.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 (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; } } }
-
updatePhraseSet
public final PhraseSet updatePhraseSet(PhraseSet phraseSet, com.google.protobuf.FieldMask updateMask)
Update a phrase set.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { PhraseSet phraseSet = PhraseSet.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); PhraseSet response = adaptationClient.updatePhraseSet(phraseSet, updateMask); }
- Parameters:
phraseSet
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
updateMask
- The list of fields to be updated.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updatePhraseSet
public final PhraseSet updatePhraseSet(UpdatePhraseSetRequest request)
Update a phrase set.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { UpdatePhraseSetRequest request = UpdatePhraseSetRequest.newBuilder() .setPhraseSet(PhraseSet.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); PhraseSet response = adaptationClient.updatePhraseSet(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updatePhraseSetCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdatePhraseSetRequest,PhraseSet> updatePhraseSetCallable()
Update a phrase set.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 (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(); }
-
deletePhraseSet
public final void deletePhraseSet(PhraseSetName name)
Delete a phrase set.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]"); adaptationClient.deletePhraseSet(name); }
- Parameters:
name
- Required. The name of the phrase set to delete. Format:`projects/{project}/locations/{location}/phraseSets/{phrase_set}`
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deletePhraseSet
public final void deletePhraseSet(String name)
Delete a phrase set.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString(); adaptationClient.deletePhraseSet(name); }
- Parameters:
name
- Required. The name of the phrase set to delete. Format:`projects/{project}/locations/{location}/phraseSets/{phrase_set}`
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deletePhraseSet
public final void deletePhraseSet(DeletePhraseSetRequest request)
Delete a phrase set.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { DeletePhraseSetRequest request = DeletePhraseSetRequest.newBuilder() .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString()) .build(); adaptationClient.deletePhraseSet(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deletePhraseSetCallable
public final com.google.api.gax.rpc.UnaryCallable<DeletePhraseSetRequest,com.google.protobuf.Empty> deletePhraseSetCallable()
Delete a phrase set.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 (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(); }
-
createCustomClass
public final CustomClass createCustomClass(LocationName parent, CustomClass customClass, String customClassId)
Create a custom class.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 (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:
parent
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
customClass
- Required. The custom class to create.customClassId
- 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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createCustomClass
public final CustomClass createCustomClass(String parent, CustomClass customClass, String customClassId)
Create a custom class.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 (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:
parent
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
customClass
- Required. The custom class to create.customClassId
- 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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createCustomClass
public final CustomClass createCustomClass(CreateCustomClassRequest request)
Create a custom class.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 (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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createCustomClassCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateCustomClassRequest,CustomClass> createCustomClassCallable()
Create a custom class.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 (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(); }
-
getCustomClass
public final CustomClass getCustomClass(CustomClassName name)
Get a custom class.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); CustomClass response = adaptationClient.getCustomClass(name); }
- Parameters:
name
- Required. The name of the custom class to retrieve. Format:`projects/{project}/locations/{location}/customClasses/{custom_class}`
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getCustomClass
public final CustomClass getCustomClass(String name)
Get a custom class.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString(); CustomClass response = adaptationClient.getCustomClass(name); }
- Parameters:
name
- Required. The name of the custom class to retrieve. Format:`projects/{project}/locations/{location}/customClasses/{custom_class}`
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getCustomClass
public final CustomClass getCustomClass(GetCustomClassRequest request)
Get a custom class.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { GetCustomClassRequest request = GetCustomClassRequest.newBuilder() .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) .build(); CustomClass response = adaptationClient.getCustomClass(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getCustomClassCallable
public final com.google.api.gax.rpc.UnaryCallable<GetCustomClassRequest,CustomClass> getCustomClassCallable()
Get a custom class.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 (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(); }
-
listCustomClasses
public final AdaptationClient.ListCustomClassesPagedResponse listCustomClasses(LocationName parent)
List custom classes.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (CustomClass element : adaptationClient.listCustomClasses(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listCustomClasses
public final AdaptationClient.ListCustomClassesPagedResponse listCustomClasses(String parent)
List custom classes.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (CustomClass element : adaptationClient.listCustomClasses(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listCustomClasses
public final AdaptationClient.ListCustomClassesPagedResponse listCustomClasses(ListCustomClassesRequest request)
List custom classes.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 (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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listCustomClassesPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListCustomClassesRequest,AdaptationClient.ListCustomClassesPagedResponse> listCustomClassesPagedCallable()
List custom classes.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 (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); } }
-
listCustomClassesCallable
public final com.google.api.gax.rpc.UnaryCallable<ListCustomClassesRequest,ListCustomClassesResponse> listCustomClassesCallable()
List custom classes.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 (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; } } }
-
updateCustomClass
public final CustomClass updateCustomClass(CustomClass customClass, com.google.protobuf.FieldMask updateMask)
Update a custom class.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { CustomClass customClass = CustomClass.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); CustomClass response = adaptationClient.updateCustomClass(customClass, updateMask); }
- Parameters:
customClass
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
updateMask
- The list of fields to be updated.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateCustomClass
public final CustomClass updateCustomClass(UpdateCustomClassRequest request)
Update a custom class.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { UpdateCustomClassRequest request = UpdateCustomClassRequest.newBuilder() .setCustomClass(CustomClass.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); CustomClass response = adaptationClient.updateCustomClass(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateCustomClassCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateCustomClassRequest,CustomClass> updateCustomClassCallable()
Update a custom class.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 (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(); }
-
deleteCustomClass
public final void deleteCustomClass(CustomClassName name)
Delete a custom class.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]"); adaptationClient.deleteCustomClass(name); }
- Parameters:
name
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteCustomClass
public final void deleteCustomClass(String name)
Delete a custom class.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString(); adaptationClient.deleteCustomClass(name); }
- Parameters:
name
- 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or `eu` location value.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteCustomClass
public final void deleteCustomClass(DeleteCustomClassRequest request)
Delete a custom class.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 (AdaptationClient adaptationClient = AdaptationClient.create()) { DeleteCustomClassRequest request = DeleteCustomClassRequest.newBuilder() .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString()) .build(); adaptationClient.deleteCustomClass(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteCustomClassCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteCustomClassRequest,com.google.protobuf.Empty> deleteCustomClassCallable()
Delete a custom class.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 (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(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-