diff --git a/README.md b/README.md index 1e73881f9..a70659701 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ If you are using Maven without BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies ```Groovy -implementation platform('com.google.cloud:libraries-bom:25.2.0') +implementation platform('com.google.cloud:libraries-bom:25.3.0') implementation 'com.google.cloud:google-cloud-speech' ``` diff --git a/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/AdaptationClient.java b/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/AdaptationClient.java new file mode 100644 index 000000000..6199c6213 --- /dev/null +++ b/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/AdaptationClient.java @@ -0,0 +1,1532 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.speech.v1; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.speech.v1.stub.AdaptationStub; +import com.google.cloud.speech.v1.stub.AdaptationStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * 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: + * + *
{@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);
+ * }
+ * }
+ *
+ * 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: + * + *
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: + * + *
{@code
+ * // 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: + * + *
{@code
+ * // 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);
+ * }
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class AdaptationClient implements BackgroundResource { + private final AdaptationSettings settings; + private final AdaptationStub stub; + + /** Constructs an instance of AdaptationClient with default settings. */ + public static final AdaptationClient create() throws IOException { + return create(AdaptationSettings.newBuilder().build()); + } + + /** + * 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. + */ + public static final AdaptationClient create(AdaptationSettings settings) throws IOException { + return new AdaptationClient(settings); + } + + /** + * Constructs an instance of AdaptationClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(AdaptationSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final AdaptationClient create(AdaptationStub stub) { + return new AdaptationClient(stub); + } + + /** + * 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. + */ + protected AdaptationClient(AdaptationSettings settings) throws IOException { + this.settings = settings; + this.stub = ((AdaptationStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected AdaptationClient(AdaptationStub stub) { + this.settings = null; + this.stub = stub; + } + + public final AdaptationSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AdaptationStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * 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: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param parent 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or + * `eu` location value. + * @param phraseSet Required. The phrase set to create. + * @param 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 + */ + public final PhraseSet createPhraseSet( + LocationName parent, PhraseSet phraseSet, String phraseSetId) { + CreatePhraseSetRequest request = + CreatePhraseSetRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setPhraseSet(phraseSet) + .setPhraseSetId(phraseSetId) + .build(); + return createPhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * 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: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param parent 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](https://cloud.google.com/speech-to-text/docs/endpoints) with matching `us` or + * `eu` location value. + * @param phraseSet Required. The phrase set to create. + * @param 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 + */ + public final PhraseSet createPhraseSet(String parent, PhraseSet phraseSet, String phraseSetId) { + CreatePhraseSetRequest request = + CreatePhraseSetRequest.newBuilder() + .setParent(parent) + .setPhraseSet(phraseSet) + .setPhraseSetId(phraseSetId) + .build(); + return createPhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * 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: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final PhraseSet createPhraseSet(CreatePhraseSetRequest request) {
+ return createPhraseSetCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * 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: + * + *
{@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 future = adaptationClient.createPhraseSetCallable().futureCall(request);
+ * // Do something.
+ * PhraseSet response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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 + */ + public final PhraseSet getPhraseSet(PhraseSetName name) { + GetPhraseSetRequest request = + GetPhraseSetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getPhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get a phrase set. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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 + */ + public final PhraseSet getPhraseSet(String name) { + GetPhraseSetRequest request = GetPhraseSetRequest.newBuilder().setName(name).build(); + return getPhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get a phrase set. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final PhraseSet getPhraseSet(GetPhraseSetRequest request) {
+ return getPhraseSetCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Get a phrase set.
+ *
+ * Sample code: + * + *
{@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 future = adaptationClient.getPhraseSetCallable().futureCall(request);
+ * // Do something.
+ * PhraseSet response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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);
+ * }
+ * }
+ * }
+ *
+ * @param 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 + */ + public final ListPhraseSetPagedResponse listPhraseSet(LocationName parent) { + ListPhraseSetRequest request = + ListPhraseSetRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listPhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List phrase sets. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ * }
+ *
+ * @param 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 + */ + public final ListPhraseSetPagedResponse listPhraseSet(String parent) { + ListPhraseSetRequest request = ListPhraseSetRequest.newBuilder().setParent(parent).build(); + return listPhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List phrase sets. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final ListPhraseSetPagedResponse listPhraseSet(ListPhraseSetRequest request) {
+ return listPhraseSetPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List phrase sets.
+ *
+ * Sample code: + * + *
{@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 future =
+ * adaptationClient.listPhraseSetPagedCallable().futureCall(request);
+ * // Do something.
+ * for (PhraseSet element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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.getResponsesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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. + * @param updateMask The list of fields to be updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final PhraseSet updatePhraseSet(PhraseSet phraseSet, FieldMask updateMask) { + UpdatePhraseSetRequest request = + UpdatePhraseSetRequest.newBuilder() + .setPhraseSet(phraseSet) + .setUpdateMask(updateMask) + .build(); + return updatePhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Update a phrase set. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final PhraseSet updatePhraseSet(UpdatePhraseSetRequest request) {
+ return updatePhraseSetCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Update a phrase set.
+ *
+ * Sample code: + * + *
{@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 future = adaptationClient.updatePhraseSetCallable().futureCall(request);
+ * // Do something.
+ * PhraseSet response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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 + */ + public final void deletePhraseSet(PhraseSetName name) { + DeletePhraseSetRequest request = + DeletePhraseSetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deletePhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Delete a phrase set. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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 + */ + public final void deletePhraseSet(String name) { + DeletePhraseSetRequest request = DeletePhraseSetRequest.newBuilder().setName(name).build(); + deletePhraseSet(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Delete a phrase set. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final void deletePhraseSet(DeletePhraseSetRequest request) {
+ deletePhraseSetCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a phrase set.
+ *
+ * Sample code: + * + *
{@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 future = adaptationClient.deletePhraseSetCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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. + * @param customClass Required. The custom class to create. + * @param 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 + */ + public final CustomClass createCustomClass( + LocationName parent, CustomClass customClass, String customClassId) { + CreateCustomClassRequest request = + CreateCustomClassRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setCustomClass(customClass) + .setCustomClassId(customClassId) + .build(); + return createCustomClass(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Create a custom class. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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. + * @param customClass Required. The custom class to create. + * @param 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 + */ + public final CustomClass createCustomClass( + String parent, CustomClass customClass, String customClassId) { + CreateCustomClassRequest request = + CreateCustomClassRequest.newBuilder() + .setParent(parent) + .setCustomClass(customClass) + .setCustomClassId(customClassId) + .build(); + return createCustomClass(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Create a custom class. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final CustomClass createCustomClass(CreateCustomClassRequest request) {
+ return createCustomClassCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create a custom class.
+ *
+ * Sample code: + * + *
{@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 future =
+ * adaptationClient.createCustomClassCallable().futureCall(request);
+ * // Do something.
+ * CustomClass response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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 + */ + public final CustomClass getCustomClass(CustomClassName name) { + GetCustomClassRequest request = + GetCustomClassRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getCustomClass(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get a custom class. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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 + */ + public final CustomClass getCustomClass(String name) { + GetCustomClassRequest request = GetCustomClassRequest.newBuilder().setName(name).build(); + return getCustomClass(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get a custom class. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final CustomClass getCustomClass(GetCustomClassRequest request) {
+ return getCustomClassCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Get a custom class.
+ *
+ * Sample code: + * + *
{@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 future = adaptationClient.getCustomClassCallable().futureCall(request);
+ * // Do something.
+ * CustomClass response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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);
+ * }
+ * }
+ * }
+ *
+ * @param 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 + */ + public final ListCustomClassesPagedResponse listCustomClasses(LocationName parent) { + ListCustomClassesRequest request = + ListCustomClassesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listCustomClasses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List custom classes. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ * }
+ *
+ * @param 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 + */ + public final ListCustomClassesPagedResponse listCustomClasses(String parent) { + ListCustomClassesRequest request = + ListCustomClassesRequest.newBuilder().setParent(parent).build(); + return listCustomClasses(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List custom classes. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final ListCustomClassesPagedResponse listCustomClasses(ListCustomClassesRequest request) {
+ return listCustomClassesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List custom classes.
+ *
+ * Sample code: + * + *
{@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 future =
+ * adaptationClient.listCustomClassesPagedCallable().futureCall(request);
+ * // Do something.
+ * for (CustomClass element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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.getResponsesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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. + * @param updateMask The list of fields to be updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CustomClass updateCustomClass(CustomClass customClass, FieldMask updateMask) { + UpdateCustomClassRequest request = + UpdateCustomClassRequest.newBuilder() + .setCustomClass(customClass) + .setUpdateMask(updateMask) + .build(); + return updateCustomClass(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Update a custom class. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final CustomClass updateCustomClass(UpdateCustomClassRequest request) {
+ return updateCustomClassCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Update a custom class.
+ *
+ * Sample code: + * + *
{@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 future =
+ * adaptationClient.updateCustomClassCallable().futureCall(request);
+ * // Do something.
+ * CustomClass response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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 + */ + public final void deleteCustomClass(CustomClassName name) { + DeleteCustomClassRequest request = + DeleteCustomClassRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteCustomClass(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Delete a custom class. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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 + */ + public final void deleteCustomClass(String name) { + DeleteCustomClassRequest request = DeleteCustomClassRequest.newBuilder().setName(name).build(); + deleteCustomClass(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Delete a custom class. + * + *
Sample code: + * + *
{@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);
+ * }
+ * }
+ *
+ * @param 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
+ */
+ public final void deleteCustomClass(DeleteCustomClassRequest request) {
+ deleteCustomClassCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a custom class.
+ *
+ * Sample code: + * + *
{@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 future = adaptationClient.deleteCustomClassCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableThe default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of createPhraseSet to 30 seconds: + * + *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * AdaptationSettings.Builder adaptationSettingsBuilder = AdaptationSettings.newBuilder();
+ * adaptationSettingsBuilder
+ * .createPhraseSetSettings()
+ * .setRetrySettings(
+ * adaptationSettingsBuilder
+ * .createPhraseSetSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * AdaptationSettings adaptationSettings = adaptationSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class AdaptationSettings extends ClientSettingsNote: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction ======================= AdaptationClient =======================
+ *
+ * Service Description: Service that implements Google Cloud Speech Adaptation API.
+ *
+ * Sample for AdaptationClient:
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class AdaptationStub implements BackgroundResource {
+
+ public UnaryCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of createPhraseSet to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcAdaptationCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcAdaptationStub extends AdaptationStub {
+ private static final MethodDescriptor This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
+ * 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
*/
public final PhraseSet createPhraseSet(
@@ -227,7 +228,8 @@ public final PhraseSet createPhraseSet(
* @param phraseSet Required. The phrase set to create.
* @param 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 be 4-63 characters, and valid characters are /[a-z][0-9]-/.
+ * 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
*/
public final PhraseSet createPhraseSet(String parent, PhraseSet phraseSet, String phraseSetId) {
@@ -776,7 +778,8 @@ public final UnaryCallable This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
+ * 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
*/
public final CustomClass createCustomClass(
@@ -817,7 +820,8 @@ public final CustomClass createCustomClass(
* @param customClass Required. The custom class to create.
* @param 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 be 4-63 characters, and valid characters are /[a-z][0-9]-/.
+ * 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
*/
public final CustomClass createCustomClass(
diff --git a/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/AdaptationClientTest.java b/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/AdaptationClientTest.java
new file mode 100644
index 000000000..2a1c56b77
--- /dev/null
+++ b/google-cloud-speech/src/test/java/com/google/cloud/speech/v1/AdaptationClientTest.java
@@ -0,0 +1,826 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.speech.v1;
+
+import static com.google.cloud.speech.v1.AdaptationClient.ListCustomClassesPagedResponse;
+import static com.google.cloud.speech.v1.AdaptationClient.ListPhraseSetPagedResponse;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.grpc.GaxGrpcProperties;
+import com.google.api.gax.grpc.testing.LocalChannelProvider;
+import com.google.api.gax.grpc.testing.MockGrpcService;
+import com.google.api.gax.grpc.testing.MockServiceHelper;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.InvalidArgumentException;
+import com.google.common.collect.Lists;
+import com.google.protobuf.AbstractMessage;
+import com.google.protobuf.Empty;
+import com.google.protobuf.FieldMask;
+import io.grpc.StatusRuntimeException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+import javax.annotation.Generated;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@Generated("by gapic-generator-java")
+public class AdaptationClientTest {
+ private static MockAdaptation mockAdaptation;
+ private static MockServiceHelper mockServiceHelper;
+ private LocalChannelProvider channelProvider;
+ private AdaptationClient client;
+
+ @BeforeClass
+ public static void startStaticServer() {
+ mockAdaptation = new MockAdaptation();
+ mockServiceHelper =
+ new MockServiceHelper(
+ UUID.randomUUID().toString(), Arrays.{@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);
+ * }
+ * }
*/
@Generated("by gapic-generator-java")
package com.google.cloud.speech.v1;
diff --git a/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/stub/AdaptationStub.java b/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/stub/AdaptationStub.java
new file mode 100644
index 000000000..d7f079fe4
--- /dev/null
+++ b/google-cloud-speech/src/main/java/com/google/cloud/speech/v1/stub/AdaptationStub.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.speech.v1.stub;
+
+import static com.google.cloud.speech.v1.AdaptationClient.ListCustomClassesPagedResponse;
+import static com.google.cloud.speech.v1.AdaptationClient.ListPhraseSetPagedResponse;
+
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.speech.v1.CreateCustomClassRequest;
+import com.google.cloud.speech.v1.CreatePhraseSetRequest;
+import com.google.cloud.speech.v1.CustomClass;
+import com.google.cloud.speech.v1.DeleteCustomClassRequest;
+import com.google.cloud.speech.v1.DeletePhraseSetRequest;
+import com.google.cloud.speech.v1.GetCustomClassRequest;
+import com.google.cloud.speech.v1.GetPhraseSetRequest;
+import com.google.cloud.speech.v1.ListCustomClassesRequest;
+import com.google.cloud.speech.v1.ListCustomClassesResponse;
+import com.google.cloud.speech.v1.ListPhraseSetRequest;
+import com.google.cloud.speech.v1.ListPhraseSetResponse;
+import com.google.cloud.speech.v1.PhraseSet;
+import com.google.cloud.speech.v1.UpdateCustomClassRequest;
+import com.google.cloud.speech.v1.UpdatePhraseSetRequest;
+import com.google.protobuf.Empty;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the Adaptation service API.
+ *
+ *
+ *
+ *
+ * {@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * AdaptationStubSettings.Builder adaptationSettingsBuilder = AdaptationStubSettings.newBuilder();
+ * adaptationSettingsBuilder
+ * .createPhraseSetSettings()
+ * .setRetrySettings(
+ * adaptationSettingsBuilder
+ * .createPhraseSetSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * AdaptationStubSettings adaptationSettings = adaptationSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class AdaptationStubSettings extends StubSettings