com.google.cloud.speech.v2.SpeechClient Maven / Gradle / Ivy
Show all versions of google-cloud-speech Show documentation
/*
* Copyright 2023 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.v2;
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.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
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.BidiStreamingCallable;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.cloud.speech.v2.stub.SpeechStub;
import com.google.cloud.speech.v2.stub.SpeechStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.protobuf.ByteString;
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: Enables speech transcription and resource management.
*
* 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 and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
* Recognizer response = speechClient.getRecognizer(name);
* }
* }
*
* Note: close() needs to be called on the SpeechClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
*
*
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 SpeechSettings to create().
* For example:
*
*
To customize credentials:
*
*
{@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
* SpeechSettings speechSettings =
* SpeechSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* SpeechClient speechClient = SpeechClient.create(speechSettings);
* }
*
* To customize the endpoint:
*
*
{@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
* SpeechSettings speechSettings = SpeechSettings.newBuilder().setEndpoint(myEndpoint).build();
* SpeechClient speechClient = SpeechClient.create(speechSettings);
* }
*
* To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
*
{@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
* SpeechSettings speechSettings = SpeechSettings.newHttpJsonBuilder().build();
* SpeechClient speechClient = SpeechClient.create(speechSettings);
* }
*
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class SpeechClient implements BackgroundResource {
private final SpeechSettings settings;
private final SpeechStub stub;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;
/** Constructs an instance of SpeechClient with default settings. */
public static final SpeechClient create() throws IOException {
return create(SpeechSettings.newBuilder().build());
}
/**
* Constructs an instance of SpeechClient, 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 SpeechClient create(SpeechSettings settings) throws IOException {
return new SpeechClient(settings);
}
/**
* Constructs an instance of SpeechClient, using the given stub for making calls. This is for
* advanced usage - prefer using create(SpeechSettings).
*/
public static final SpeechClient create(SpeechStub stub) {
return new SpeechClient(stub);
}
/**
* Constructs an instance of SpeechClient, 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 SpeechClient(SpeechSettings settings) throws IOException {
this.settings = settings;
this.stub = ((SpeechStubSettings) settings.getStubSettings()).createStub();
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
protected SpeechClient(SpeechStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
public final SpeechSettings getSettings() {
return settings;
}
public SpeechStub getStub() {
return stub;
}
/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}
/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* Recognizer recognizer = Recognizer.newBuilder().build();
* String recognizerId = "recognizerId771963359";
* Recognizer response =
* speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get();
* }
* }
*
* @param parent Required. The project and location where this Recognizer will be created. The
* expected format is `projects/{project}/locations/{location}`.
* @param recognizer Required. The Recognizer to create.
* @param recognizerId The ID to use for the Recognizer, which will become the final component of
* the Recognizer's resource name.
* This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createRecognizerAsync(
LocationName parent, Recognizer recognizer, String recognizerId) {
CreateRecognizerRequest request =
CreateRecognizerRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setRecognizer(recognizer)
.setRecognizerId(recognizerId)
.build();
return createRecognizerAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* Recognizer recognizer = Recognizer.newBuilder().build();
* String recognizerId = "recognizerId771963359";
* Recognizer response =
* speechClient.createRecognizerAsync(parent, recognizer, recognizerId).get();
* }
* }
*
* @param parent Required. The project and location where this Recognizer will be created. The
* expected format is `projects/{project}/locations/{location}`.
* @param recognizer Required. The Recognizer to create.
* @param recognizerId The ID to use for the Recognizer, which will become the final component of
* the Recognizer's resource name.
* This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createRecognizerAsync(
String parent, Recognizer recognizer, String recognizerId) {
CreateRecognizerRequest request =
CreateRecognizerRequest.newBuilder()
.setParent(parent)
.setRecognizer(recognizer)
.setRecognizerId(recognizerId)
.build();
return createRecognizerAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CreateRecognizerRequest request =
* CreateRecognizerRequest.newBuilder()
* .setRecognizer(Recognizer.newBuilder().build())
* .setValidateOnly(true)
* .setRecognizerId("recognizerId771963359")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* Recognizer response = speechClient.createRecognizerAsync(request).get();
* }
* }
*
* @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 OperationFuture createRecognizerAsync(
CreateRecognizerRequest request) {
return createRecognizerOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CreateRecognizerRequest request =
* CreateRecognizerRequest.newBuilder()
* .setRecognizer(Recognizer.newBuilder().build())
* .setValidateOnly(true)
* .setRecognizerId("recognizerId771963359")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* OperationFuture future =
* speechClient.createRecognizerOperationCallable().futureCall(request);
* // Do something.
* Recognizer response = future.get();
* }
* }
*/
public final OperationCallable
createRecognizerOperationCallable() {
return stub.createRecognizerOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CreateRecognizerRequest request =
* CreateRecognizerRequest.newBuilder()
* .setRecognizer(Recognizer.newBuilder().build())
* .setValidateOnly(true)
* .setRecognizerId("recognizerId771963359")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* ApiFuture future = speechClient.createRecognizerCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable createRecognizerCallable() {
return stub.createRecognizerCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Recognizers.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The project and location of Recognizers to list. The expected format is
* `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListRecognizersPagedResponse listRecognizers(LocationName parent) {
ListRecognizersRequest request =
ListRecognizersRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listRecognizers(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Recognizers.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* for (Recognizer element : speechClient.listRecognizers(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The project and location of Recognizers to list. The expected format is
* `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListRecognizersPagedResponse listRecognizers(String parent) {
ListRecognizersRequest request = ListRecognizersRequest.newBuilder().setParent(parent).build();
return listRecognizers(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Recognizers.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListRecognizersRequest request =
* ListRecognizersRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setShowDeleted(true)
* .build();
* for (Recognizer element : speechClient.listRecognizers(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @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 ListRecognizersPagedResponse listRecognizers(ListRecognizersRequest request) {
return listRecognizersPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Recognizers.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListRecognizersRequest request =
* ListRecognizersRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setShowDeleted(true)
* .build();
* ApiFuture future =
* speechClient.listRecognizersPagedCallable().futureCall(request);
* // Do something.
* for (Recognizer element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listRecognizersPagedCallable() {
return stub.listRecognizersPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists Recognizers.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListRecognizersRequest request =
* ListRecognizersRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setShowDeleted(true)
* .build();
* while (true) {
* ListRecognizersResponse response = speechClient.listRecognizersCallable().call(request);
* for (Recognizer element : response.getRecognizersList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable
listRecognizersCallable() {
return stub.listRecognizersCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
* [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested Recognizer doesn't exist.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
* Recognizer response = speechClient.getRecognizer(name);
* }
* }
*
* @param name Required. The name of the Recognizer to retrieve. The expected format is
* `projects/{project}/locations/{location}/recognizers/{recognizer}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Recognizer getRecognizer(RecognizerName name) {
GetRecognizerRequest request =
GetRecognizerRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getRecognizer(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
* [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested Recognizer doesn't exist.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
* Recognizer response = speechClient.getRecognizer(name);
* }
* }
*
* @param name Required. The name of the Recognizer to retrieve. The expected format is
* `projects/{project}/locations/{location}/recognizers/{recognizer}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Recognizer getRecognizer(String name) {
GetRecognizerRequest request = GetRecognizerRequest.newBuilder().setName(name).build();
return getRecognizer(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
* [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested Recognizer doesn't exist.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetRecognizerRequest request =
* GetRecognizerRequest.newBuilder()
* .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .build();
* Recognizer response = speechClient.getRecognizer(request);
* }
* }
*
* @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 Recognizer getRecognizer(GetRecognizerRequest request) {
return getRecognizerCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Recognizer][google.cloud.speech.v2.Recognizer]. Fails with
* [NOT_FOUND][google.rpc.Code.NOT_FOUND] if the requested Recognizer doesn't exist.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetRecognizerRequest request =
* GetRecognizerRequest.newBuilder()
* .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .build();
* ApiFuture future = speechClient.getRecognizerCallable().futureCall(request);
* // Do something.
* Recognizer response = future.get();
* }
* }
*/
public final UnaryCallable getRecognizerCallable() {
return stub.getRecognizerCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* Recognizer recognizer = Recognizer.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* Recognizer response = speechClient.updateRecognizerAsync(recognizer, updateMask).get();
* }
* }
*
* @param recognizer Required. The Recognizer to update.
* The Recognizer's `name` field is used to identify the Recognizer to update. Format:
* `projects/{project}/locations/{location}/recognizers/{recognizer}`.
* @param updateMask The list of fields to update. If empty, all non-default valued fields are
* considered for update. Use `*` to update the entire Recognizer resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updateRecognizerAsync(
Recognizer recognizer, FieldMask updateMask) {
UpdateRecognizerRequest request =
UpdateRecognizerRequest.newBuilder()
.setRecognizer(recognizer)
.setUpdateMask(updateMask)
.build();
return updateRecognizerAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdateRecognizerRequest request =
* UpdateRecognizerRequest.newBuilder()
* .setRecognizer(Recognizer.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .setValidateOnly(true)
* .build();
* Recognizer response = speechClient.updateRecognizerAsync(request).get();
* }
* }
*
* @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 OperationFuture updateRecognizerAsync(
UpdateRecognizerRequest request) {
return updateRecognizerOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdateRecognizerRequest request =
* UpdateRecognizerRequest.newBuilder()
* .setRecognizer(Recognizer.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .setValidateOnly(true)
* .build();
* OperationFuture future =
* speechClient.updateRecognizerOperationCallable().futureCall(request);
* // Do something.
* Recognizer response = future.get();
* }
* }
*/
public final OperationCallable
updateRecognizerOperationCallable() {
return stub.updateRecognizerOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdateRecognizerRequest request =
* UpdateRecognizerRequest.newBuilder()
* .setRecognizer(Recognizer.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .setValidateOnly(true)
* .build();
* ApiFuture future = speechClient.updateRecognizerCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable updateRecognizerCallable() {
return stub.updateRecognizerCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
* Recognizer response = speechClient.deleteRecognizerAsync(name).get();
* }
* }
*
* @param name Required. The name of the Recognizer to delete. Format:
* `projects/{project}/locations/{location}/recognizers/{recognizer}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteRecognizerAsync(
RecognizerName name) {
DeleteRecognizerRequest request =
DeleteRecognizerRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deleteRecognizerAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
* Recognizer response = speechClient.deleteRecognizerAsync(name).get();
* }
* }
*
* @param name Required. The name of the Recognizer to delete. Format:
* `projects/{project}/locations/{location}/recognizers/{recognizer}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteRecognizerAsync(String name) {
DeleteRecognizerRequest request = DeleteRecognizerRequest.newBuilder().setName(name).build();
return deleteRecognizerAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* DeleteRecognizerRequest request =
* DeleteRecognizerRequest.newBuilder()
* .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setValidateOnly(true)
* .setAllowMissing(true)
* .setEtag("etag3123477")
* .build();
* Recognizer response = speechClient.deleteRecognizerAsync(request).get();
* }
* }
*
* @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 OperationFuture deleteRecognizerAsync(
DeleteRecognizerRequest request) {
return deleteRecognizerOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* DeleteRecognizerRequest request =
* DeleteRecognizerRequest.newBuilder()
* .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setValidateOnly(true)
* .setAllowMissing(true)
* .setEtag("etag3123477")
* .build();
* OperationFuture future =
* speechClient.deleteRecognizerOperationCallable().futureCall(request);
* // Do something.
* Recognizer response = future.get();
* }
* }
*/
public final OperationCallable
deleteRecognizerOperationCallable() {
return stub.deleteRecognizerOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* DeleteRecognizerRequest request =
* DeleteRecognizerRequest.newBuilder()
* .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setValidateOnly(true)
* .setAllowMissing(true)
* .setEtag("etag3123477")
* .build();
* ApiFuture future = speechClient.deleteRecognizerCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable deleteRecognizerCallable() {
return stub.deleteRecognizerCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* RecognizerName name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
* Recognizer response = speechClient.undeleteRecognizerAsync(name).get();
* }
* }
*
* @param name Required. The name of the Recognizer to undelete. Format:
* `projects/{project}/locations/{location}/recognizers/{recognizer}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture undeleteRecognizerAsync(
RecognizerName name) {
UndeleteRecognizerRequest request =
UndeleteRecognizerRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return undeleteRecognizerAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
* Recognizer response = speechClient.undeleteRecognizerAsync(name).get();
* }
* }
*
* @param name Required. The name of the Recognizer to undelete. Format:
* `projects/{project}/locations/{location}/recognizers/{recognizer}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture undeleteRecognizerAsync(String name) {
UndeleteRecognizerRequest request =
UndeleteRecognizerRequest.newBuilder().setName(name).build();
return undeleteRecognizerAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UndeleteRecognizerRequest request =
* UndeleteRecognizerRequest.newBuilder()
* .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* Recognizer response = speechClient.undeleteRecognizerAsync(request).get();
* }
* }
*
* @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 OperationFuture undeleteRecognizerAsync(
UndeleteRecognizerRequest request) {
return undeleteRecognizerOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UndeleteRecognizerRequest request =
* UndeleteRecognizerRequest.newBuilder()
* .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* OperationFuture future =
* speechClient.undeleteRecognizerOperationCallable().futureCall(request);
* // Do something.
* Recognizer response = future.get();
* }
* }
*/
public final OperationCallable
undeleteRecognizerOperationCallable() {
return stub.undeleteRecognizerOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [Recognizer][google.cloud.speech.v2.Recognizer].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UndeleteRecognizerRequest request =
* UndeleteRecognizerRequest.newBuilder()
* .setName(RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* ApiFuture future = speechClient.undeleteRecognizerCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable undeleteRecognizerCallable() {
return stub.undeleteRecognizerCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs synchronous Speech recognition: receive results after all audio has been sent and
* processed.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
* RecognitionConfig config = RecognitionConfig.newBuilder().build();
* FieldMask configMask = FieldMask.newBuilder().build();
* ByteString content = ByteString.EMPTY;
* RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content);
* }
* }
*
* @param recognizer Required. The name of the Recognizer to use during recognition. The expected
* format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
* {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
* @param config Features and audio metadata to use for the Automatic Speech Recognition. This
* field in combination with the
* [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to
* override parts of the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the Recognizer resource.
* @param configMask The list of fields in
* [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the recognizer during this recognition request. If no mask is provided, all non-default
* valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the
* values in the recognizer for this recognition request. If a mask is provided, only the
* fields listed in the mask override the config in the recognizer for this recognition
* request. If a wildcard (`*`) is provided,
* [config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces
* the config in the recognizer for this recognition request.
* @param content The audio data bytes encoded as specified in
* [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As with all bytes fields,
* proto buffers use a pure binary representation, whereas JSON representations use base64.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final RecognizeResponse recognize(
RecognizerName recognizer,
RecognitionConfig config,
FieldMask configMask,
ByteString content) {
RecognizeRequest request =
RecognizeRequest.newBuilder()
.setRecognizer(recognizer == null ? null : recognizer.toString())
.setConfig(config)
.setConfigMask(configMask)
.setContent(content)
.build();
return recognize(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs synchronous Speech recognition: receive results after all audio has been sent and
* processed.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
* RecognitionConfig config = RecognitionConfig.newBuilder().build();
* FieldMask configMask = FieldMask.newBuilder().build();
* String uri = "uri116076";
* RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri);
* }
* }
*
* @param recognizer Required. The name of the Recognizer to use during recognition. The expected
* format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
* {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
* @param config Features and audio metadata to use for the Automatic Speech Recognition. This
* field in combination with the
* [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to
* override parts of the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the Recognizer resource.
* @param configMask The list of fields in
* [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the recognizer during this recognition request. If no mask is provided, all non-default
* valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the
* values in the recognizer for this recognition request. If a mask is provided, only the
* fields listed in the mask override the config in the recognizer for this recognition
* request. If a wildcard (`*`) is provided,
* [config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces
* the config in the recognizer for this recognition request.
* @param uri URI that points to a file that contains audio data bytes as specified in
* [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file must not be
* compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported,
* which must be specified in the following format: `gs://bucket_name/object_name` (other URI
* formats return [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information,
* see [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final RecognizeResponse recognize(
RecognizerName recognizer, RecognitionConfig config, FieldMask configMask, String uri) {
RecognizeRequest request =
RecognizeRequest.newBuilder()
.setRecognizer(recognizer == null ? null : recognizer.toString())
.setConfig(config)
.setConfigMask(configMask)
.setUri(uri)
.build();
return recognize(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs synchronous Speech recognition: receive results after all audio has been sent and
* processed.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
* RecognitionConfig config = RecognitionConfig.newBuilder().build();
* FieldMask configMask = FieldMask.newBuilder().build();
* ByteString content = ByteString.EMPTY;
* RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, content);
* }
* }
*
* @param recognizer Required. The name of the Recognizer to use during recognition. The expected
* format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
* {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
* @param config Features and audio metadata to use for the Automatic Speech Recognition. This
* field in combination with the
* [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to
* override parts of the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the Recognizer resource.
* @param configMask The list of fields in
* [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the recognizer during this recognition request. If no mask is provided, all non-default
* valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the
* values in the recognizer for this recognition request. If a mask is provided, only the
* fields listed in the mask override the config in the recognizer for this recognition
* request. If a wildcard (`*`) is provided,
* [config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces
* the config in the recognizer for this recognition request.
* @param content The audio data bytes encoded as specified in
* [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As with all bytes fields,
* proto buffers use a pure binary representation, whereas JSON representations use base64.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final RecognizeResponse recognize(
String recognizer, RecognitionConfig config, FieldMask configMask, ByteString content) {
RecognizeRequest request =
RecognizeRequest.newBuilder()
.setRecognizer(recognizer)
.setConfig(config)
.setConfigMask(configMask)
.setContent(content)
.build();
return recognize(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs synchronous Speech recognition: receive results after all audio has been sent and
* processed.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
* RecognitionConfig config = RecognitionConfig.newBuilder().build();
* FieldMask configMask = FieldMask.newBuilder().build();
* String uri = "uri116076";
* RecognizeResponse response = speechClient.recognize(recognizer, config, configMask, uri);
* }
* }
*
* @param recognizer Required. The name of the Recognizer to use during recognition. The expected
* format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
* {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
* @param config Features and audio metadata to use for the Automatic Speech Recognition. This
* field in combination with the
* [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field can be used to
* override parts of the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the Recognizer resource.
* @param configMask The list of fields in
* [config][google.cloud.speech.v2.RecognizeRequest.config] that override the values in the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the recognizer during this recognition request. If no mask is provided, all non-default
* valued fields in [config][google.cloud.speech.v2.RecognizeRequest.config] override the
* values in the recognizer for this recognition request. If a mask is provided, only the
* fields listed in the mask override the config in the recognizer for this recognition
* request. If a wildcard (`*`) is provided,
* [config][google.cloud.speech.v2.RecognizeRequest.config] completely overrides and replaces
* the config in the recognizer for this recognition request.
* @param uri URI that points to a file that contains audio data bytes as specified in
* [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file must not be
* compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported,
* which must be specified in the following format: `gs://bucket_name/object_name` (other URI
* formats return [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information,
* see [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final RecognizeResponse recognize(
String recognizer, RecognitionConfig config, FieldMask configMask, String uri) {
RecognizeRequest request =
RecognizeRequest.newBuilder()
.setRecognizer(recognizer)
.setConfig(config)
.setConfigMask(configMask)
.setUri(uri)
.build();
return recognize(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs synchronous Speech recognition: receive results after all audio has been sent and
* processed.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* RecognizeRequest request =
* RecognizeRequest.newBuilder()
* .setRecognizer(
* RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setConfig(RecognitionConfig.newBuilder().build())
* .setConfigMask(FieldMask.newBuilder().build())
* .build();
* RecognizeResponse response = speechClient.recognize(request);
* }
* }
*
* @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 RecognizeResponse recognize(RecognizeRequest request) {
return recognizeCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs synchronous Speech recognition: receive results after all audio has been sent and
* processed.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* RecognizeRequest request =
* RecognizeRequest.newBuilder()
* .setRecognizer(
* RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setConfig(RecognitionConfig.newBuilder().build())
* .setConfigMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture future = speechClient.recognizeCallable().futureCall(request);
* // Do something.
* RecognizeResponse response = future.get();
* }
* }
*/
public final UnaryCallable recognizeCallable() {
return stub.recognizeCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs bidirectional streaming speech recognition: receive results while sending audio. This
* method is only available via the gRPC API (not REST).
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* BidiStream bidiStream =
* speechClient.streamingRecognizeCallable().call();
* StreamingRecognizeRequest request =
* StreamingRecognizeRequest.newBuilder()
* .setRecognizer(
* RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .build();
* bidiStream.send(request);
* for (StreamingRecognizeResponse response : bidiStream) {
* // Do something when a response is received.
* }
* }
* }
*/
public final BidiStreamingCallable
streamingRecognizeCallable() {
return stub.streamingRecognizeCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs batch asynchronous speech recognition: send a request with N audio files and receive a
* long running operation that can be polled to see when the transcriptions are finished.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* RecognizerName recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]");
* RecognitionConfig config = RecognitionConfig.newBuilder().build();
* FieldMask configMask = FieldMask.newBuilder().build();
* List files = new ArrayList<>();
* BatchRecognizeResponse response =
* speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get();
* }
* }
*
* @param recognizer Required. The name of the Recognizer to use during recognition. The expected
* format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
* {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
* @param config Features and audio metadata to use for the Automatic Speech Recognition. This
* field in combination with the
* [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask] field can be used
* to override parts of the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the Recognizer resource.
* @param configMask The list of fields in
* [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override the values in
* the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the recognizer during this recognition request. If no mask is provided, all given fields
* in [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the values in the
* recognizer for this recognition request. If a mask is provided, only the fields listed in
* the mask override the config in the recognizer for this recognition request. If a wildcard
* (`*`) is provided, [config][google.cloud.speech.v2.BatchRecognizeRequest.config]
* completely overrides and replaces the config in the recognizer for this recognition
* request.
* @param files Audio files with file metadata for ASR. The maximum number of files allowed to be
* specified is 5.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchRecognizeAsync(
RecognizerName recognizer,
RecognitionConfig config,
FieldMask configMask,
List files) {
BatchRecognizeRequest request =
BatchRecognizeRequest.newBuilder()
.setRecognizer(recognizer == null ? null : recognizer.toString())
.setConfig(config)
.setConfigMask(configMask)
.addAllFiles(files)
.build();
return batchRecognizeAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs batch asynchronous speech recognition: send a request with N audio files and receive a
* long running operation that can be polled to see when the transcriptions are finished.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String recognizer = RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString();
* RecognitionConfig config = RecognitionConfig.newBuilder().build();
* FieldMask configMask = FieldMask.newBuilder().build();
* List files = new ArrayList<>();
* BatchRecognizeResponse response =
* speechClient.batchRecognizeAsync(recognizer, config, configMask, files).get();
* }
* }
*
* @param recognizer Required. The name of the Recognizer to use during recognition. The expected
* format is `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
* {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
* @param config Features and audio metadata to use for the Automatic Speech Recognition. This
* field in combination with the
* [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask] field can be used
* to override parts of the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the Recognizer resource.
* @param configMask The list of fields in
* [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override the values in
* the
* [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
* of the recognizer during this recognition request. If no mask is provided, all given fields
* in [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the values in the
* recognizer for this recognition request. If a mask is provided, only the fields listed in
* the mask override the config in the recognizer for this recognition request. If a wildcard
* (`*`) is provided, [config][google.cloud.speech.v2.BatchRecognizeRequest.config]
* completely overrides and replaces the config in the recognizer for this recognition
* request.
* @param files Audio files with file metadata for ASR. The maximum number of files allowed to be
* specified is 5.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture batchRecognizeAsync(
String recognizer,
RecognitionConfig config,
FieldMask configMask,
List files) {
BatchRecognizeRequest request =
BatchRecognizeRequest.newBuilder()
.setRecognizer(recognizer)
.setConfig(config)
.setConfigMask(configMask)
.addAllFiles(files)
.build();
return batchRecognizeAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs batch asynchronous speech recognition: send a request with N audio files and receive a
* long running operation that can be polled to see when the transcriptions are finished.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* BatchRecognizeRequest request =
* BatchRecognizeRequest.newBuilder()
* .setRecognizer(
* RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setConfig(RecognitionConfig.newBuilder().build())
* .setConfigMask(FieldMask.newBuilder().build())
* .addAllFiles(new ArrayList())
* .setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
* .build();
* BatchRecognizeResponse response = speechClient.batchRecognizeAsync(request).get();
* }
* }
*
* @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 OperationFuture batchRecognizeAsync(
BatchRecognizeRequest request) {
return batchRecognizeOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs batch asynchronous speech recognition: send a request with N audio files and receive a
* long running operation that can be polled to see when the transcriptions are finished.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* BatchRecognizeRequest request =
* BatchRecognizeRequest.newBuilder()
* .setRecognizer(
* RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setConfig(RecognitionConfig.newBuilder().build())
* .setConfigMask(FieldMask.newBuilder().build())
* .addAllFiles(new ArrayList())
* .setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
* .build();
* OperationFuture future =
* speechClient.batchRecognizeOperationCallable().futureCall(request);
* // Do something.
* BatchRecognizeResponse response = future.get();
* }
* }
*/
public final OperationCallable
batchRecognizeOperationCallable() {
return stub.batchRecognizeOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs batch asynchronous speech recognition: send a request with N audio files and receive a
* long running operation that can be polled to see when the transcriptions are finished.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* BatchRecognizeRequest request =
* BatchRecognizeRequest.newBuilder()
* .setRecognizer(
* RecognizerName.of("[PROJECT]", "[LOCATION]", "[RECOGNIZER]").toString())
* .setConfig(RecognitionConfig.newBuilder().build())
* .setConfigMask(FieldMask.newBuilder().build())
* .addAllFiles(new ArrayList())
* .setRecognitionOutputConfig(RecognitionOutputConfig.newBuilder().build())
* .build();
* ApiFuture future = speechClient.batchRecognizeCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable batchRecognizeCallable() {
return stub.batchRecognizeCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Config][google.cloud.speech.v2.Config].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ConfigName name = ConfigName.of("[PROJECT]", "[LOCATION]");
* Config response = speechClient.getConfig(name);
* }
* }
*
* @param name Required. The name of the config to retrieve. There is exactly one config resource
* per project per location. The expected format is
* `projects/{project}/locations/{location}/config`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Config getConfig(ConfigName name) {
GetConfigRequest request =
GetConfigRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getConfig(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Config][google.cloud.speech.v2.Config].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = ConfigName.of("[PROJECT]", "[LOCATION]").toString();
* Config response = speechClient.getConfig(name);
* }
* }
*
* @param name Required. The name of the config to retrieve. There is exactly one config resource
* per project per location. The expected format is
* `projects/{project}/locations/{location}/config`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Config getConfig(String name) {
GetConfigRequest request = GetConfigRequest.newBuilder().setName(name).build();
return getConfig(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Config][google.cloud.speech.v2.Config].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetConfigRequest request =
* GetConfigRequest.newBuilder()
* .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* Config response = speechClient.getConfig(request);
* }
* }
*
* @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 Config getConfig(GetConfigRequest request) {
return getConfigCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [Config][google.cloud.speech.v2.Config].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetConfigRequest request =
* GetConfigRequest.newBuilder()
* .setName(ConfigName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* ApiFuture future = speechClient.getConfigCallable().futureCall(request);
* // Do something.
* Config response = future.get();
* }
* }
*/
public final UnaryCallable getConfigCallable() {
return stub.getConfigCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [Config][google.cloud.speech.v2.Config].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* Config config = Config.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* Config response = speechClient.updateConfig(config, updateMask);
* }
* }
*
* @param config Required. The config to update.
* The config's `name` field is used to identify the config to be updated. The expected
* format is `projects/{project}/locations/{location}/config`.
* @param updateMask The list of fields to be updated.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Config updateConfig(Config config, FieldMask updateMask) {
UpdateConfigRequest request =
UpdateConfigRequest.newBuilder().setConfig(config).setUpdateMask(updateMask).build();
return updateConfig(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [Config][google.cloud.speech.v2.Config].
*
*
Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdateConfigRequest request =
* UpdateConfigRequest.newBuilder()
* .setConfig(Config.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* Config response = speechClient.updateConfig(request);
* }
* }
*
* @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 Config updateConfig(UpdateConfigRequest request) {
return updateConfigCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [Config][google.cloud.speech.v2.Config].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdateConfigRequest request =
* UpdateConfigRequest.newBuilder()
* .setConfig(Config.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture future = speechClient.updateConfigCallable().futureCall(request);
* // Do something.
* Config response = future.get();
* }
* }
*/
public final UnaryCallable updateConfigCallable() {
return stub.updateConfigCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* CustomClass customClass = CustomClass.newBuilder().build();
* String customClassId = "customClassId1871032322";
* CustomClass response =
* speechClient.createCustomClassAsync(parent, customClass, customClassId).get();
* }
* }
*
* @param parent Required. The project and location where this CustomClass will be created. The
* expected format is `projects/{project}/locations/{location}`.
* @param customClass Required. The CustomClass to create.
* @param customClassId The ID to use for the CustomClass, which will become the final component
* of the CustomClass's resource name.
* This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createCustomClassAsync(
LocationName parent, CustomClass customClass, String customClassId) {
CreateCustomClassRequest request =
CreateCustomClassRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setCustomClass(customClass)
.setCustomClassId(customClassId)
.build();
return createCustomClassAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* CustomClass customClass = CustomClass.newBuilder().build();
* String customClassId = "customClassId1871032322";
* CustomClass response =
* speechClient.createCustomClassAsync(parent, customClass, customClassId).get();
* }
* }
*
* @param parent Required. The project and location where this CustomClass will be created. The
* expected format is `projects/{project}/locations/{location}`.
* @param customClass Required. The CustomClass to create.
* @param customClassId The ID to use for the CustomClass, which will become the final component
* of the CustomClass's resource name.
* This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createCustomClassAsync(
String parent, CustomClass customClass, String customClassId) {
CreateCustomClassRequest request =
CreateCustomClassRequest.newBuilder()
.setParent(parent)
.setCustomClass(customClass)
.setCustomClassId(customClassId)
.build();
return createCustomClassAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CreateCustomClassRequest request =
* CreateCustomClassRequest.newBuilder()
* .setCustomClass(CustomClass.newBuilder().build())
* .setValidateOnly(true)
* .setCustomClassId("customClassId1871032322")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* CustomClass response = speechClient.createCustomClassAsync(request).get();
* }
* }
*
* @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 OperationFuture createCustomClassAsync(
CreateCustomClassRequest request) {
return createCustomClassOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CreateCustomClassRequest request =
* CreateCustomClassRequest.newBuilder()
* .setCustomClass(CustomClass.newBuilder().build())
* .setValidateOnly(true)
* .setCustomClassId("customClassId1871032322")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* OperationFuture future =
* speechClient.createCustomClassOperationCallable().futureCall(request);
* // Do something.
* CustomClass response = future.get();
* }
* }
*/
public final OperationCallable
createCustomClassOperationCallable() {
return stub.createCustomClassOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CreateCustomClassRequest request =
* CreateCustomClassRequest.newBuilder()
* .setCustomClass(CustomClass.newBuilder().build())
* .setValidateOnly(true)
* .setCustomClassId("customClassId1871032322")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* ApiFuture future = speechClient.createCustomClassCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable createCustomClassCallable() {
return stub.createCustomClassCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists CustomClasses.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The project and location of CustomClass resources to list. The expected
* format is `projects/{project}/locations/{location}`.
* @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.
/**
* Lists CustomClasses.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* for (CustomClass element : speechClient.listCustomClasses(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The project and location of CustomClass resources to list. The expected
* format is `projects/{project}/locations/{location}`.
* @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.
/**
* Lists CustomClasses.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListCustomClassesRequest request =
* ListCustomClassesRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setShowDeleted(true)
* .build();
* for (CustomClass element : speechClient.listCustomClasses(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @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.
/**
* Lists CustomClasses.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListCustomClassesRequest request =
* ListCustomClassesRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setShowDeleted(true)
* .build();
* ApiFuture future =
* speechClient.listCustomClassesPagedCallable().futureCall(request);
* // Do something.
* for (CustomClass element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listCustomClassesPagedCallable() {
return stub.listCustomClassesPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists CustomClasses.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListCustomClassesRequest request =
* ListCustomClassesRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setShowDeleted(true)
* .build();
* while (true) {
* ListCustomClassesResponse response = speechClient.listCustomClassesCallable().call(request);
* for (CustomClass element : response.getCustomClassesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable
listCustomClassesCallable() {
return stub.listCustomClassesCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
* CustomClass response = speechClient.getCustomClass(name);
* }
* }
*
* @param name Required. The name of the CustomClass to retrieve. The expected format is
* `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.
/**
* Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
* CustomClass response = speechClient.getCustomClass(name);
* }
* }
*
* @param name Required. The name of the CustomClass to retrieve. The expected format is
* `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.
/**
* Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetCustomClassRequest request =
* GetCustomClassRequest.newBuilder()
* .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
* .build();
* CustomClass response = speechClient.getCustomClass(request);
* }
* }
*
* @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.
/**
* Returns the requested [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetCustomClassRequest request =
* GetCustomClassRequest.newBuilder()
* .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
* .build();
* ApiFuture future = speechClient.getCustomClassCallable().futureCall(request);
* // Do something.
* CustomClass response = future.get();
* }
* }
*/
public final UnaryCallable getCustomClassCallable() {
return stub.getCustomClassCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CustomClass customClass = CustomClass.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* CustomClass response = speechClient.updateCustomClassAsync(customClass, updateMask).get();
* }
* }
*
* @param customClass Required. The CustomClass to update.
* The CustomClass's `name` field is used to identify the CustomClass to update. Format:
* `projects/{project}/locations/{location}/customClasses/{custom_class}`.
* @param updateMask The list of fields to be updated. If empty, all fields are considered for
* update.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updateCustomClassAsync(
CustomClass customClass, FieldMask updateMask) {
UpdateCustomClassRequest request =
UpdateCustomClassRequest.newBuilder()
.setCustomClass(customClass)
.setUpdateMask(updateMask)
.build();
return updateCustomClassAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdateCustomClassRequest request =
* UpdateCustomClassRequest.newBuilder()
* .setCustomClass(CustomClass.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .setValidateOnly(true)
* .build();
* CustomClass response = speechClient.updateCustomClassAsync(request).get();
* }
* }
*
* @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 OperationFuture updateCustomClassAsync(
UpdateCustomClassRequest request) {
return updateCustomClassOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdateCustomClassRequest request =
* UpdateCustomClassRequest.newBuilder()
* .setCustomClass(CustomClass.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .setValidateOnly(true)
* .build();
* OperationFuture future =
* speechClient.updateCustomClassOperationCallable().futureCall(request);
* // Do something.
* CustomClass response = future.get();
* }
* }
*/
public final OperationCallable
updateCustomClassOperationCallable() {
return stub.updateCustomClassOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdateCustomClassRequest request =
* UpdateCustomClassRequest.newBuilder()
* .setCustomClass(CustomClass.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .setValidateOnly(true)
* .build();
* ApiFuture future = speechClient.updateCustomClassCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable updateCustomClassCallable() {
return stub.updateCustomClassCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
* CustomClass response = speechClient.deleteCustomClassAsync(name).get();
* }
* }
*
* @param name Required. The name of the CustomClass to delete. Format:
* `projects/{project}/locations/{location}/customClasses/{custom_class}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteCustomClassAsync(
CustomClassName name) {
DeleteCustomClassRequest request =
DeleteCustomClassRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return deleteCustomClassAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
* CustomClass response = speechClient.deleteCustomClassAsync(name).get();
* }
* }
*
* @param name Required. The name of the CustomClass to delete. Format:
* `projects/{project}/locations/{location}/customClasses/{custom_class}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteCustomClassAsync(String name) {
DeleteCustomClassRequest request = DeleteCustomClassRequest.newBuilder().setName(name).build();
return deleteCustomClassAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* DeleteCustomClassRequest request =
* DeleteCustomClassRequest.newBuilder()
* .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
* .setValidateOnly(true)
* .setAllowMissing(true)
* .setEtag("etag3123477")
* .build();
* CustomClass response = speechClient.deleteCustomClassAsync(request).get();
* }
* }
*
* @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 OperationFuture deleteCustomClassAsync(
DeleteCustomClassRequest request) {
return deleteCustomClassOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* DeleteCustomClassRequest request =
* DeleteCustomClassRequest.newBuilder()
* .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
* .setValidateOnly(true)
* .setAllowMissing(true)
* .setEtag("etag3123477")
* .build();
* OperationFuture future =
* speechClient.deleteCustomClassOperationCallable().futureCall(request);
* // Do something.
* CustomClass response = future.get();
* }
* }
*/
public final OperationCallable
deleteCustomClassOperationCallable() {
return stub.deleteCustomClassOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* DeleteCustomClassRequest request =
* DeleteCustomClassRequest.newBuilder()
* .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
* .setValidateOnly(true)
* .setAllowMissing(true)
* .setEtag("etag3123477")
* .build();
* ApiFuture future = speechClient.deleteCustomClassCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable deleteCustomClassCallable() {
return stub.deleteCustomClassCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CustomClassName name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]");
* CustomClass response = speechClient.undeleteCustomClassAsync(name).get();
* }
* }
*
* @param name Required. The name of the CustomClass to undelete. Format:
* `projects/{project}/locations/{location}/customClasses/{custom_class}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture undeleteCustomClassAsync(
CustomClassName name) {
UndeleteCustomClassRequest request =
UndeleteCustomClassRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return undeleteCustomClassAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString();
* CustomClass response = speechClient.undeleteCustomClassAsync(name).get();
* }
* }
*
* @param name Required. The name of the CustomClass to undelete. Format:
* `projects/{project}/locations/{location}/customClasses/{custom_class}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture undeleteCustomClassAsync(
String name) {
UndeleteCustomClassRequest request =
UndeleteCustomClassRequest.newBuilder().setName(name).build();
return undeleteCustomClassAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UndeleteCustomClassRequest request =
* UndeleteCustomClassRequest.newBuilder()
* .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* CustomClass response = speechClient.undeleteCustomClassAsync(request).get();
* }
* }
*
* @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 OperationFuture undeleteCustomClassAsync(
UndeleteCustomClassRequest request) {
return undeleteCustomClassOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UndeleteCustomClassRequest request =
* UndeleteCustomClassRequest.newBuilder()
* .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* OperationFuture future =
* speechClient.undeleteCustomClassOperationCallable().futureCall(request);
* // Do something.
* CustomClass response = future.get();
* }
* }
*/
public final OperationCallable
undeleteCustomClassOperationCallable() {
return stub.undeleteCustomClassOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [CustomClass][google.cloud.speech.v2.CustomClass].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UndeleteCustomClassRequest request =
* UndeleteCustomClassRequest.newBuilder()
* .setName(CustomClassName.of("[PROJECT]", "[LOCATION]", "[CUSTOM_CLASS]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* ApiFuture future = speechClient.undeleteCustomClassCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable undeleteCustomClassCallable() {
return stub.undeleteCustomClassCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* PhraseSet phraseSet = PhraseSet.newBuilder().build();
* String phraseSetId = "phraseSetId959902180";
* PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get();
* }
* }
*
* @param parent Required. The project and location where this PhraseSet will be created. The
* expected format is `projects/{project}/locations/{location}`.
* @param phraseSet Required. The PhraseSet to create.
* @param phraseSetId The ID to use for the PhraseSet, which will become the final component of
* the PhraseSet's resource name.
* This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createPhraseSetAsync(
LocationName parent, PhraseSet phraseSet, String phraseSetId) {
CreatePhraseSetRequest request =
CreatePhraseSetRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setPhraseSet(phraseSet)
.setPhraseSetId(phraseSetId)
.build();
return createPhraseSetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* PhraseSet phraseSet = PhraseSet.newBuilder().build();
* String phraseSetId = "phraseSetId959902180";
* PhraseSet response = speechClient.createPhraseSetAsync(parent, phraseSet, phraseSetId).get();
* }
* }
*
* @param parent Required. The project and location where this PhraseSet will be created. The
* expected format is `projects/{project}/locations/{location}`.
* @param phraseSet Required. The PhraseSet to create.
* @param phraseSetId The ID to use for the PhraseSet, which will become the final component of
* the PhraseSet's resource name.
* This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createPhraseSetAsync(
String parent, PhraseSet phraseSet, String phraseSetId) {
CreatePhraseSetRequest request =
CreatePhraseSetRequest.newBuilder()
.setParent(parent)
.setPhraseSet(phraseSet)
.setPhraseSetId(phraseSetId)
.build();
return createPhraseSetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CreatePhraseSetRequest request =
* CreatePhraseSetRequest.newBuilder()
* .setPhraseSet(PhraseSet.newBuilder().build())
* .setValidateOnly(true)
* .setPhraseSetId("phraseSetId959902180")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* PhraseSet response = speechClient.createPhraseSetAsync(request).get();
* }
* }
*
* @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 OperationFuture createPhraseSetAsync(
CreatePhraseSetRequest request) {
return createPhraseSetOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CreatePhraseSetRequest request =
* CreatePhraseSetRequest.newBuilder()
* .setPhraseSet(PhraseSet.newBuilder().build())
* .setValidateOnly(true)
* .setPhraseSetId("phraseSetId959902180")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* OperationFuture future =
* speechClient.createPhraseSetOperationCallable().futureCall(request);
* // Do something.
* PhraseSet response = future.get();
* }
* }
*/
public final OperationCallable
createPhraseSetOperationCallable() {
return stub.createPhraseSetOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* CreatePhraseSetRequest request =
* CreatePhraseSetRequest.newBuilder()
* .setPhraseSet(PhraseSet.newBuilder().build())
* .setValidateOnly(true)
* .setPhraseSetId("phraseSetId959902180")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .build();
* ApiFuture future = speechClient.createPhraseSetCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable createPhraseSetCallable() {
return stub.createPhraseSetCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists PhraseSets.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The project and location of PhraseSet resources to list. The expected
* format is `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPhraseSetsPagedResponse listPhraseSets(LocationName parent) {
ListPhraseSetsRequest request =
ListPhraseSetsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listPhraseSets(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists PhraseSets.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* for (PhraseSet element : speechClient.listPhraseSets(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The project and location of PhraseSet resources to list. The expected
* format is `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListPhraseSetsPagedResponse listPhraseSets(String parent) {
ListPhraseSetsRequest request = ListPhraseSetsRequest.newBuilder().setParent(parent).build();
return listPhraseSets(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists PhraseSets.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListPhraseSetsRequest request =
* ListPhraseSetsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setShowDeleted(true)
* .build();
* for (PhraseSet element : speechClient.listPhraseSets(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @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 ListPhraseSetsPagedResponse listPhraseSets(ListPhraseSetsRequest request) {
return listPhraseSetsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists PhraseSets.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListPhraseSetsRequest request =
* ListPhraseSetsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setShowDeleted(true)
* .build();
* ApiFuture future = speechClient.listPhraseSetsPagedCallable().futureCall(request);
* // Do something.
* for (PhraseSet element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listPhraseSetsPagedCallable() {
return stub.listPhraseSetsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists PhraseSets.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListPhraseSetsRequest request =
* ListPhraseSetsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .setShowDeleted(true)
* .build();
* while (true) {
* ListPhraseSetsResponse response = speechClient.listPhraseSetsCallable().call(request);
* for (PhraseSet element : response.getPhraseSetsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable
listPhraseSetsCallable() {
return stub.listPhraseSetsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
* PhraseSet response = speechClient.getPhraseSet(name);
* }
* }
*
* @param name Required. The name of the PhraseSet to retrieve. The expected format is
* `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
* @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.
/**
* Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
* PhraseSet response = speechClient.getPhraseSet(name);
* }
* }
*
* @param name Required. The name of the PhraseSet to retrieve. The expected format is
* `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
* @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.
/**
* Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetPhraseSetRequest request =
* GetPhraseSetRequest.newBuilder()
* .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
* .build();
* PhraseSet response = speechClient.getPhraseSet(request);
* }
* }
*
* @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.
/**
* Returns the requested [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetPhraseSetRequest request =
* GetPhraseSetRequest.newBuilder()
* .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
* .build();
* ApiFuture future = speechClient.getPhraseSetCallable().futureCall(request);
* // Do something.
* PhraseSet response = future.get();
* }
* }
*/
public final UnaryCallable getPhraseSetCallable() {
return stub.getPhraseSetCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* PhraseSet phraseSet = PhraseSet.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* PhraseSet response = speechClient.updatePhraseSetAsync(phraseSet, updateMask).get();
* }
* }
*
* @param phraseSet Required. The PhraseSet to update.
* The PhraseSet's `name` field is used to identify the PhraseSet to update. Format:
* `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
* @param updateMask The list of fields to update. If empty, all non-default valued fields are
* considered for update. Use `*` to update the entire PhraseSet resource.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updatePhraseSetAsync(
PhraseSet phraseSet, FieldMask updateMask) {
UpdatePhraseSetRequest request =
UpdatePhraseSetRequest.newBuilder()
.setPhraseSet(phraseSet)
.setUpdateMask(updateMask)
.build();
return updatePhraseSetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdatePhraseSetRequest request =
* UpdatePhraseSetRequest.newBuilder()
* .setPhraseSet(PhraseSet.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .setValidateOnly(true)
* .build();
* PhraseSet response = speechClient.updatePhraseSetAsync(request).get();
* }
* }
*
* @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 OperationFuture updatePhraseSetAsync(
UpdatePhraseSetRequest request) {
return updatePhraseSetOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdatePhraseSetRequest request =
* UpdatePhraseSetRequest.newBuilder()
* .setPhraseSet(PhraseSet.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .setValidateOnly(true)
* .build();
* OperationFuture future =
* speechClient.updatePhraseSetOperationCallable().futureCall(request);
* // Do something.
* PhraseSet response = future.get();
* }
* }
*/
public final OperationCallable
updatePhraseSetOperationCallable() {
return stub.updatePhraseSetOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UpdatePhraseSetRequest request =
* UpdatePhraseSetRequest.newBuilder()
* .setPhraseSet(PhraseSet.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .setValidateOnly(true)
* .build();
* ApiFuture future = speechClient.updatePhraseSetCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable updatePhraseSetCallable() {
return stub.updatePhraseSetCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
* PhraseSet response = speechClient.deletePhraseSetAsync(name).get();
* }
* }
*
* @param name Required. The name of the PhraseSet to delete. Format:
* `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deletePhraseSetAsync(
PhraseSetName name) {
DeletePhraseSetRequest request =
DeletePhraseSetRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deletePhraseSetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
* PhraseSet response = speechClient.deletePhraseSetAsync(name).get();
* }
* }
*
* @param name Required. The name of the PhraseSet to delete. Format:
* `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deletePhraseSetAsync(String name) {
DeletePhraseSetRequest request = DeletePhraseSetRequest.newBuilder().setName(name).build();
return deletePhraseSetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* DeletePhraseSetRequest request =
* DeletePhraseSetRequest.newBuilder()
* .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
* .setValidateOnly(true)
* .setAllowMissing(true)
* .setEtag("etag3123477")
* .build();
* PhraseSet response = speechClient.deletePhraseSetAsync(request).get();
* }
* }
*
* @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 OperationFuture deletePhraseSetAsync(
DeletePhraseSetRequest request) {
return deletePhraseSetOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* DeletePhraseSetRequest request =
* DeletePhraseSetRequest.newBuilder()
* .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
* .setValidateOnly(true)
* .setAllowMissing(true)
* .setEtag("etag3123477")
* .build();
* OperationFuture future =
* speechClient.deletePhraseSetOperationCallable().futureCall(request);
* // Do something.
* PhraseSet response = future.get();
* }
* }
*/
public final OperationCallable
deletePhraseSetOperationCallable() {
return stub.deletePhraseSetOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* DeletePhraseSetRequest request =
* DeletePhraseSetRequest.newBuilder()
* .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
* .setValidateOnly(true)
* .setAllowMissing(true)
* .setEtag("etag3123477")
* .build();
* ApiFuture future = speechClient.deletePhraseSetCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable deletePhraseSetCallable() {
return stub.deletePhraseSetCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* PhraseSetName name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]");
* PhraseSet response = speechClient.undeletePhraseSetAsync(name).get();
* }
* }
*
* @param name Required. The name of the PhraseSet to undelete. Format:
* `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture undeletePhraseSetAsync(
PhraseSetName name) {
UndeletePhraseSetRequest request =
UndeletePhraseSetRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
return undeletePhraseSetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* String name = PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString();
* PhraseSet response = speechClient.undeletePhraseSetAsync(name).get();
* }
* }
*
* @param name Required. The name of the PhraseSet to undelete. Format:
* `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture undeletePhraseSetAsync(String name) {
UndeletePhraseSetRequest request = UndeletePhraseSetRequest.newBuilder().setName(name).build();
return undeletePhraseSetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UndeletePhraseSetRequest request =
* UndeletePhraseSetRequest.newBuilder()
* .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* PhraseSet response = speechClient.undeletePhraseSetAsync(request).get();
* }
* }
*
* @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 OperationFuture undeletePhraseSetAsync(
UndeletePhraseSetRequest request) {
return undeletePhraseSetOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UndeletePhraseSetRequest request =
* UndeletePhraseSetRequest.newBuilder()
* .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* OperationFuture future =
* speechClient.undeletePhraseSetOperationCallable().futureCall(request);
* // Do something.
* PhraseSet response = future.get();
* }
* }
*/
public final OperationCallable
undeletePhraseSetOperationCallable() {
return stub.undeletePhraseSetOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Undeletes the [PhraseSet][google.cloud.speech.v2.PhraseSet].
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* UndeletePhraseSetRequest request =
* UndeletePhraseSetRequest.newBuilder()
* .setName(PhraseSetName.of("[PROJECT]", "[LOCATION]", "[PHRASE_SET]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* ApiFuture future = speechClient.undeletePhraseSetCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable undeletePhraseSetCallable() {
return stub.undeletePhraseSetCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Location element : speechClient.listLocations(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @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 ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
return listLocationsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future = speechClient.listLocationsPagedCallable().futureCall(request);
* // Do something.
* for (Location element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listLocationsPagedCallable() {
return stub.listLocationsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListLocationsResponse response = speechClient.listLocationsCallable().call(request);
* for (Location element : response.getLocationsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listLocationsCallable() {
return stub.listLocationsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
* Location response = speechClient.getLocation(request);
* }
* }
*
* @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 Location getLocation(GetLocationRequest request) {
return getLocationCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (SpeechClient speechClient = SpeechClient.create()) {
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
* ApiFuture future = speechClient.getLocationCallable().futureCall(request);
* // Do something.
* Location response = future.get();
* }
* }
*/
public final UnaryCallable getLocationCallable() {
return stub.getLocationCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
public static class ListRecognizersPagedResponse
extends AbstractPagedListResponse<
ListRecognizersRequest,
ListRecognizersResponse,
Recognizer,
ListRecognizersPage,
ListRecognizersFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListRecognizersPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListRecognizersPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListRecognizersPagedResponse(ListRecognizersPage page) {
super(page, ListRecognizersFixedSizeCollection.createEmptyCollection());
}
}
public static class ListRecognizersPage
extends AbstractPage<
ListRecognizersRequest, ListRecognizersResponse, Recognizer, ListRecognizersPage> {
private ListRecognizersPage(
PageContext context,
ListRecognizersResponse response) {
super(context, response);
}
private static ListRecognizersPage createEmptyPage() {
return new ListRecognizersPage(null, null);
}
@Override
protected ListRecognizersPage createPage(
PageContext context,
ListRecognizersResponse response) {
return new ListRecognizersPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListRecognizersFixedSizeCollection
extends AbstractFixedSizeCollection<
ListRecognizersRequest,
ListRecognizersResponse,
Recognizer,
ListRecognizersPage,
ListRecognizersFixedSizeCollection> {
private ListRecognizersFixedSizeCollection(
List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListRecognizersFixedSizeCollection createEmptyCollection() {
return new ListRecognizersFixedSizeCollection(null, 0);
}
@Override
protected ListRecognizersFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListRecognizersFixedSizeCollection(pages, collectionSize);
}
}
public static class ListCustomClassesPagedResponse
extends AbstractPagedListResponse<
ListCustomClassesRequest,
ListCustomClassesResponse,
CustomClass,
ListCustomClassesPage,
ListCustomClassesFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListCustomClassesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListCustomClassesPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListCustomClassesPagedResponse(ListCustomClassesPage page) {
super(page, ListCustomClassesFixedSizeCollection.createEmptyCollection());
}
}
public static class ListCustomClassesPage
extends AbstractPage<
ListCustomClassesRequest, ListCustomClassesResponse, CustomClass, ListCustomClassesPage> {
private ListCustomClassesPage(
PageContext context,
ListCustomClassesResponse response) {
super(context, response);
}
private static ListCustomClassesPage createEmptyPage() {
return new ListCustomClassesPage(null, null);
}
@Override
protected ListCustomClassesPage createPage(
PageContext context,
ListCustomClassesResponse response) {
return new ListCustomClassesPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListCustomClassesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListCustomClassesRequest,
ListCustomClassesResponse,
CustomClass,
ListCustomClassesPage,
ListCustomClassesFixedSizeCollection> {
private ListCustomClassesFixedSizeCollection(
List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListCustomClassesFixedSizeCollection createEmptyCollection() {
return new ListCustomClassesFixedSizeCollection(null, 0);
}
@Override
protected ListCustomClassesFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListCustomClassesFixedSizeCollection(pages, collectionSize);
}
}
public static class ListPhraseSetsPagedResponse
extends AbstractPagedListResponse<
ListPhraseSetsRequest,
ListPhraseSetsResponse,
PhraseSet,
ListPhraseSetsPage,
ListPhraseSetsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListPhraseSetsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListPhraseSetsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListPhraseSetsPagedResponse(ListPhraseSetsPage page) {
super(page, ListPhraseSetsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListPhraseSetsPage
extends AbstractPage<
ListPhraseSetsRequest, ListPhraseSetsResponse, PhraseSet, ListPhraseSetsPage> {
private ListPhraseSetsPage(
PageContext context,
ListPhraseSetsResponse response) {
super(context, response);
}
private static ListPhraseSetsPage createEmptyPage() {
return new ListPhraseSetsPage(null, null);
}
@Override
protected ListPhraseSetsPage createPage(
PageContext context,
ListPhraseSetsResponse response) {
return new ListPhraseSetsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListPhraseSetsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListPhraseSetsRequest,
ListPhraseSetsResponse,
PhraseSet,
ListPhraseSetsPage,
ListPhraseSetsFixedSizeCollection> {
private ListPhraseSetsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListPhraseSetsFixedSizeCollection createEmptyCollection() {
return new ListPhraseSetsFixedSizeCollection(null, 0);
}
@Override
protected ListPhraseSetsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListPhraseSetsFixedSizeCollection(pages, collectionSize);
}
}
public static class ListLocationsPagedResponse
extends AbstractPagedListResponse<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListLocationsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListLocationsPagedResponse(ListLocationsPage page) {
super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListLocationsPage
extends AbstractPage<
ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
private ListLocationsPage(
PageContext context,
ListLocationsResponse response) {
super(context, response);
}
private static ListLocationsPage createEmptyPage() {
return new ListLocationsPage(null, null);
}
@Override
protected ListLocationsPage createPage(
PageContext context,
ListLocationsResponse response) {
return new ListLocationsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListLocationsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
private ListLocationsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListLocationsFixedSizeCollection createEmptyCollection() {
return new ListLocationsFixedSizeCollection(null, 0);
}
@Override
protected ListLocationsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListLocationsFixedSizeCollection(pages, collectionSize);
}
}
}