All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.translate.v3beta1.TranslationServiceClient Maven / Gradle / Ivy

There is a newer version: 2.54.0
Show newest version
/*
 * Copyright 2024 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.translate.v3beta1;

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.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.translate.v3beta1.stub.TranslationServiceStub;
import com.google.cloud.translate.v3beta1.stub.TranslationServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * Service Description: Provides natural language translation operations.
 *
 * 

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
 *   TranslateTextRequest request =
 *       TranslateTextRequest.newBuilder()
 *           .addAllContents(new ArrayList())
 *           .setMimeType("mimeType-1392120434")
 *           .setSourceLanguageCode("sourceLanguageCode1645917472")
 *           .setTargetLanguageCode("targetLanguageCode-106414698")
 *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
 *           .setModel("model104069929")
 *           .setGlossaryConfig(TranslateTextGlossaryConfig.newBuilder().build())
 *           .putAllLabels(new HashMap())
 *           .build();
 *   TranslateTextResponse response = translationServiceClient.translateText(request);
 * }
 * }
* *

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

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Methods
MethodDescriptionMethod Variants

TranslateText

Translates input text and returns translated text.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • translateText(TranslateTextRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • translateTextCallable() *

*

DetectLanguage

Detects the language of text within a request.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • detectLanguage(DetectLanguageRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • detectLanguage(LocationName parent, String model, String mimeType) *

  • detectLanguage(String parent, String model, String mimeType) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • detectLanguageCallable() *

*

GetSupportedLanguages

Returns a list of supported languages for translation.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getSupportedLanguages(GetSupportedLanguagesRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getSupportedLanguages(LocationName parent, String displayLanguageCode, String model) *

  • getSupportedLanguages(String parent, String displayLanguageCode, String model) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getSupportedLanguagesCallable() *

*

TranslateDocument

Translates documents in synchronous mode.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • translateDocument(TranslateDocumentRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • translateDocumentCallable() *

*

BatchTranslateText

Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. *

This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • batchTranslateTextAsync(BatchTranslateTextRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • batchTranslateTextOperationCallable() *

  • batchTranslateTextCallable() *

*

BatchTranslateDocument

Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. *

This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • batchTranslateDocumentAsync(BatchTranslateDocumentRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • batchTranslateDocumentAsync(LocationName parent, String sourceLanguageCode, List<String> targetLanguageCodes, List<BatchDocumentInputConfig> inputConfigs, BatchDocumentOutputConfig outputConfig) *

  • batchTranslateDocumentAsync(String parent, String sourceLanguageCode, List<String> targetLanguageCodes, List<BatchDocumentInputConfig> inputConfigs, BatchDocumentOutputConfig outputConfig) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • batchTranslateDocumentOperationCallable() *

  • batchTranslateDocumentCallable() *

*

CreateGlossary

Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • createGlossaryAsync(CreateGlossaryRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • createGlossaryAsync(LocationName parent, Glossary glossary) *

  • createGlossaryAsync(String parent, Glossary glossary) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • createGlossaryOperationCallable() *

  • createGlossaryCallable() *

*

ListGlossaries

Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listGlossaries(ListGlossariesRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listGlossaries(LocationName parent, String filter) *

  • listGlossaries(String parent, String filter) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listGlossariesPagedCallable() *

  • listGlossariesCallable() *

*

GetGlossary

Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getGlossary(GetGlossaryRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getGlossary(GlossaryName name) *

  • getGlossary(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getGlossaryCallable() *

*

DeleteGlossary

Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • deleteGlossaryAsync(DeleteGlossaryRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • deleteGlossaryAsync(GlossaryName name) *

  • deleteGlossaryAsync(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • deleteGlossaryOperationCallable() *

  • deleteGlossaryCallable() *

*
* *

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 TranslationServiceSettings 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
 * TranslationServiceSettings translationServiceSettings =
 *     TranslationServiceSettings.newBuilder()
 *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
 *         .build();
 * TranslationServiceClient translationServiceClient =
 *     TranslationServiceClient.create(translationServiceSettings);
 * }
* *

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
 * TranslationServiceSettings translationServiceSettings =
 *     TranslationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 * TranslationServiceClient translationServiceClient =
 *     TranslationServiceClient.create(translationServiceSettings);
 * }
* *

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
 * TranslationServiceSettings translationServiceSettings =
 *     TranslationServiceSettings.newHttpJsonBuilder().build();
 * TranslationServiceClient translationServiceClient =
 *     TranslationServiceClient.create(translationServiceSettings);
 * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @Generated("by gapic-generator-java") public class TranslationServiceClient implements BackgroundResource { private final TranslationServiceSettings settings; private final TranslationServiceStub stub; private final OperationsClient httpJsonOperationsClient; private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of TranslationServiceClient with default settings. */ public static final TranslationServiceClient create() throws IOException { return create(TranslationServiceSettings.newBuilder().build()); } /** * Constructs an instance of TranslationServiceClient, 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 TranslationServiceClient create(TranslationServiceSettings settings) throws IOException { return new TranslationServiceClient(settings); } /** * Constructs an instance of TranslationServiceClient, using the given stub for making calls. This * is for advanced usage - prefer using create(TranslationServiceSettings). */ public static final TranslationServiceClient create(TranslationServiceStub stub) { return new TranslationServiceClient(stub); } /** * Constructs an instance of TranslationServiceClient, 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 TranslationServiceClient(TranslationServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((TranslationServiceStubSettings) settings.getStubSettings()).createStub(); this.operationsClient = com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected TranslationServiceClient(TranslationServiceStub 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 TranslationServiceSettings getSettings() { return settings; } public TranslationServiceStub 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. /** * Translates input text and returns translated text. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   TranslateTextRequest request =
   *       TranslateTextRequest.newBuilder()
   *           .addAllContents(new ArrayList())
   *           .setMimeType("mimeType-1392120434")
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .setTargetLanguageCode("targetLanguageCode-106414698")
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setModel("model104069929")
   *           .setGlossaryConfig(TranslateTextGlossaryConfig.newBuilder().build())
   *           .putAllLabels(new HashMap())
   *           .build();
   *   TranslateTextResponse response = translationServiceClient.translateText(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 TranslateTextResponse translateText(TranslateTextRequest request) { return translateTextCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates input text and returns translated text. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   TranslateTextRequest request =
   *       TranslateTextRequest.newBuilder()
   *           .addAllContents(new ArrayList())
   *           .setMimeType("mimeType-1392120434")
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .setTargetLanguageCode("targetLanguageCode-106414698")
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setModel("model104069929")
   *           .setGlossaryConfig(TranslateTextGlossaryConfig.newBuilder().build())
   *           .putAllLabels(new HashMap())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.translateTextCallable().futureCall(request);
   *   // Do something.
   *   TranslateTextResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable translateTextCallable() { return stub.translateTextCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Detects the language of text within a request. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   String model = "model104069929";
   *   String mimeType = "mimeType-1392120434";
   *   DetectLanguageResponse response =
   *       translationServiceClient.detectLanguage(parent, model, mimeType);
   * }
   * }
* * @param parent Required. Project or location to make a call. Must refer to a caller's project. *

Format: `projects/{project-number-or-id}/locations/{location-id}` or * `projects/{project-number-or-id}`. *

For global calls, use `projects/{project-number-or-id}/locations/global` or * `projects/{project-number-or-id}`. *

Only models within the same region (has same location-id) can be used. Otherwise an * INVALID_ARGUMENT (400) error is returned. * @param model Optional. The language detection model to be used. *

Format: * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` *

Only one language detection model is currently supported: * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. *

If not specified, the default model is used. * @param mimeType Optional. The format of the source text, for example, "text/html", * "text/plain". If left blank, the MIME type defaults to "text/html". * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final DetectLanguageResponse detectLanguage( LocationName parent, String model, String mimeType) { DetectLanguageRequest request = DetectLanguageRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setModel(model) .setMimeType(mimeType) .build(); return detectLanguage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Detects the language of text within a request. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   String model = "model104069929";
   *   String mimeType = "mimeType-1392120434";
   *   DetectLanguageResponse response =
   *       translationServiceClient.detectLanguage(parent, model, mimeType);
   * }
   * }
* * @param parent Required. Project or location to make a call. Must refer to a caller's project. *

Format: `projects/{project-number-or-id}/locations/{location-id}` or * `projects/{project-number-or-id}`. *

For global calls, use `projects/{project-number-or-id}/locations/global` or * `projects/{project-number-or-id}`. *

Only models within the same region (has same location-id) can be used. Otherwise an * INVALID_ARGUMENT (400) error is returned. * @param model Optional. The language detection model to be used. *

Format: * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}` *

Only one language detection model is currently supported: * `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default`. *

If not specified, the default model is used. * @param mimeType Optional. The format of the source text, for example, "text/html", * "text/plain". If left blank, the MIME type defaults to "text/html". * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final DetectLanguageResponse detectLanguage(String parent, String model, String mimeType) { DetectLanguageRequest request = DetectLanguageRequest.newBuilder() .setParent(parent) .setModel(model) .setMimeType(mimeType) .build(); return detectLanguage(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Detects the language of text within a request. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   DetectLanguageRequest request =
   *       DetectLanguageRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setModel("model104069929")
   *           .setMimeType("mimeType-1392120434")
   *           .putAllLabels(new HashMap())
   *           .build();
   *   DetectLanguageResponse response = translationServiceClient.detectLanguage(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 DetectLanguageResponse detectLanguage(DetectLanguageRequest request) { return detectLanguageCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Detects the language of text within a request. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   DetectLanguageRequest request =
   *       DetectLanguageRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setModel("model104069929")
   *           .setMimeType("mimeType-1392120434")
   *           .putAllLabels(new HashMap())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.detectLanguageCallable().futureCall(request);
   *   // Do something.
   *   DetectLanguageResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable detectLanguageCallable() { return stub.detectLanguageCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of supported languages for translation. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   String displayLanguageCode = "displayLanguageCode-1457478841";
   *   String model = "model104069929";
   *   SupportedLanguages response =
   *       translationServiceClient.getSupportedLanguages(parent, displayLanguageCode, model);
   * }
   * }
* * @param parent Required. Project or location to make a call. Must refer to a caller's project. *

Format: `projects/{project-number-or-id}` or * `projects/{project-number-or-id}/locations/{location-id}`. *

For global calls, use `projects/{project-number-or-id}/locations/global` or * `projects/{project-number-or-id}`. *

Non-global location is required for AutoML models. *

Only models within the same region (have same location-id) can be used, otherwise an * INVALID_ARGUMENT (400) error is returned. * @param displayLanguageCode Optional. The language to use to return localized, human readable * names of supported languages. If missing, then display names are not returned in a * response. * @param model Optional. Get supported languages of this model. *

The format depends on model type: *

- AutoML Translation models: * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` *

- General (built-in) models: * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, *

Returns languages supported by the specified model. If missing, we get supported * languages of Google general NMT model. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SupportedLanguages getSupportedLanguages( LocationName parent, String displayLanguageCode, String model) { GetSupportedLanguagesRequest request = GetSupportedLanguagesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setDisplayLanguageCode(displayLanguageCode) .setModel(model) .build(); return getSupportedLanguages(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of supported languages for translation. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   String displayLanguageCode = "displayLanguageCode-1457478841";
   *   String model = "model104069929";
   *   SupportedLanguages response =
   *       translationServiceClient.getSupportedLanguages(parent, displayLanguageCode, model);
   * }
   * }
* * @param parent Required. Project or location to make a call. Must refer to a caller's project. *

Format: `projects/{project-number-or-id}` or * `projects/{project-number-or-id}/locations/{location-id}`. *

For global calls, use `projects/{project-number-or-id}/locations/global` or * `projects/{project-number-or-id}`. *

Non-global location is required for AutoML models. *

Only models within the same region (have same location-id) can be used, otherwise an * INVALID_ARGUMENT (400) error is returned. * @param displayLanguageCode Optional. The language to use to return localized, human readable * names of supported languages. If missing, then display names are not returned in a * response. * @param model Optional. Get supported languages of this model. *

The format depends on model type: *

- AutoML Translation models: * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` *

- General (built-in) models: * `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, *

Returns languages supported by the specified model. If missing, we get supported * languages of Google general NMT model. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SupportedLanguages getSupportedLanguages( String parent, String displayLanguageCode, String model) { GetSupportedLanguagesRequest request = GetSupportedLanguagesRequest.newBuilder() .setParent(parent) .setDisplayLanguageCode(displayLanguageCode) .setModel(model) .build(); return getSupportedLanguages(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of supported languages for translation. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   GetSupportedLanguagesRequest request =
   *       GetSupportedLanguagesRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setDisplayLanguageCode("displayLanguageCode-1457478841")
   *           .setModel("model104069929")
   *           .build();
   *   SupportedLanguages response = translationServiceClient.getSupportedLanguages(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 SupportedLanguages getSupportedLanguages(GetSupportedLanguagesRequest request) { return getSupportedLanguagesCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of supported languages for translation. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   GetSupportedLanguagesRequest request =
   *       GetSupportedLanguagesRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setDisplayLanguageCode("displayLanguageCode-1457478841")
   *           .setModel("model104069929")
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.getSupportedLanguagesCallable().futureCall(request);
   *   // Do something.
   *   SupportedLanguages response = future.get();
   * }
   * }
*/ public final UnaryCallable getSupportedLanguagesCallable() { return stub.getSupportedLanguagesCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates documents in synchronous mode. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   TranslateDocumentRequest request =
   *       TranslateDocumentRequest.newBuilder()
   *           .setParent("parent-995424086")
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .setTargetLanguageCode("targetLanguageCode-106414698")
   *           .setDocumentInputConfig(DocumentInputConfig.newBuilder().build())
   *           .setDocumentOutputConfig(DocumentOutputConfig.newBuilder().build())
   *           .setModel("model104069929")
   *           .setGlossaryConfig(TranslateTextGlossaryConfig.newBuilder().build())
   *           .putAllLabels(new HashMap())
   *           .setCustomizedAttribution("customizedAttribution557650238")
   *           .setIsTranslateNativePdfOnly(true)
   *           .setEnableShadowRemovalNativePdf(true)
   *           .setEnableRotationCorrection(true)
   *           .build();
   *   TranslateDocumentResponse response = translationServiceClient.translateDocument(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 TranslateDocumentResponse translateDocument(TranslateDocumentRequest request) { return translateDocumentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates documents in synchronous mode. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   TranslateDocumentRequest request =
   *       TranslateDocumentRequest.newBuilder()
   *           .setParent("parent-995424086")
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .setTargetLanguageCode("targetLanguageCode-106414698")
   *           .setDocumentInputConfig(DocumentInputConfig.newBuilder().build())
   *           .setDocumentOutputConfig(DocumentOutputConfig.newBuilder().build())
   *           .setModel("model104069929")
   *           .setGlossaryConfig(TranslateTextGlossaryConfig.newBuilder().build())
   *           .putAllLabels(new HashMap())
   *           .setCustomizedAttribution("customizedAttribution557650238")
   *           .setIsTranslateNativePdfOnly(true)
   *           .setEnableShadowRemovalNativePdf(true)
   *           .setEnableRotationCorrection(true)
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.translateDocumentCallable().futureCall(request);
   *   // Do something.
   *   TranslateDocumentResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable translateDocumentCallable() { return stub.translateDocumentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates a large volume of text in asynchronous batch mode. This function provides real-time * output as the inputs are being processed. If caller cancels a request, the partial results (for * an input file, it's all or nothing) may still be available on the specified output location. * *

This call returns immediately and you can use google.longrunning.Operation.name to poll the * status of the call. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   BatchTranslateTextRequest request =
   *       BatchTranslateTextRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .addAllTargetLanguageCodes(new ArrayList())
   *           .putAllModels(new HashMap())
   *           .addAllInputConfigs(new ArrayList())
   *           .setOutputConfig(OutputConfig.newBuilder().build())
   *           .putAllGlossaries(new HashMap())
   *           .putAllLabels(new HashMap())
   *           .build();
   *   BatchTranslateResponse response =
   *       translationServiceClient.batchTranslateTextAsync(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 batchTranslateTextAsync(BatchTranslateTextRequest request) { return batchTranslateTextOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates a large volume of text in asynchronous batch mode. This function provides real-time * output as the inputs are being processed. If caller cancels a request, the partial results (for * an input file, it's all or nothing) may still be available on the specified output location. * *

This call returns immediately and you can use google.longrunning.Operation.name to poll the * status of the call. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   BatchTranslateTextRequest request =
   *       BatchTranslateTextRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .addAllTargetLanguageCodes(new ArrayList())
   *           .putAllModels(new HashMap())
   *           .addAllInputConfigs(new ArrayList())
   *           .setOutputConfig(OutputConfig.newBuilder().build())
   *           .putAllGlossaries(new HashMap())
   *           .putAllLabels(new HashMap())
   *           .build();
   *   OperationFuture future =
   *       translationServiceClient.batchTranslateTextOperationCallable().futureCall(request);
   *   // Do something.
   *   BatchTranslateResponse response = future.get();
   * }
   * }
*/ public final OperationCallable< BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata> batchTranslateTextOperationCallable() { return stub.batchTranslateTextOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates a large volume of text in asynchronous batch mode. This function provides real-time * output as the inputs are being processed. If caller cancels a request, the partial results (for * an input file, it's all or nothing) may still be available on the specified output location. * *

This call returns immediately and you can use google.longrunning.Operation.name to poll the * status of the call. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   BatchTranslateTextRequest request =
   *       BatchTranslateTextRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .addAllTargetLanguageCodes(new ArrayList())
   *           .putAllModels(new HashMap())
   *           .addAllInputConfigs(new ArrayList())
   *           .setOutputConfig(OutputConfig.newBuilder().build())
   *           .putAllGlossaries(new HashMap())
   *           .putAllLabels(new HashMap())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.batchTranslateTextCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable batchTranslateTextCallable() { return stub.batchTranslateTextCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates a large volume of document in asynchronous batch mode. This function provides * real-time output as the inputs are being processed. If caller cancels a request, the partial * results (for an input file, it's all or nothing) may still be available on the specified output * location. * *

This call returns immediately and you can use google.longrunning.Operation.name to poll the * status of the call. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   String sourceLanguageCode = "sourceLanguageCode1645917472";
   *   List targetLanguageCodes = new ArrayList<>();
   *   List inputConfigs = new ArrayList<>();
   *   BatchDocumentOutputConfig outputConfig = BatchDocumentOutputConfig.newBuilder().build();
   *   BatchTranslateDocumentResponse response =
   *       translationServiceClient
   *           .batchTranslateDocumentAsync(
   *               parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig)
   *           .get();
   * }
   * }
* * @param parent Required. Location to make a regional call. *

Format: `projects/{project-number-or-id}/locations/{location-id}`. *

The `global` location is not supported for batch translation. *

Only AutoML Translation models or glossaries within the same region (have the same * location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned. * @param sourceLanguageCode Required. The BCP-47 language code of the input document if known, * for example, "en-US" or "sr-Latn". Supported language codes are listed in [Language * Support](https://cloud.google.com/translate/docs/languages). * @param targetLanguageCodes Required. The BCP-47 language code to use for translation of the * input document. Specify up to 10 language codes here. * @param inputConfigs Required. Input configurations. The total number of files matched should be * <= 100. The total content size to translate should be <= 100M Unicode codepoints. The * files must use UTF-8 encoding. * @param outputConfig Required. Output configuration. If 2 input configs match to the same file * (that is, same input path), we don't generate output for duplicate inputs. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture batchTranslateDocumentAsync( LocationName parent, String sourceLanguageCode, List targetLanguageCodes, List inputConfigs, BatchDocumentOutputConfig outputConfig) { BatchTranslateDocumentRequest request = BatchTranslateDocumentRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setSourceLanguageCode(sourceLanguageCode) .addAllTargetLanguageCodes(targetLanguageCodes) .addAllInputConfigs(inputConfigs) .setOutputConfig(outputConfig) .build(); return batchTranslateDocumentAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates a large volume of document in asynchronous batch mode. This function provides * real-time output as the inputs are being processed. If caller cancels a request, the partial * results (for an input file, it's all or nothing) may still be available on the specified output * location. * *

This call returns immediately and you can use google.longrunning.Operation.name to poll the * status of the call. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   String sourceLanguageCode = "sourceLanguageCode1645917472";
   *   List targetLanguageCodes = new ArrayList<>();
   *   List inputConfigs = new ArrayList<>();
   *   BatchDocumentOutputConfig outputConfig = BatchDocumentOutputConfig.newBuilder().build();
   *   BatchTranslateDocumentResponse response =
   *       translationServiceClient
   *           .batchTranslateDocumentAsync(
   *               parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig)
   *           .get();
   * }
   * }
* * @param parent Required. Location to make a regional call. *

Format: `projects/{project-number-or-id}/locations/{location-id}`. *

The `global` location is not supported for batch translation. *

Only AutoML Translation models or glossaries within the same region (have the same * location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned. * @param sourceLanguageCode Required. The BCP-47 language code of the input document if known, * for example, "en-US" or "sr-Latn". Supported language codes are listed in [Language * Support](https://cloud.google.com/translate/docs/languages). * @param targetLanguageCodes Required. The BCP-47 language code to use for translation of the * input document. Specify up to 10 language codes here. * @param inputConfigs Required. Input configurations. The total number of files matched should be * <= 100. The total content size to translate should be <= 100M Unicode codepoints. The * files must use UTF-8 encoding. * @param outputConfig Required. Output configuration. If 2 input configs match to the same file * (that is, same input path), we don't generate output for duplicate inputs. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture batchTranslateDocumentAsync( String parent, String sourceLanguageCode, List targetLanguageCodes, List inputConfigs, BatchDocumentOutputConfig outputConfig) { BatchTranslateDocumentRequest request = BatchTranslateDocumentRequest.newBuilder() .setParent(parent) .setSourceLanguageCode(sourceLanguageCode) .addAllTargetLanguageCodes(targetLanguageCodes) .addAllInputConfigs(inputConfigs) .setOutputConfig(outputConfig) .build(); return batchTranslateDocumentAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates a large volume of document in asynchronous batch mode. This function provides * real-time output as the inputs are being processed. If caller cancels a request, the partial * results (for an input file, it's all or nothing) may still be available on the specified output * location. * *

This call returns immediately and you can use google.longrunning.Operation.name to poll the * status of the call. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   BatchTranslateDocumentRequest request =
   *       BatchTranslateDocumentRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .addAllTargetLanguageCodes(new ArrayList())
   *           .addAllInputConfigs(new ArrayList())
   *           .setOutputConfig(BatchDocumentOutputConfig.newBuilder().build())
   *           .putAllModels(new HashMap())
   *           .putAllGlossaries(new HashMap())
   *           .putAllFormatConversions(new HashMap())
   *           .setCustomizedAttribution("customizedAttribution557650238")
   *           .setEnableShadowRemovalNativePdf(true)
   *           .setEnableRotationCorrection(true)
   *           .build();
   *   BatchTranslateDocumentResponse response =
   *       translationServiceClient.batchTranslateDocumentAsync(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 batchTranslateDocumentAsync(BatchTranslateDocumentRequest request) { return batchTranslateDocumentOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates a large volume of document in asynchronous batch mode. This function provides * real-time output as the inputs are being processed. If caller cancels a request, the partial * results (for an input file, it's all or nothing) may still be available on the specified output * location. * *

This call returns immediately and you can use google.longrunning.Operation.name to poll the * status of the call. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   BatchTranslateDocumentRequest request =
   *       BatchTranslateDocumentRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .addAllTargetLanguageCodes(new ArrayList())
   *           .addAllInputConfigs(new ArrayList())
   *           .setOutputConfig(BatchDocumentOutputConfig.newBuilder().build())
   *           .putAllModels(new HashMap())
   *           .putAllGlossaries(new HashMap())
   *           .putAllFormatConversions(new HashMap())
   *           .setCustomizedAttribution("customizedAttribution557650238")
   *           .setEnableShadowRemovalNativePdf(true)
   *           .setEnableRotationCorrection(true)
   *           .build();
   *   OperationFuture future =
   *       translationServiceClient.batchTranslateDocumentOperationCallable().futureCall(request);
   *   // Do something.
   *   BatchTranslateDocumentResponse response = future.get();
   * }
   * }
*/ public final OperationCallable< BatchTranslateDocumentRequest, BatchTranslateDocumentResponse, BatchTranslateDocumentMetadata> batchTranslateDocumentOperationCallable() { return stub.batchTranslateDocumentOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translates a large volume of document in asynchronous batch mode. This function provides * real-time output as the inputs are being processed. If caller cancels a request, the partial * results (for an input file, it's all or nothing) may still be available on the specified output * location. * *

This call returns immediately and you can use google.longrunning.Operation.name to poll the * status of the call. * *

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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   BatchTranslateDocumentRequest request =
   *       BatchTranslateDocumentRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setSourceLanguageCode("sourceLanguageCode1645917472")
   *           .addAllTargetLanguageCodes(new ArrayList())
   *           .addAllInputConfigs(new ArrayList())
   *           .setOutputConfig(BatchDocumentOutputConfig.newBuilder().build())
   *           .putAllModels(new HashMap())
   *           .putAllGlossaries(new HashMap())
   *           .putAllFormatConversions(new HashMap())
   *           .setCustomizedAttribution("customizedAttribution557650238")
   *           .setEnableShadowRemovalNativePdf(true)
   *           .setEnableRotationCorrection(true)
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.batchTranslateDocumentCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable batchTranslateDocumentCallable() { return stub.batchTranslateDocumentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project * 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   Glossary glossary = Glossary.newBuilder().build();
   *   Glossary response = translationServiceClient.createGlossaryAsync(parent, glossary).get();
   * }
   * }
* * @param parent Required. The project name. * @param glossary Required. The glossary to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture createGlossaryAsync( LocationName parent, Glossary glossary) { CreateGlossaryRequest request = CreateGlossaryRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setGlossary(glossary) .build(); return createGlossaryAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project * 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   Glossary glossary = Glossary.newBuilder().build();
   *   Glossary response = translationServiceClient.createGlossaryAsync(parent, glossary).get();
   * }
   * }
* * @param parent Required. The project name. * @param glossary Required. The glossary to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture createGlossaryAsync( String parent, Glossary glossary) { CreateGlossaryRequest request = CreateGlossaryRequest.newBuilder().setParent(parent).setGlossary(glossary).build(); return createGlossaryAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project * 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   CreateGlossaryRequest request =
   *       CreateGlossaryRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setGlossary(Glossary.newBuilder().build())
   *           .build();
   *   Glossary response = translationServiceClient.createGlossaryAsync(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 createGlossaryAsync( CreateGlossaryRequest request) { return createGlossaryOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project * 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   CreateGlossaryRequest request =
   *       CreateGlossaryRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setGlossary(Glossary.newBuilder().build())
   *           .build();
   *   OperationFuture future =
   *       translationServiceClient.createGlossaryOperationCallable().futureCall(request);
   *   // Do something.
   *   Glossary response = future.get();
   * }
   * }
*/ public final OperationCallable createGlossaryOperationCallable() { return stub.createGlossaryOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project * 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   CreateGlossaryRequest request =
   *       CreateGlossaryRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setGlossary(Glossary.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.createGlossaryCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable createGlossaryCallable() { return stub.createGlossaryCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists glossaries in a project. Returns NOT_FOUND, if the project 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   String filter = "filter-1274492040";
   *   for (Glossary element :
   *       translationServiceClient.listGlossaries(parent, filter).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The name of the project from which to list all of the glossaries. * @param filter Optional. Filter specifying constraints of a list operation. Specify the * constraint by the format of "key=value", where key must be "src" or "tgt", and the value * must be a valid language code. For multiple restrictions, concatenate them by "AND" * (uppercase only), such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used * here, which means using 'en-US' and 'en' can lead to different results, which depends on * the language code you used when you create the glossary. For the unidirectional glossaries, * the "src" and "tgt" add restrictions on the source and target language code separately. For * the equivalent term set glossaries, the "src" and/or "tgt" add restrictions on the term * set. For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional glossaries * which exactly match the source language code as "en-US" and the target language code * "zh-CN", but all equivalent term set glossaries which contain "en-US" and "zh-CN" in their * language set will be picked. If missing, no filtering is performed. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListGlossariesPagedResponse listGlossaries(LocationName parent, String filter) { ListGlossariesRequest request = ListGlossariesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); return listGlossaries(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists glossaries in a project. Returns NOT_FOUND, if the project 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   String filter = "filter-1274492040";
   *   for (Glossary element :
   *       translationServiceClient.listGlossaries(parent, filter).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The name of the project from which to list all of the glossaries. * @param filter Optional. Filter specifying constraints of a list operation. Specify the * constraint by the format of "key=value", where key must be "src" or "tgt", and the value * must be a valid language code. For multiple restrictions, concatenate them by "AND" * (uppercase only), such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used * here, which means using 'en-US' and 'en' can lead to different results, which depends on * the language code you used when you create the glossary. For the unidirectional glossaries, * the "src" and "tgt" add restrictions on the source and target language code separately. For * the equivalent term set glossaries, the "src" and/or "tgt" add restrictions on the term * set. For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional glossaries * which exactly match the source language code as "en-US" and the target language code * "zh-CN", but all equivalent term set glossaries which contain "en-US" and "zh-CN" in their * language set will be picked. If missing, no filtering is performed. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListGlossariesPagedResponse listGlossaries(String parent, String filter) { ListGlossariesRequest request = ListGlossariesRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listGlossaries(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists glossaries in a project. Returns NOT_FOUND, if the project 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   ListGlossariesRequest request =
   *       ListGlossariesRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   for (Glossary element : translationServiceClient.listGlossaries(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 ListGlossariesPagedResponse listGlossaries(ListGlossariesRequest request) { return listGlossariesPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists glossaries in a project. Returns NOT_FOUND, if the project 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   ListGlossariesRequest request =
   *       ListGlossariesRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.listGlossariesPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Glossary element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listGlossariesPagedCallable() { return stub.listGlossariesPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists glossaries in a project. Returns NOT_FOUND, if the project 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   ListGlossariesRequest request =
   *       ListGlossariesRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   while (true) {
   *     ListGlossariesResponse response =
   *         translationServiceClient.listGlossariesCallable().call(request);
   *     for (Glossary element : response.getGlossariesList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listGlossariesCallable() { return stub.listGlossariesCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a glossary. Returns NOT_FOUND, if the glossary 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
   *   Glossary response = translationServiceClient.getGlossary(name);
   * }
   * }
* * @param name Required. The name of the glossary to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Glossary getGlossary(GlossaryName name) { GetGlossaryRequest request = GetGlossaryRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getGlossary(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a glossary. Returns NOT_FOUND, if the glossary 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   String name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString();
   *   Glossary response = translationServiceClient.getGlossary(name);
   * }
   * }
* * @param name Required. The name of the glossary to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Glossary getGlossary(String name) { GetGlossaryRequest request = GetGlossaryRequest.newBuilder().setName(name).build(); return getGlossary(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a glossary. Returns NOT_FOUND, if the glossary 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   GetGlossaryRequest request =
   *       GetGlossaryRequest.newBuilder()
   *           .setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
   *           .build();
   *   Glossary response = translationServiceClient.getGlossary(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 Glossary getGlossary(GetGlossaryRequest request) { return getGlossaryCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets a glossary. Returns NOT_FOUND, if the glossary 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   GetGlossaryRequest request =
   *       GetGlossaryRequest.newBuilder()
   *           .setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.getGlossaryCallable().futureCall(request);
   *   // Do something.
   *   Glossary response = future.get();
   * }
   * }
*/ public final UnaryCallable getGlossaryCallable() { return stub.getGlossaryCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns * NOT_FOUND, if the glossary 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   GlossaryName name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name).get();
   * }
   * }
* * @param name Required. The name of the glossary to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture deleteGlossaryAsync( GlossaryName name) { DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return deleteGlossaryAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns * NOT_FOUND, if the glossary 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   String name = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString();
   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(name).get();
   * }
   * }
* * @param name Required. The name of the glossary to delete. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture deleteGlossaryAsync( String name) { DeleteGlossaryRequest request = DeleteGlossaryRequest.newBuilder().setName(name).build(); return deleteGlossaryAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns * NOT_FOUND, if the glossary 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   DeleteGlossaryRequest request =
   *       DeleteGlossaryRequest.newBuilder()
   *           .setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
   *           .build();
   *   DeleteGlossaryResponse response = translationServiceClient.deleteGlossaryAsync(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 deleteGlossaryAsync( DeleteGlossaryRequest request) { return deleteGlossaryOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns * NOT_FOUND, if the glossary 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   DeleteGlossaryRequest request =
   *       DeleteGlossaryRequest.newBuilder()
   *           .setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
   *           .build();
   *   OperationFuture future =
   *       translationServiceClient.deleteGlossaryOperationCallable().futureCall(request);
   *   // Do something.
   *   DeleteGlossaryResponse response = future.get();
   * }
   * }
*/ public final OperationCallable< DeleteGlossaryRequest, DeleteGlossaryResponse, DeleteGlossaryMetadata> deleteGlossaryOperationCallable() { return stub.deleteGlossaryOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns * NOT_FOUND, if the glossary 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 (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
   *   DeleteGlossaryRequest request =
   *       DeleteGlossaryRequest.newBuilder()
   *           .setName(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.deleteGlossaryCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable deleteGlossaryCallable() { return stub.deleteGlossaryCallable(); } @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 ListGlossariesPagedResponse extends AbstractPagedListResponse< ListGlossariesRequest, ListGlossariesResponse, Glossary, ListGlossariesPage, ListGlossariesFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListGlossariesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListGlossariesPagedResponse(input), MoreExecutors.directExecutor()); } private ListGlossariesPagedResponse(ListGlossariesPage page) { super(page, ListGlossariesFixedSizeCollection.createEmptyCollection()); } } public static class ListGlossariesPage extends AbstractPage< ListGlossariesRequest, ListGlossariesResponse, Glossary, ListGlossariesPage> { private ListGlossariesPage( PageContext context, ListGlossariesResponse response) { super(context, response); } private static ListGlossariesPage createEmptyPage() { return new ListGlossariesPage(null, null); } @Override protected ListGlossariesPage createPage( PageContext context, ListGlossariesResponse response) { return new ListGlossariesPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListGlossariesFixedSizeCollection extends AbstractFixedSizeCollection< ListGlossariesRequest, ListGlossariesResponse, Glossary, ListGlossariesPage, ListGlossariesFixedSizeCollection> { private ListGlossariesFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListGlossariesFixedSizeCollection createEmptyCollection() { return new ListGlossariesFixedSizeCollection(null, 0); } @Override protected ListGlossariesFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListGlossariesFixedSizeCollection(pages, collectionSize); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy