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

com.google.cloud.translate.v3.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.v3;

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.v3.stub.TranslationServiceStub;
import com.google.cloud.translate.v3.stub.TranslationServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
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()) {
 *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
 *   String targetLanguageCode = "targetLanguageCode-106414698";
 *   List contents = new ArrayList<>();
 *   TranslateTextResponse response =
 *       translationServiceClient.translateText(parent, targetLanguageCode, contents);
 * }
 * }
* *

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) *

*

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

*
    *
  • translateText(LocationName parent, String targetLanguageCode, List<String> contents) *

  • translateText(String parent, String targetLanguageCode, List<String> contents) *

  • translateText(LocationName parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List<String> contents) *

  • translateText(String parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List<String> contents) *

*

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, String content) *

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

*

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 model, String displayLanguageCode) *

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

*

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) *

  • listGlossaries(String parent) *

*

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() *

*

CreateAdaptiveMtDataset

Creates an Adaptive MT dataset.

*

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

*
    *
  • createAdaptiveMtDataset(CreateAdaptiveMtDatasetRequest request) *

*

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

*
    *
  • createAdaptiveMtDataset(LocationName parent, AdaptiveMtDataset adaptiveMtDataset) *

  • createAdaptiveMtDataset(String parent, AdaptiveMtDataset adaptiveMtDataset) *

*

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

*
    *
  • createAdaptiveMtDatasetCallable() *

*

DeleteAdaptiveMtDataset

Deletes an Adaptive MT dataset, including all its entries and associated metadata.

*

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

*
    *
  • deleteAdaptiveMtDataset(DeleteAdaptiveMtDatasetRequest request) *

*

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

*
    *
  • deleteAdaptiveMtDataset(AdaptiveMtDatasetName name) *

  • deleteAdaptiveMtDataset(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.

*
    *
  • deleteAdaptiveMtDatasetCallable() *

*

GetAdaptiveMtDataset

Gets the Adaptive MT dataset.

*

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

*
    *
  • getAdaptiveMtDataset(GetAdaptiveMtDatasetRequest request) *

*

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

*
    *
  • getAdaptiveMtDataset(AdaptiveMtDatasetName name) *

  • getAdaptiveMtDataset(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.

*
    *
  • getAdaptiveMtDatasetCallable() *

*

ListAdaptiveMtDatasets

Lists all Adaptive MT datasets for which the caller has read permission.

*

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

*
    *
  • listAdaptiveMtDatasets(ListAdaptiveMtDatasetsRequest request) *

*

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

*
    *
  • listAdaptiveMtDatasets(LocationName parent) *

  • listAdaptiveMtDatasets(String parent) *

*

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

*
    *
  • listAdaptiveMtDatasetsPagedCallable() *

  • listAdaptiveMtDatasetsCallable() *

*

AdaptiveMtTranslate

Translate text using Adaptive MT.

*

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

*
    *
  • adaptiveMtTranslate(AdaptiveMtTranslateRequest request) *

*

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

*
    *
  • adaptiveMtTranslate(LocationName parent, List<String> content) *

  • adaptiveMtTranslate(String parent, List<String> content) *

*

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

*
    *
  • adaptiveMtTranslateCallable() *

*

GetAdaptiveMtFile

Gets and AdaptiveMtFile

*

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

*
    *
  • getAdaptiveMtFile(GetAdaptiveMtFileRequest request) *

*

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

*
    *
  • getAdaptiveMtFile(AdaptiveMtFileName name) *

  • getAdaptiveMtFile(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.

*
    *
  • getAdaptiveMtFileCallable() *

*

DeleteAdaptiveMtFile

Deletes an AdaptiveMtFile along with its sentences.

*

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

*
    *
  • deleteAdaptiveMtFile(DeleteAdaptiveMtFileRequest request) *

*

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

*
    *
  • deleteAdaptiveMtFile(AdaptiveMtFileName name) *

  • deleteAdaptiveMtFile(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.

*
    *
  • deleteAdaptiveMtFileCallable() *

*

ImportAdaptiveMtFile

Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.

*

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

*
    *
  • importAdaptiveMtFile(ImportAdaptiveMtFileRequest request) *

*

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

*
    *
  • importAdaptiveMtFile(AdaptiveMtDatasetName parent) *

  • importAdaptiveMtFile(String parent) *

*

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

*
    *
  • importAdaptiveMtFileCallable() *

*

ListAdaptiveMtFiles

Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.

*

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

*
    *
  • listAdaptiveMtFiles(ListAdaptiveMtFilesRequest request) *

*

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

*
    *
  • listAdaptiveMtFiles(AdaptiveMtDatasetName parent) *

  • listAdaptiveMtFiles(String parent) *

*

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

*
    *
  • listAdaptiveMtFilesPagedCallable() *

  • listAdaptiveMtFilesCallable() *

*

ListAdaptiveMtSentences

Lists all AdaptiveMtSentences under a given file/dataset.

*

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

*
    *
  • listAdaptiveMtSentences(ListAdaptiveMtSentencesRequest request) *

*

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

*
    *
  • listAdaptiveMtSentences(AdaptiveMtFileName parent) *

  • listAdaptiveMtSentences(String parent) *

*

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

*
    *
  • listAdaptiveMtSentencesPagedCallable() *

  • listAdaptiveMtSentencesCallable() *

*
* *

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. */ @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()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   String targetLanguageCode = "targetLanguageCode-106414698";
   *   List contents = new ArrayList<>();
   *   TranslateTextResponse response =
   *       translationServiceClient.translateText(parent, targetLanguageCode, contents);
   * }
   * }
* * @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 requests using AutoML models or custom glossaries. *

Models and glossaries must be within the same region (have same location-id), otherwise * an INVALID_ARGUMENT (400) error is returned. * @param targetLanguageCode Required. The ISO-639 language code to use for translation of the * input text, set to one of the language codes listed in Language Support. * @param contents Required. The content of the input in string format. We recommend the total * content be less than 30,000 codepoints. The max length of this field is 1024. Use * BatchTranslateText for larger text. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final TranslateTextResponse translateText( LocationName parent, String targetLanguageCode, List contents) { TranslateTextRequest request = TranslateTextRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setTargetLanguageCode(targetLanguageCode) .addAllContents(contents) .build(); return translateText(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()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   String targetLanguageCode = "targetLanguageCode-106414698";
   *   List contents = new ArrayList<>();
   *   TranslateTextResponse response =
   *       translationServiceClient.translateText(parent, targetLanguageCode, contents);
   * }
   * }
* * @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 requests using AutoML models or custom glossaries. *

Models and glossaries must be within the same region (have same location-id), otherwise * an INVALID_ARGUMENT (400) error is returned. * @param targetLanguageCode Required. The ISO-639 language code to use for translation of the * input text, set to one of the language codes listed in Language Support. * @param contents Required. The content of the input in string format. We recommend the total * content be less than 30,000 codepoints. The max length of this field is 1024. Use * BatchTranslateText for larger text. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final TranslateTextResponse translateText( String parent, String targetLanguageCode, List contents) { TranslateTextRequest request = TranslateTextRequest.newBuilder() .setParent(parent) .setTargetLanguageCode(targetLanguageCode) .addAllContents(contents) .build(); return translateText(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()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   String model = "model104069929";
   *   String mimeType = "mimeType-1392120434";
   *   String sourceLanguageCode = "sourceLanguageCode1645917472";
   *   String targetLanguageCode = "targetLanguageCode-106414698";
   *   List contents = new ArrayList<>();
   *   TranslateTextResponse response =
   *       translationServiceClient.translateText(
   *           parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);
   * }
   * }
* * @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 requests using AutoML models or custom glossaries. *

Models and glossaries must be within the same region (have same location-id), otherwise * an INVALID_ARGUMENT (400) error is returned. * @param model Optional. The `model` type requested for this translation. *

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`, *

For global (non-regionalized) requests, use `location-id` `global`. For example, * `projects/{project-number-or-id}/locations/global/models/general/nmt`. *

If not provided, the default Google model (NMT) will be 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". * @param sourceLanguageCode Optional. The ISO-639 language code of the input text if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If * the source language isn't specified, the API attempts to identify the source language * automatically and returns the source language within the response. * @param targetLanguageCode Required. The ISO-639 language code to use for translation of the * input text, set to one of the language codes listed in Language Support. * @param contents Required. The content of the input in string format. We recommend the total * content be less than 30,000 codepoints. The max length of this field is 1024. Use * BatchTranslateText for larger text. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final TranslateTextResponse translateText( LocationName parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List contents) { TranslateTextRequest request = TranslateTextRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setModel(model) .setMimeType(mimeType) .setSourceLanguageCode(sourceLanguageCode) .setTargetLanguageCode(targetLanguageCode) .addAllContents(contents) .build(); return translateText(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()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   String model = "model104069929";
   *   String mimeType = "mimeType-1392120434";
   *   String sourceLanguageCode = "sourceLanguageCode1645917472";
   *   String targetLanguageCode = "targetLanguageCode-106414698";
   *   List contents = new ArrayList<>();
   *   TranslateTextResponse response =
   *       translationServiceClient.translateText(
   *           parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);
   * }
   * }
* * @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 requests using AutoML models or custom glossaries. *

Models and glossaries must be within the same region (have same location-id), otherwise * an INVALID_ARGUMENT (400) error is returned. * @param model Optional. The `model` type requested for this translation. *

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`, *

For global (non-regionalized) requests, use `location-id` `global`. For example, * `projects/{project-number-or-id}/locations/global/models/general/nmt`. *

If not provided, the default Google model (NMT) will be 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". * @param sourceLanguageCode Optional. The ISO-639 language code of the input text if known, for * example, "en-US" or "sr-Latn". Supported language codes are listed in Language Support. If * the source language isn't specified, the API attempts to identify the source language * automatically and returns the source language within the response. * @param targetLanguageCode Required. The ISO-639 language code to use for translation of the * input text, set to one of the language codes listed in Language Support. * @param contents Required. The content of the input in string format. We recommend the total * content be less than 30,000 codepoints. The max length of this field is 1024. Use * BatchTranslateText for larger text. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final TranslateTextResponse translateText( String parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List contents) { TranslateTextRequest request = TranslateTextRequest.newBuilder() .setParent(parent) .setModel(model) .setMimeType(mimeType) .setSourceLanguageCode(sourceLanguageCode) .setTargetLanguageCode(targetLanguageCode) .addAllContents(contents) .build(); return translateText(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();
   *   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";
   *   String content = "content951530617";
   *   DetectLanguageResponse response =
   *       translationServiceClient.detectLanguage(parent, model, mimeType, content);
   * }
   * }
* * @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". * @param content The content of the input stored as a string. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final DetectLanguageResponse detectLanguage( LocationName parent, String model, String mimeType, String content) { DetectLanguageRequest request = DetectLanguageRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setModel(model) .setMimeType(mimeType) .setContent(content) .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";
   *   String content = "content951530617";
   *   DetectLanguageResponse response =
   *       translationServiceClient.detectLanguage(parent, model, mimeType, content);
   * }
   * }
* * @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". * @param content The content of the input stored as a string. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final DetectLanguageResponse detectLanguage( String parent, String model, String mimeType, String content) { DetectLanguageRequest request = DetectLanguageRequest.newBuilder() .setParent(parent) .setModel(model) .setMimeType(mimeType) .setContent(content) .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 model = "model104069929";
   *   String displayLanguageCode = "displayLanguageCode-1457478841";
   *   SupportedLanguages response =
   *       translationServiceClient.getSupportedLanguages(parent, model, displayLanguageCode);
   * }
   * }
* * @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 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. * @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. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SupportedLanguages getSupportedLanguages( LocationName parent, String model, String displayLanguageCode) { GetSupportedLanguagesRequest request = GetSupportedLanguagesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setModel(model) .setDisplayLanguageCode(displayLanguageCode) .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 model = "model104069929";
   *   String displayLanguageCode = "displayLanguageCode-1457478841";
   *   SupportedLanguages response =
   *       translationServiceClient.getSupportedLanguages(parent, model, displayLanguageCode);
   * }
   * }
* * @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 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. * @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. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SupportedLanguages getSupportedLanguages( String parent, String model, String displayLanguageCode) { GetSupportedLanguagesRequest request = GetSupportedLanguagesRequest.newBuilder() .setParent(parent) .setModel(model) .setDisplayLanguageCode(displayLanguageCode) .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 ISO-639 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 ISO-639 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 ISO-639 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 ISO-639 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]");
   *   for (Glossary element : translationServiceClient.listGlossaries(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The name of the project from which to list all of the glossaries. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListGlossariesPagedResponse listGlossaries(LocationName parent) { ListGlossariesRequest request = ListGlossariesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .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();
   *   for (Glossary element : translationServiceClient.listGlossaries(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The name of the project from which to list all of the glossaries. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListGlossariesPagedResponse listGlossaries(String parent) { ListGlossariesRequest request = ListGlossariesRequest.newBuilder().setParent(parent).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(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Adaptive MT dataset. * *

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]");
   *   AdaptiveMtDataset adaptiveMtDataset = AdaptiveMtDataset.newBuilder().build();
   *   AdaptiveMtDataset response =
   *       translationServiceClient.createAdaptiveMtDataset(parent, adaptiveMtDataset);
   * }
   * }
* * @param parent Required. Name of the parent project. In form of * `projects/{project-number-or-id}/locations/{location-id}` * @param adaptiveMtDataset Required. The AdaptiveMtDataset to be created. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AdaptiveMtDataset createAdaptiveMtDataset( LocationName parent, AdaptiveMtDataset adaptiveMtDataset) { CreateAdaptiveMtDatasetRequest request = CreateAdaptiveMtDatasetRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setAdaptiveMtDataset(adaptiveMtDataset) .build(); return createAdaptiveMtDataset(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Adaptive MT dataset. * *

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();
   *   AdaptiveMtDataset adaptiveMtDataset = AdaptiveMtDataset.newBuilder().build();
   *   AdaptiveMtDataset response =
   *       translationServiceClient.createAdaptiveMtDataset(parent, adaptiveMtDataset);
   * }
   * }
* * @param parent Required. Name of the parent project. In form of * `projects/{project-number-or-id}/locations/{location-id}` * @param adaptiveMtDataset Required. The AdaptiveMtDataset to be created. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AdaptiveMtDataset createAdaptiveMtDataset( String parent, AdaptiveMtDataset adaptiveMtDataset) { CreateAdaptiveMtDatasetRequest request = CreateAdaptiveMtDatasetRequest.newBuilder() .setParent(parent) .setAdaptiveMtDataset(adaptiveMtDataset) .build(); return createAdaptiveMtDataset(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Adaptive MT dataset. * *

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()) {
   *   CreateAdaptiveMtDatasetRequest request =
   *       CreateAdaptiveMtDatasetRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setAdaptiveMtDataset(AdaptiveMtDataset.newBuilder().build())
   *           .build();
   *   AdaptiveMtDataset response = translationServiceClient.createAdaptiveMtDataset(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 AdaptiveMtDataset createAdaptiveMtDataset(CreateAdaptiveMtDatasetRequest request) { return createAdaptiveMtDatasetCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an Adaptive MT dataset. * *

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()) {
   *   CreateAdaptiveMtDatasetRequest request =
   *       CreateAdaptiveMtDatasetRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setAdaptiveMtDataset(AdaptiveMtDataset.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.createAdaptiveMtDatasetCallable().futureCall(request);
   *   // Do something.
   *   AdaptiveMtDataset response = future.get();
   * }
   * }
*/ public final UnaryCallable createAdaptiveMtDatasetCallable() { return stub.createAdaptiveMtDatasetCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an Adaptive MT dataset, including all its entries and associated metadata. * *

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()) {
   *   AdaptiveMtDatasetName name = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
   *   translationServiceClient.deleteAdaptiveMtDataset(name);
   * }
   * }
* * @param name Required. Name of the dataset. In the form of * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteAdaptiveMtDataset(AdaptiveMtDatasetName name) { DeleteAdaptiveMtDatasetRequest request = DeleteAdaptiveMtDatasetRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); deleteAdaptiveMtDataset(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an Adaptive MT dataset, including all its entries and associated metadata. * *

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 = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
   *   translationServiceClient.deleteAdaptiveMtDataset(name);
   * }
   * }
* * @param name Required. Name of the dataset. In the form of * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteAdaptiveMtDataset(String name) { DeleteAdaptiveMtDatasetRequest request = DeleteAdaptiveMtDatasetRequest.newBuilder().setName(name).build(); deleteAdaptiveMtDataset(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an Adaptive MT dataset, including all its entries and associated metadata. * *

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()) {
   *   DeleteAdaptiveMtDatasetRequest request =
   *       DeleteAdaptiveMtDatasetRequest.newBuilder()
   *           .setName(AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .build();
   *   translationServiceClient.deleteAdaptiveMtDataset(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteAdaptiveMtDataset(DeleteAdaptiveMtDatasetRequest request) { deleteAdaptiveMtDatasetCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an Adaptive MT dataset, including all its entries and associated metadata. * *

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()) {
   *   DeleteAdaptiveMtDatasetRequest request =
   *       DeleteAdaptiveMtDatasetRequest.newBuilder()
   *           .setName(AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.deleteAdaptiveMtDatasetCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteAdaptiveMtDatasetCallable() { return stub.deleteAdaptiveMtDatasetCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the Adaptive MT dataset. * *

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()) {
   *   AdaptiveMtDatasetName name = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
   *   AdaptiveMtDataset response = translationServiceClient.getAdaptiveMtDataset(name);
   * }
   * }
* * @param name Required. Name of the dataset. In the form of * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AdaptiveMtDataset getAdaptiveMtDataset(AdaptiveMtDatasetName name) { GetAdaptiveMtDatasetRequest request = GetAdaptiveMtDatasetRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); return getAdaptiveMtDataset(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the Adaptive MT dataset. * *

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 = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
   *   AdaptiveMtDataset response = translationServiceClient.getAdaptiveMtDataset(name);
   * }
   * }
* * @param name Required. Name of the dataset. In the form of * `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AdaptiveMtDataset getAdaptiveMtDataset(String name) { GetAdaptiveMtDatasetRequest request = GetAdaptiveMtDatasetRequest.newBuilder().setName(name).build(); return getAdaptiveMtDataset(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the Adaptive MT dataset. * *

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()) {
   *   GetAdaptiveMtDatasetRequest request =
   *       GetAdaptiveMtDatasetRequest.newBuilder()
   *           .setName(AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .build();
   *   AdaptiveMtDataset response = translationServiceClient.getAdaptiveMtDataset(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 AdaptiveMtDataset getAdaptiveMtDataset(GetAdaptiveMtDatasetRequest request) { return getAdaptiveMtDatasetCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the Adaptive MT dataset. * *

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()) {
   *   GetAdaptiveMtDatasetRequest request =
   *       GetAdaptiveMtDatasetRequest.newBuilder()
   *           .setName(AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.getAdaptiveMtDatasetCallable().futureCall(request);
   *   // Do something.
   *   AdaptiveMtDataset response = future.get();
   * }
   * }
*/ public final UnaryCallable getAdaptiveMtDatasetCallable() { return stub.getAdaptiveMtDatasetCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all Adaptive MT datasets for which the caller has read permission. * *

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]");
   *   for (AdaptiveMtDataset element :
   *       translationServiceClient.listAdaptiveMtDatasets(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the project from which to list the Adaptive MT * datasets. `projects/{project-number-or-id}/locations/{location-id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListAdaptiveMtDatasetsPagedResponse listAdaptiveMtDatasets(LocationName parent) { ListAdaptiveMtDatasetsRequest request = ListAdaptiveMtDatasetsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listAdaptiveMtDatasets(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all Adaptive MT datasets for which the caller has read permission. * *

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();
   *   for (AdaptiveMtDataset element :
   *       translationServiceClient.listAdaptiveMtDatasets(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the project from which to list the Adaptive MT * datasets. `projects/{project-number-or-id}/locations/{location-id}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListAdaptiveMtDatasetsPagedResponse listAdaptiveMtDatasets(String parent) { ListAdaptiveMtDatasetsRequest request = ListAdaptiveMtDatasetsRequest.newBuilder().setParent(parent).build(); return listAdaptiveMtDatasets(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all Adaptive MT datasets for which the caller has read permission. * *

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()) {
   *   ListAdaptiveMtDatasetsRequest request =
   *       ListAdaptiveMtDatasetsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   for (AdaptiveMtDataset element :
   *       translationServiceClient.listAdaptiveMtDatasets(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 ListAdaptiveMtDatasetsPagedResponse listAdaptiveMtDatasets( ListAdaptiveMtDatasetsRequest request) { return listAdaptiveMtDatasetsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all Adaptive MT datasets for which the caller has read permission. * *

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()) {
   *   ListAdaptiveMtDatasetsRequest request =
   *       ListAdaptiveMtDatasetsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.listAdaptiveMtDatasetsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (AdaptiveMtDataset element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listAdaptiveMtDatasetsPagedCallable() { return stub.listAdaptiveMtDatasetsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all Adaptive MT datasets for which the caller has read permission. * *

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()) {
   *   ListAdaptiveMtDatasetsRequest request =
   *       ListAdaptiveMtDatasetsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .setFilter("filter-1274492040")
   *           .build();
   *   while (true) {
   *     ListAdaptiveMtDatasetsResponse response =
   *         translationServiceClient.listAdaptiveMtDatasetsCallable().call(request);
   *     for (AdaptiveMtDataset element : response.getAdaptiveMtDatasetsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listAdaptiveMtDatasetsCallable() { return stub.listAdaptiveMtDatasetsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translate text using Adaptive MT. * *

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]");
   *   List content = new ArrayList<>();
   *   AdaptiveMtTranslateResponse response =
   *       translationServiceClient.adaptiveMtTranslate(parent, content);
   * }
   * }
* * @param parent Required. Location to make a regional call. *

Format: `projects/{project-number-or-id}/locations/{location-id}`. * @param content Required. The content of the input in string format. For now only one sentence * per request is supported. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AdaptiveMtTranslateResponse adaptiveMtTranslate( LocationName parent, List content) { AdaptiveMtTranslateRequest request = AdaptiveMtTranslateRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .addAllContent(content) .build(); return adaptiveMtTranslate(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translate text using Adaptive MT. * *

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();
   *   List content = new ArrayList<>();
   *   AdaptiveMtTranslateResponse response =
   *       translationServiceClient.adaptiveMtTranslate(parent, content);
   * }
   * }
* * @param parent Required. Location to make a regional call. *

Format: `projects/{project-number-or-id}/locations/{location-id}`. * @param content Required. The content of the input in string format. For now only one sentence * per request is supported. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AdaptiveMtTranslateResponse adaptiveMtTranslate( String parent, List content) { AdaptiveMtTranslateRequest request = AdaptiveMtTranslateRequest.newBuilder().setParent(parent).addAllContent(content).build(); return adaptiveMtTranslate(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translate text using Adaptive MT. * *

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()) {
   *   AdaptiveMtTranslateRequest request =
   *       AdaptiveMtTranslateRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setDataset(
   *               AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .addAllContent(new ArrayList())
   *           .build();
   *   AdaptiveMtTranslateResponse response = translationServiceClient.adaptiveMtTranslate(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 AdaptiveMtTranslateResponse adaptiveMtTranslate(AdaptiveMtTranslateRequest request) { return adaptiveMtTranslateCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Translate text using Adaptive MT. * *

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()) {
   *   AdaptiveMtTranslateRequest request =
   *       AdaptiveMtTranslateRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setDataset(
   *               AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .addAllContent(new ArrayList())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.adaptiveMtTranslateCallable().futureCall(request);
   *   // Do something.
   *   AdaptiveMtTranslateResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable adaptiveMtTranslateCallable() { return stub.adaptiveMtTranslateCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets and AdaptiveMtFile * *

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()) {
   *   AdaptiveMtFileName name =
   *       AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]");
   *   AdaptiveMtFile response = translationServiceClient.getAdaptiveMtFile(name);
   * }
   * }
* * @param name Required. The resource name of the file, in form of * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AdaptiveMtFile getAdaptiveMtFile(AdaptiveMtFileName name) { GetAdaptiveMtFileRequest request = GetAdaptiveMtFileRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); return getAdaptiveMtFile(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets and AdaptiveMtFile * *

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 =
   *       AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]").toString();
   *   AdaptiveMtFile response = translationServiceClient.getAdaptiveMtFile(name);
   * }
   * }
* * @param name Required. The resource name of the file, in form of * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final AdaptiveMtFile getAdaptiveMtFile(String name) { GetAdaptiveMtFileRequest request = GetAdaptiveMtFileRequest.newBuilder().setName(name).build(); return getAdaptiveMtFile(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets and AdaptiveMtFile * *

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()) {
   *   GetAdaptiveMtFileRequest request =
   *       GetAdaptiveMtFileRequest.newBuilder()
   *           .setName(
   *               AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
   *                   .toString())
   *           .build();
   *   AdaptiveMtFile response = translationServiceClient.getAdaptiveMtFile(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 AdaptiveMtFile getAdaptiveMtFile(GetAdaptiveMtFileRequest request) { return getAdaptiveMtFileCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets and AdaptiveMtFile * *

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()) {
   *   GetAdaptiveMtFileRequest request =
   *       GetAdaptiveMtFileRequest.newBuilder()
   *           .setName(
   *               AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
   *                   .toString())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.getAdaptiveMtFileCallable().futureCall(request);
   *   // Do something.
   *   AdaptiveMtFile response = future.get();
   * }
   * }
*/ public final UnaryCallable getAdaptiveMtFileCallable() { return stub.getAdaptiveMtFileCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an AdaptiveMtFile along with its sentences. * *

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()) {
   *   AdaptiveMtFileName name =
   *       AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]");
   *   translationServiceClient.deleteAdaptiveMtFile(name);
   * }
   * }
* * @param name Required. The resource name of the file to delete, in form of * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteAdaptiveMtFile(AdaptiveMtFileName name) { DeleteAdaptiveMtFileRequest request = DeleteAdaptiveMtFileRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); deleteAdaptiveMtFile(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an AdaptiveMtFile along with its sentences. * *

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 =
   *       AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]").toString();
   *   translationServiceClient.deleteAdaptiveMtFile(name);
   * }
   * }
* * @param name Required. The resource name of the file to delete, in form of * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteAdaptiveMtFile(String name) { DeleteAdaptiveMtFileRequest request = DeleteAdaptiveMtFileRequest.newBuilder().setName(name).build(); deleteAdaptiveMtFile(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an AdaptiveMtFile along with its sentences. * *

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()) {
   *   DeleteAdaptiveMtFileRequest request =
   *       DeleteAdaptiveMtFileRequest.newBuilder()
   *           .setName(
   *               AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
   *                   .toString())
   *           .build();
   *   translationServiceClient.deleteAdaptiveMtFile(request);
   * }
   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteAdaptiveMtFile(DeleteAdaptiveMtFileRequest request) { deleteAdaptiveMtFileCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an AdaptiveMtFile along with its sentences. * *

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()) {
   *   DeleteAdaptiveMtFileRequest request =
   *       DeleteAdaptiveMtFileRequest.newBuilder()
   *           .setName(
   *               AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
   *                   .toString())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.deleteAdaptiveMtFileCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteAdaptiveMtFileCallable() { return stub.deleteAdaptiveMtFileCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset. * *

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()) {
   *   AdaptiveMtDatasetName parent =
   *       AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
   *   ImportAdaptiveMtFileResponse response = translationServiceClient.importAdaptiveMtFile(parent);
   * }
   * }
* * @param parent Required. The resource name of the file, in form of * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ImportAdaptiveMtFileResponse importAdaptiveMtFile(AdaptiveMtDatasetName parent) { ImportAdaptiveMtFileRequest request = ImportAdaptiveMtFileRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return importAdaptiveMtFile(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset. * *

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 = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
   *   ImportAdaptiveMtFileResponse response = translationServiceClient.importAdaptiveMtFile(parent);
   * }
   * }
* * @param parent Required. The resource name of the file, in form of * `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ImportAdaptiveMtFileResponse importAdaptiveMtFile(String parent) { ImportAdaptiveMtFileRequest request = ImportAdaptiveMtFileRequest.newBuilder().setParent(parent).build(); return importAdaptiveMtFile(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset. * *

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()) {
   *   ImportAdaptiveMtFileRequest request =
   *       ImportAdaptiveMtFileRequest.newBuilder()
   *           .setParent(
   *               AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .build();
   *   ImportAdaptiveMtFileResponse response =
   *       translationServiceClient.importAdaptiveMtFile(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 ImportAdaptiveMtFileResponse importAdaptiveMtFile( ImportAdaptiveMtFileRequest request) { return importAdaptiveMtFileCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset. * *

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()) {
   *   ImportAdaptiveMtFileRequest request =
   *       ImportAdaptiveMtFileRequest.newBuilder()
   *           .setParent(
   *               AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.importAdaptiveMtFileCallable().futureCall(request);
   *   // Do something.
   *   ImportAdaptiveMtFileResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable importAdaptiveMtFileCallable() { return stub.importAdaptiveMtFileCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. * *

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()) {
   *   AdaptiveMtDatasetName parent =
   *       AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
   *   for (AdaptiveMtFile element :
   *       translationServiceClient.listAdaptiveMtFiles(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the project from which to list the Adaptive MT * files. `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListAdaptiveMtFilesPagedResponse listAdaptiveMtFiles(AdaptiveMtDatasetName parent) { ListAdaptiveMtFilesRequest request = ListAdaptiveMtFilesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listAdaptiveMtFiles(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. * *

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 = AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
   *   for (AdaptiveMtFile element :
   *       translationServiceClient.listAdaptiveMtFiles(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the project from which to list the Adaptive MT * files. `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListAdaptiveMtFilesPagedResponse listAdaptiveMtFiles(String parent) { ListAdaptiveMtFilesRequest request = ListAdaptiveMtFilesRequest.newBuilder().setParent(parent).build(); return listAdaptiveMtFiles(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. * *

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()) {
   *   ListAdaptiveMtFilesRequest request =
   *       ListAdaptiveMtFilesRequest.newBuilder()
   *           .setParent(
   *               AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (AdaptiveMtFile element :
   *       translationServiceClient.listAdaptiveMtFiles(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 ListAdaptiveMtFilesPagedResponse listAdaptiveMtFiles( ListAdaptiveMtFilesRequest request) { return listAdaptiveMtFilesPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. * *

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()) {
   *   ListAdaptiveMtFilesRequest request =
   *       ListAdaptiveMtFilesRequest.newBuilder()
   *           .setParent(
   *               AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.listAdaptiveMtFilesPagedCallable().futureCall(request);
   *   // Do something.
   *   for (AdaptiveMtFile element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listAdaptiveMtFilesPagedCallable() { return stub.listAdaptiveMtFilesPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset. * *

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()) {
   *   ListAdaptiveMtFilesRequest request =
   *       ListAdaptiveMtFilesRequest.newBuilder()
   *           .setParent(
   *               AdaptiveMtDatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListAdaptiveMtFilesResponse response =
   *         translationServiceClient.listAdaptiveMtFilesCallable().call(request);
   *     for (AdaptiveMtFile element : response.getAdaptiveMtFilesList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listAdaptiveMtFilesCallable() { return stub.listAdaptiveMtFilesCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtSentences under a given file/dataset. * *

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()) {
   *   AdaptiveMtFileName parent =
   *       AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]");
   *   for (AdaptiveMtSentence element :
   *       translationServiceClient.listAdaptiveMtSentences(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the project from which to list the Adaptive MT * files. The following format lists all sentences under a file. * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` * The following format lists all sentences within a dataset. * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListAdaptiveMtSentencesPagedResponse listAdaptiveMtSentences( AdaptiveMtFileName parent) { ListAdaptiveMtSentencesRequest request = ListAdaptiveMtSentencesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listAdaptiveMtSentences(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtSentences under a given file/dataset. * *

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 =
   *       AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]").toString();
   *   for (AdaptiveMtSentence element :
   *       translationServiceClient.listAdaptiveMtSentences(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the project from which to list the Adaptive MT * files. The following format lists all sentences under a file. * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}` * The following format lists all sentences within a dataset. * `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListAdaptiveMtSentencesPagedResponse listAdaptiveMtSentences(String parent) { ListAdaptiveMtSentencesRequest request = ListAdaptiveMtSentencesRequest.newBuilder().setParent(parent).build(); return listAdaptiveMtSentences(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtSentences under a given file/dataset. * *

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()) {
   *   ListAdaptiveMtSentencesRequest request =
   *       ListAdaptiveMtSentencesRequest.newBuilder()
   *           .setParent(
   *               AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
   *                   .toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (AdaptiveMtSentence element :
   *       translationServiceClient.listAdaptiveMtSentences(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 ListAdaptiveMtSentencesPagedResponse listAdaptiveMtSentences( ListAdaptiveMtSentencesRequest request) { return listAdaptiveMtSentencesPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtSentences under a given file/dataset. * *

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()) {
   *   ListAdaptiveMtSentencesRequest request =
   *       ListAdaptiveMtSentencesRequest.newBuilder()
   *           .setParent(
   *               AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
   *                   .toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       translationServiceClient.listAdaptiveMtSentencesPagedCallable().futureCall(request);
   *   // Do something.
   *   for (AdaptiveMtSentence element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listAdaptiveMtSentencesPagedCallable() { return stub.listAdaptiveMtSentencesPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all AdaptiveMtSentences under a given file/dataset. * *

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()) {
   *   ListAdaptiveMtSentencesRequest request =
   *       ListAdaptiveMtSentencesRequest.newBuilder()
   *           .setParent(
   *               AdaptiveMtFileName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[FILE]")
   *                   .toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListAdaptiveMtSentencesResponse response =
   *         translationServiceClient.listAdaptiveMtSentencesCallable().call(request);
   *     for (AdaptiveMtSentence element : response.getAdaptiveMtSentencesList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listAdaptiveMtSentencesCallable() { return stub.listAdaptiveMtSentencesCallable(); } @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); } } public static class ListAdaptiveMtDatasetsPagedResponse extends AbstractPagedListResponse< ListAdaptiveMtDatasetsRequest, ListAdaptiveMtDatasetsResponse, AdaptiveMtDataset, ListAdaptiveMtDatasetsPage, ListAdaptiveMtDatasetsFixedSizeCollection> { public static ApiFuture createAsync( PageContext< ListAdaptiveMtDatasetsRequest, ListAdaptiveMtDatasetsResponse, AdaptiveMtDataset> context, ApiFuture futureResponse) { ApiFuture futurePage = ListAdaptiveMtDatasetsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListAdaptiveMtDatasetsPagedResponse(input), MoreExecutors.directExecutor()); } private ListAdaptiveMtDatasetsPagedResponse(ListAdaptiveMtDatasetsPage page) { super(page, ListAdaptiveMtDatasetsFixedSizeCollection.createEmptyCollection()); } } public static class ListAdaptiveMtDatasetsPage extends AbstractPage< ListAdaptiveMtDatasetsRequest, ListAdaptiveMtDatasetsResponse, AdaptiveMtDataset, ListAdaptiveMtDatasetsPage> { private ListAdaptiveMtDatasetsPage( PageContext< ListAdaptiveMtDatasetsRequest, ListAdaptiveMtDatasetsResponse, AdaptiveMtDataset> context, ListAdaptiveMtDatasetsResponse response) { super(context, response); } private static ListAdaptiveMtDatasetsPage createEmptyPage() { return new ListAdaptiveMtDatasetsPage(null, null); } @Override protected ListAdaptiveMtDatasetsPage createPage( PageContext< ListAdaptiveMtDatasetsRequest, ListAdaptiveMtDatasetsResponse, AdaptiveMtDataset> context, ListAdaptiveMtDatasetsResponse response) { return new ListAdaptiveMtDatasetsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext< ListAdaptiveMtDatasetsRequest, ListAdaptiveMtDatasetsResponse, AdaptiveMtDataset> context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListAdaptiveMtDatasetsFixedSizeCollection extends AbstractFixedSizeCollection< ListAdaptiveMtDatasetsRequest, ListAdaptiveMtDatasetsResponse, AdaptiveMtDataset, ListAdaptiveMtDatasetsPage, ListAdaptiveMtDatasetsFixedSizeCollection> { private ListAdaptiveMtDatasetsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListAdaptiveMtDatasetsFixedSizeCollection createEmptyCollection() { return new ListAdaptiveMtDatasetsFixedSizeCollection(null, 0); } @Override protected ListAdaptiveMtDatasetsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListAdaptiveMtDatasetsFixedSizeCollection(pages, collectionSize); } } public static class ListAdaptiveMtFilesPagedResponse extends AbstractPagedListResponse< ListAdaptiveMtFilesRequest, ListAdaptiveMtFilesResponse, AdaptiveMtFile, ListAdaptiveMtFilesPage, ListAdaptiveMtFilesFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListAdaptiveMtFilesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListAdaptiveMtFilesPagedResponse(input), MoreExecutors.directExecutor()); } private ListAdaptiveMtFilesPagedResponse(ListAdaptiveMtFilesPage page) { super(page, ListAdaptiveMtFilesFixedSizeCollection.createEmptyCollection()); } } public static class ListAdaptiveMtFilesPage extends AbstractPage< ListAdaptiveMtFilesRequest, ListAdaptiveMtFilesResponse, AdaptiveMtFile, ListAdaptiveMtFilesPage> { private ListAdaptiveMtFilesPage( PageContext context, ListAdaptiveMtFilesResponse response) { super(context, response); } private static ListAdaptiveMtFilesPage createEmptyPage() { return new ListAdaptiveMtFilesPage(null, null); } @Override protected ListAdaptiveMtFilesPage createPage( PageContext context, ListAdaptiveMtFilesResponse response) { return new ListAdaptiveMtFilesPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListAdaptiveMtFilesFixedSizeCollection extends AbstractFixedSizeCollection< ListAdaptiveMtFilesRequest, ListAdaptiveMtFilesResponse, AdaptiveMtFile, ListAdaptiveMtFilesPage, ListAdaptiveMtFilesFixedSizeCollection> { private ListAdaptiveMtFilesFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListAdaptiveMtFilesFixedSizeCollection createEmptyCollection() { return new ListAdaptiveMtFilesFixedSizeCollection(null, 0); } @Override protected ListAdaptiveMtFilesFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListAdaptiveMtFilesFixedSizeCollection(pages, collectionSize); } } public static class ListAdaptiveMtSentencesPagedResponse extends AbstractPagedListResponse< ListAdaptiveMtSentencesRequest, ListAdaptiveMtSentencesResponse, AdaptiveMtSentence, ListAdaptiveMtSentencesPage, ListAdaptiveMtSentencesFixedSizeCollection> { public static ApiFuture createAsync( PageContext< ListAdaptiveMtSentencesRequest, ListAdaptiveMtSentencesResponse, AdaptiveMtSentence> context, ApiFuture futureResponse) { ApiFuture futurePage = ListAdaptiveMtSentencesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListAdaptiveMtSentencesPagedResponse(input), MoreExecutors.directExecutor()); } private ListAdaptiveMtSentencesPagedResponse(ListAdaptiveMtSentencesPage page) { super(page, ListAdaptiveMtSentencesFixedSizeCollection.createEmptyCollection()); } } public static class ListAdaptiveMtSentencesPage extends AbstractPage< ListAdaptiveMtSentencesRequest, ListAdaptiveMtSentencesResponse, AdaptiveMtSentence, ListAdaptiveMtSentencesPage> { private ListAdaptiveMtSentencesPage( PageContext< ListAdaptiveMtSentencesRequest, ListAdaptiveMtSentencesResponse, AdaptiveMtSentence> context, ListAdaptiveMtSentencesResponse response) { super(context, response); } private static ListAdaptiveMtSentencesPage createEmptyPage() { return new ListAdaptiveMtSentencesPage(null, null); } @Override protected ListAdaptiveMtSentencesPage createPage( PageContext< ListAdaptiveMtSentencesRequest, ListAdaptiveMtSentencesResponse, AdaptiveMtSentence> context, ListAdaptiveMtSentencesResponse response) { return new ListAdaptiveMtSentencesPage(context, response); } @Override public ApiFuture createPageAsync( PageContext< ListAdaptiveMtSentencesRequest, ListAdaptiveMtSentencesResponse, AdaptiveMtSentence> context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListAdaptiveMtSentencesFixedSizeCollection extends AbstractFixedSizeCollection< ListAdaptiveMtSentencesRequest, ListAdaptiveMtSentencesResponse, AdaptiveMtSentence, ListAdaptiveMtSentencesPage, ListAdaptiveMtSentencesFixedSizeCollection> { private ListAdaptiveMtSentencesFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListAdaptiveMtSentencesFixedSizeCollection createEmptyCollection() { return new ListAdaptiveMtSentencesFixedSizeCollection(null, 0); } @Override protected ListAdaptiveMtSentencesFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListAdaptiveMtSentencesFixedSizeCollection(pages, collectionSize); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy