com.google.cloud.translate.v3.TranslationServiceClient Maven / Gradle / Ivy
Show all versions of google-cloud-translate Show documentation
/*
* 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 com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: 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
*
* Method
* Description
* Method 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()
*
*
*
*
* RomanizeText
* Romanize input text written in non-Latin scripts to Latin text.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* romanizeText(RomanizeTextRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* romanizeText(LocationName parent, List<String> contents)
*
romanizeText(String parent, 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.
*
* romanizeTextCallable()
*
*
*
*
* 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()
*
*
*
*
* UpdateGlossary
* Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is updated.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* updateGlossaryAsync(UpdateGlossaryRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* updateGlossaryAsync(Glossary glossary, FieldMask updateMask)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* updateGlossaryOperationCallable()
*
updateGlossaryCallable()
*
*
*
*
* 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()
*
*
*
*
* GetGlossaryEntry
* Gets a single glossary entry by the given id.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getGlossaryEntry(GetGlossaryEntryRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getGlossaryEntry(GlossaryEntryName name)
*
getGlossaryEntry(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.
*
* getGlossaryEntryCallable()
*
*
*
*
* ListGlossaryEntries
* List the entries for the glossary.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listGlossaryEntries(ListGlossaryEntriesRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listGlossaryEntries(GlossaryName parent)
*
listGlossaryEntries(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.
*
* listGlossaryEntriesPagedCallable()
*
listGlossaryEntriesCallable()
*
*
*
*
* CreateGlossaryEntry
* Creates a glossary entry.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* createGlossaryEntry(CreateGlossaryEntryRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* createGlossaryEntry(GlossaryName parent, GlossaryEntry glossaryEntry)
*
createGlossaryEntry(String parent, GlossaryEntry glossaryEntry)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createGlossaryEntryCallable()
*
*
*
*
* UpdateGlossaryEntry
* Updates a glossary entry.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* updateGlossaryEntry(UpdateGlossaryEntryRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* updateGlossaryEntry(GlossaryEntry glossaryEntry)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* updateGlossaryEntryCallable()
*
*
*
*
* DeleteGlossaryEntry
* Deletes a single entry from the glossary
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deleteGlossaryEntry(DeleteGlossaryEntryRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* deleteGlossaryEntry(GlossaryEntryName name)
*
deleteGlossaryEntry(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.
*
* deleteGlossaryEntryCallable()
*
*
*
*
* CreateDataset
* Creates a Dataset.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* createDatasetAsync(CreateDatasetRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* createDatasetAsync(LocationName parent, Dataset dataset)
*
createDatasetAsync(String parent, Dataset dataset)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createDatasetOperationCallable()
*
createDatasetCallable()
*
*
*
*
* GetDataset
* Gets a Dataset.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getDataset(GetDatasetRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getDataset(DatasetName name)
*
getDataset(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.
*
* getDatasetCallable()
*
*
*
*
* ListDatasets
* Lists datasets.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listDatasets(ListDatasetsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listDatasets(LocationName parent)
*
listDatasets(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.
*
* listDatasetsPagedCallable()
*
listDatasetsCallable()
*
*
*
*
* DeleteDataset
* Deletes a dataset and all of its contents.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deleteDatasetAsync(DeleteDatasetRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* deleteDatasetAsync(DatasetName name)
*
deleteDatasetAsync(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.
*
* deleteDatasetOperationCallable()
*
deleteDatasetCallable()
*
*
*
*
* 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()
*
*
*
*
* ImportData
* Import sentence pairs into translation Dataset.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* importDataAsync(ImportDataRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* importDataAsync(String dataset, DatasetInputConfig inputConfig)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* importDataOperationCallable()
*
importDataCallable()
*
*
*
*
* ExportData
* Exports dataset's data to the provided output location.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* exportDataAsync(ExportDataRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* exportDataAsync(String dataset, DatasetOutputConfig outputConfig)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* exportDataOperationCallable()
*
exportDataCallable()
*
*
*
*
* ListExamples
* Lists sentence pairs in the dataset.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listExamples(ListExamplesRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listExamples(DatasetName parent)
*
listExamples(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.
*
* listExamplesPagedCallable()
*
listExamplesCallable()
*
*
*
*
* CreateModel
* Creates a Model.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* createModelAsync(CreateModelRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* createModelAsync(LocationName parent, Model model)
*
createModelAsync(String parent, Model model)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createModelOperationCallable()
*
createModelCallable()
*
*
*
*
* ListModels
* Lists models.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listModels(ListModelsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listModels(LocationName parent)
*
listModels(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.
*
* listModelsPagedCallable()
*
listModelsCallable()
*
*
*
*
* GetModel
* Gets a model.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getModel(GetModelRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getModel(ModelName name)
*
getModel(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.
*
* getModelCallable()
*
*
*
*
* DeleteModel
* Deletes a model.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deleteModelAsync(DeleteModelRequest request)
*
* Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
*
* deleteModelAsync(ModelName name)
*
deleteModelAsync(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.
*
* deleteModelOperationCallable()
*
deleteModelCallable()
*
*
*
*
*
* 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`,
*
- Translation LLM models:
* `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`,
*
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`,
*
- Translation LLM models:
* `projects/{project-number-or-id}/locations/{location-id}/models/general/translation-llm`,
*
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())
* .setTransliterationConfig(TransliterationConfig.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())
* .setTransliterationConfig(TransliterationConfig.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.
/**
* Romanize input text written in non-Latin scripts to Latin 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]");
* List contents = new ArrayList<>();
* RomanizeTextResponse response = translationServiceClient.romanizeText(parent, contents);
* }
* }
*
* @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}`.
* @param contents Required. The content of the input in string format.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final RomanizeTextResponse romanizeText(LocationName parent, List contents) {
RomanizeTextRequest request =
RomanizeTextRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.addAllContents(contents)
.build();
return romanizeText(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Romanize input text written in non-Latin scripts to Latin 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();
* List contents = new ArrayList<>();
* RomanizeTextResponse response = translationServiceClient.romanizeText(parent, contents);
* }
* }
*
* @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}`.
* @param contents Required. The content of the input in string format.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final RomanizeTextResponse romanizeText(String parent, List contents) {
RomanizeTextRequest request =
RomanizeTextRequest.newBuilder().setParent(parent).addAllContents(contents).build();
return romanizeText(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Romanize input text written in non-Latin scripts to Latin 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()) {
* RomanizeTextRequest request =
* RomanizeTextRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .addAllContents(new ArrayList())
* .setSourceLanguageCode("sourceLanguageCode1645917472")
* .build();
* RomanizeTextResponse response = translationServiceClient.romanizeText(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 RomanizeTextResponse romanizeText(RomanizeTextRequest request) {
return romanizeTextCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Romanize input text written in non-Latin scripts to Latin 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()) {
* RomanizeTextRequest request =
* RomanizeTextRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .addAllContents(new ArrayList())
* .setSourceLanguageCode("sourceLanguageCode1645917472")
* .build();
* ApiFuture future =
* translationServiceClient.romanizeTextCallable().futureCall(request);
* // Do something.
* RomanizeTextResponse response = future.get();
* }
* }
*/
public final UnaryCallable romanizeTextCallable() {
return stub.romanizeTextCallable();
}
// 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.
/**
* Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is
* updated.
*
* 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()) {
* Glossary glossary = Glossary.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* Glossary response = translationServiceClient.updateGlossaryAsync(glossary, updateMask).get();
* }
* }
*
* @param glossary Required. The glossary entry to update.
* @param updateMask The list of fields to be updated. Currently only `display_name` and
* 'input_config'
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture updateGlossaryAsync(
Glossary glossary, FieldMask updateMask) {
UpdateGlossaryRequest request =
UpdateGlossaryRequest.newBuilder().setGlossary(glossary).setUpdateMask(updateMask).build();
return updateGlossaryAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is
* updated.
*
* 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()) {
* UpdateGlossaryRequest request =
* UpdateGlossaryRequest.newBuilder()
* .setGlossary(Glossary.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* Glossary response = translationServiceClient.updateGlossaryAsync(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 updateGlossaryAsync(
UpdateGlossaryRequest request) {
return updateGlossaryOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is
* updated.
*
* 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()) {
* UpdateGlossaryRequest request =
* UpdateGlossaryRequest.newBuilder()
* .setGlossary(Glossary.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* OperationFuture future =
* translationServiceClient.updateGlossaryOperationCallable().futureCall(request);
* // Do something.
* Glossary response = future.get();
* }
* }
*/
public final OperationCallable
updateGlossaryOperationCallable() {
return stub.updateGlossaryOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates a glossary. A LRO is used since the update can be async if the glossary's entry file is
* updated.
*
* 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()) {
* UpdateGlossaryRequest request =
* UpdateGlossaryRequest.newBuilder()
* .setGlossary(Glossary.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture future =
* translationServiceClient.updateGlossaryCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable updateGlossaryCallable() {
return stub.updateGlossaryCallable();
}
// 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.
/**
* Gets a single glossary entry by the given id.
*
* 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()) {
* GlossaryEntryName name =
* GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]");
* GlossaryEntry response = translationServiceClient.getGlossaryEntry(name);
* }
* }
*
* @param name Required. The resource name of the glossary entry to get
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GlossaryEntry getGlossaryEntry(GlossaryEntryName name) {
GetGlossaryEntryRequest request =
GetGlossaryEntryRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getGlossaryEntry(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a single glossary entry by the given id.
*
* 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 =
* GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
* .toString();
* GlossaryEntry response = translationServiceClient.getGlossaryEntry(name);
* }
* }
*
* @param name Required. The resource name of the glossary entry to get
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GlossaryEntry getGlossaryEntry(String name) {
GetGlossaryEntryRequest request = GetGlossaryEntryRequest.newBuilder().setName(name).build();
return getGlossaryEntry(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a single glossary entry by the given id.
*
* 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()) {
* GetGlossaryEntryRequest request =
* GetGlossaryEntryRequest.newBuilder()
* .setName(
* GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
* .toString())
* .build();
* GlossaryEntry response = translationServiceClient.getGlossaryEntry(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 GlossaryEntry getGlossaryEntry(GetGlossaryEntryRequest request) {
return getGlossaryEntryCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a single glossary entry by the given id.
*
* 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()) {
* GetGlossaryEntryRequest request =
* GetGlossaryEntryRequest.newBuilder()
* .setName(
* GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
* .toString())
* .build();
* ApiFuture future =
* translationServiceClient.getGlossaryEntryCallable().futureCall(request);
* // Do something.
* GlossaryEntry response = future.get();
* }
* }
*/
public final UnaryCallable getGlossaryEntryCallable() {
return stub.getGlossaryEntryCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* List the entries for the glossary.
*
* 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 parent = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
* for (GlossaryEntry element :
* translationServiceClient.listGlossaryEntries(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The parent glossary resource name for listing the glossary's entries.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListGlossaryEntriesPagedResponse listGlossaryEntries(GlossaryName parent) {
ListGlossaryEntriesRequest request =
ListGlossaryEntriesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listGlossaryEntries(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* List the entries for the glossary.
*
* 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 = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString();
* for (GlossaryEntry element :
* translationServiceClient.listGlossaryEntries(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The parent glossary resource name for listing the glossary's entries.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListGlossaryEntriesPagedResponse listGlossaryEntries(String parent) {
ListGlossaryEntriesRequest request =
ListGlossaryEntriesRequest.newBuilder().setParent(parent).build();
return listGlossaryEntries(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* List the entries for the glossary.
*
* 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()) {
* ListGlossaryEntriesRequest request =
* ListGlossaryEntriesRequest.newBuilder()
* .setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (GlossaryEntry element :
* translationServiceClient.listGlossaryEntries(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 ListGlossaryEntriesPagedResponse listGlossaryEntries(
ListGlossaryEntriesRequest request) {
return listGlossaryEntriesPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* List the entries for the glossary.
*
* 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()) {
* ListGlossaryEntriesRequest request =
* ListGlossaryEntriesRequest.newBuilder()
* .setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future =
* translationServiceClient.listGlossaryEntriesPagedCallable().futureCall(request);
* // Do something.
* for (GlossaryEntry element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listGlossaryEntriesPagedCallable() {
return stub.listGlossaryEntriesPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* List the entries for the glossary.
*
* 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()) {
* ListGlossaryEntriesRequest request =
* ListGlossaryEntriesRequest.newBuilder()
* .setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListGlossaryEntriesResponse response =
* translationServiceClient.listGlossaryEntriesCallable().call(request);
* for (GlossaryEntry element : response.getGlossaryEntriesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable
listGlossaryEntriesCallable() {
return stub.listGlossaryEntriesCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a glossary entry.
*
* 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 parent = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]");
* GlossaryEntry glossaryEntry = GlossaryEntry.newBuilder().build();
* GlossaryEntry response = translationServiceClient.createGlossaryEntry(parent, glossaryEntry);
* }
* }
*
* @param parent Required. The resource name of the glossary to create the entry under.
* @param glossaryEntry Required. The glossary entry to create
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GlossaryEntry createGlossaryEntry(GlossaryName parent, GlossaryEntry glossaryEntry) {
CreateGlossaryEntryRequest request =
CreateGlossaryEntryRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setGlossaryEntry(glossaryEntry)
.build();
return createGlossaryEntry(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a glossary entry.
*
* 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 = GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString();
* GlossaryEntry glossaryEntry = GlossaryEntry.newBuilder().build();
* GlossaryEntry response = translationServiceClient.createGlossaryEntry(parent, glossaryEntry);
* }
* }
*
* @param parent Required. The resource name of the glossary to create the entry under.
* @param glossaryEntry Required. The glossary entry to create
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GlossaryEntry createGlossaryEntry(String parent, GlossaryEntry glossaryEntry) {
CreateGlossaryEntryRequest request =
CreateGlossaryEntryRequest.newBuilder()
.setParent(parent)
.setGlossaryEntry(glossaryEntry)
.build();
return createGlossaryEntry(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a glossary entry.
*
* 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()) {
* CreateGlossaryEntryRequest request =
* CreateGlossaryEntryRequest.newBuilder()
* .setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
* .setGlossaryEntry(GlossaryEntry.newBuilder().build())
* .build();
* GlossaryEntry response = translationServiceClient.createGlossaryEntry(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 GlossaryEntry createGlossaryEntry(CreateGlossaryEntryRequest request) {
return createGlossaryEntryCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a glossary entry.
*
* 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()) {
* CreateGlossaryEntryRequest request =
* CreateGlossaryEntryRequest.newBuilder()
* .setParent(GlossaryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]").toString())
* .setGlossaryEntry(GlossaryEntry.newBuilder().build())
* .build();
* ApiFuture future =
* translationServiceClient.createGlossaryEntryCallable().futureCall(request);
* // Do something.
* GlossaryEntry response = future.get();
* }
* }
*/
public final UnaryCallable
createGlossaryEntryCallable() {
return stub.createGlossaryEntryCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates a glossary entry.
*
* 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()) {
* GlossaryEntry glossaryEntry = GlossaryEntry.newBuilder().build();
* GlossaryEntry response = translationServiceClient.updateGlossaryEntry(glossaryEntry);
* }
* }
*
* @param glossaryEntry Required. The glossary entry to update.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final GlossaryEntry updateGlossaryEntry(GlossaryEntry glossaryEntry) {
UpdateGlossaryEntryRequest request =
UpdateGlossaryEntryRequest.newBuilder().setGlossaryEntry(glossaryEntry).build();
return updateGlossaryEntry(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates a glossary entry.
*
* 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()) {
* UpdateGlossaryEntryRequest request =
* UpdateGlossaryEntryRequest.newBuilder()
* .setGlossaryEntry(GlossaryEntry.newBuilder().build())
* .build();
* GlossaryEntry response = translationServiceClient.updateGlossaryEntry(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 GlossaryEntry updateGlossaryEntry(UpdateGlossaryEntryRequest request) {
return updateGlossaryEntryCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates a glossary entry.
*
* 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()) {
* UpdateGlossaryEntryRequest request =
* UpdateGlossaryEntryRequest.newBuilder()
* .setGlossaryEntry(GlossaryEntry.newBuilder().build())
* .build();
* ApiFuture future =
* translationServiceClient.updateGlossaryEntryCallable().futureCall(request);
* // Do something.
* GlossaryEntry response = future.get();
* }
* }
*/
public final UnaryCallable
updateGlossaryEntryCallable() {
return stub.updateGlossaryEntryCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single entry from the glossary
*
* 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()) {
* GlossaryEntryName name =
* GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]");
* translationServiceClient.deleteGlossaryEntry(name);
* }
* }
*
* @param name Required. The resource name of the glossary entry to delete
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteGlossaryEntry(GlossaryEntryName name) {
DeleteGlossaryEntryRequest request =
DeleteGlossaryEntryRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
deleteGlossaryEntry(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single entry from the glossary
*
* 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 =
* GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
* .toString();
* translationServiceClient.deleteGlossaryEntry(name);
* }
* }
*
* @param name Required. The resource name of the glossary entry to delete
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteGlossaryEntry(String name) {
DeleteGlossaryEntryRequest request =
DeleteGlossaryEntryRequest.newBuilder().setName(name).build();
deleteGlossaryEntry(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single entry from the glossary
*
* 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()) {
* DeleteGlossaryEntryRequest request =
* DeleteGlossaryEntryRequest.newBuilder()
* .setName(
* GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
* .toString())
* .build();
* translationServiceClient.deleteGlossaryEntry(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 deleteGlossaryEntry(DeleteGlossaryEntryRequest request) {
deleteGlossaryEntryCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a single entry from the glossary
*
* 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()) {
* DeleteGlossaryEntryRequest request =
* DeleteGlossaryEntryRequest.newBuilder()
* .setName(
* GlossaryEntryName.of("[PROJECT]", "[LOCATION]", "[GLOSSARY]", "[GLOSSARY_ENTRY]")
* .toString())
* .build();
* ApiFuture future =
* translationServiceClient.deleteGlossaryEntryCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deleteGlossaryEntryCallable() {
return stub.deleteGlossaryEntryCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a 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]");
* Dataset dataset = Dataset.newBuilder().build();
* Dataset response = translationServiceClient.createDatasetAsync(parent, dataset).get();
* }
* }
*
* @param parent Required. The project name.
* @param dataset Required. The Dataset to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createDatasetAsync(
LocationName parent, Dataset dataset) {
CreateDatasetRequest request =
CreateDatasetRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setDataset(dataset)
.build();
return createDatasetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a 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();
* Dataset dataset = Dataset.newBuilder().build();
* Dataset response = translationServiceClient.createDatasetAsync(parent, dataset).get();
* }
* }
*
* @param parent Required. The project name.
* @param dataset Required. The Dataset to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createDatasetAsync(
String parent, Dataset dataset) {
CreateDatasetRequest request =
CreateDatasetRequest.newBuilder().setParent(parent).setDataset(dataset).build();
return createDatasetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a 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()) {
* CreateDatasetRequest request =
* CreateDatasetRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setDataset(Dataset.newBuilder().build())
* .build();
* Dataset response = translationServiceClient.createDatasetAsync(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 createDatasetAsync(
CreateDatasetRequest request) {
return createDatasetOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a 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()) {
* CreateDatasetRequest request =
* CreateDatasetRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setDataset(Dataset.newBuilder().build())
* .build();
* OperationFuture future =
* translationServiceClient.createDatasetOperationCallable().futureCall(request);
* // Do something.
* Dataset response = future.get();
* }
* }
*/
public final OperationCallable
createDatasetOperationCallable() {
return stub.createDatasetOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a 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()) {
* CreateDatasetRequest request =
* CreateDatasetRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setDataset(Dataset.newBuilder().build())
* .build();
* ApiFuture future =
* translationServiceClient.createDatasetCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable createDatasetCallable() {
return stub.createDatasetCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a 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()) {
* DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
* Dataset response = translationServiceClient.getDataset(name);
* }
* }
*
* @param name Required. The resource name of the dataset to retrieve.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Dataset getDataset(DatasetName name) {
GetDatasetRequest request =
GetDatasetRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getDataset(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a 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 = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
* Dataset response = translationServiceClient.getDataset(name);
* }
* }
*
* @param name Required. The resource name of the dataset to retrieve.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Dataset getDataset(String name) {
GetDatasetRequest request = GetDatasetRequest.newBuilder().setName(name).build();
return getDataset(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a 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()) {
* GetDatasetRequest request =
* GetDatasetRequest.newBuilder()
* .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .build();
* Dataset response = translationServiceClient.getDataset(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 Dataset getDataset(GetDatasetRequest request) {
return getDatasetCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a 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()) {
* GetDatasetRequest request =
* GetDatasetRequest.newBuilder()
* .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .build();
* ApiFuture future = translationServiceClient.getDatasetCallable().futureCall(request);
* // Do something.
* Dataset response = future.get();
* }
* }
*/
public final UnaryCallable getDatasetCallable() {
return stub.getDatasetCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists datasets.
*
* 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 (Dataset element : translationServiceClient.listDatasets(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. Name of the parent project. In form of
* `projects/{project-number-or-id}/locations/{location-id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDatasetsPagedResponse listDatasets(LocationName parent) {
ListDatasetsRequest request =
ListDatasetsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listDatasets(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists datasets.
*
* 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 (Dataset element : translationServiceClient.listDatasets(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. Name of the parent project. In form of
* `projects/{project-number-or-id}/locations/{location-id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListDatasetsPagedResponse listDatasets(String parent) {
ListDatasetsRequest request = ListDatasetsRequest.newBuilder().setParent(parent).build();
return listDatasets(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists datasets.
*
* 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()) {
* ListDatasetsRequest request =
* ListDatasetsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Dataset element : translationServiceClient.listDatasets(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 ListDatasetsPagedResponse listDatasets(ListDatasetsRequest request) {
return listDatasetsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists datasets.
*
* 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()) {
* ListDatasetsRequest request =
* ListDatasetsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future =
* translationServiceClient.listDatasetsPagedCallable().futureCall(request);
* // Do something.
* for (Dataset element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listDatasetsPagedCallable() {
return stub.listDatasetsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists datasets.
*
* 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()) {
* ListDatasetsRequest request =
* ListDatasetsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListDatasetsResponse response =
* translationServiceClient.listDatasetsCallable().call(request);
* for (Dataset element : response.getDatasetsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listDatasetsCallable() {
return stub.listDatasetsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a dataset and all of its contents.
*
* 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()) {
* DatasetName name = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
* translationServiceClient.deleteDatasetAsync(name).get();
* }
* }
*
* @param name Required. The name of the dataset to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteDatasetAsync(DatasetName name) {
DeleteDatasetRequest request =
DeleteDatasetRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deleteDatasetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a dataset and all of its contents.
*
* 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 = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
* translationServiceClient.deleteDatasetAsync(name).get();
* }
* }
*
* @param name Required. The name of the dataset to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteDatasetAsync(String name) {
DeleteDatasetRequest request = DeleteDatasetRequest.newBuilder().setName(name).build();
return deleteDatasetAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a dataset and all of its contents.
*
* 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()) {
* DeleteDatasetRequest request =
* DeleteDatasetRequest.newBuilder()
* .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .build();
* translationServiceClient.deleteDatasetAsync(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 deleteDatasetAsync(
DeleteDatasetRequest request) {
return deleteDatasetOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a dataset and all of its contents.
*
* 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()) {
* DeleteDatasetRequest request =
* DeleteDatasetRequest.newBuilder()
* .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .build();
* OperationFuture future =
* translationServiceClient.deleteDatasetOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
deleteDatasetOperationCallable() {
return stub.deleteDatasetOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a dataset and all of its contents.
*
* 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()) {
* DeleteDatasetRequest request =
* DeleteDatasetRequest.newBuilder()
* .setName(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .build();
* ApiFuture future =
* translationServiceClient.deleteDatasetCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deleteDatasetCallable() {
return stub.deleteDatasetCallable();
}
// 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.
* @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.
* @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())
* .setReferenceSentenceConfig(
* AdaptiveMtTranslateRequest.ReferenceSentenceConfig.newBuilder().build())
* .setGlossaryConfig(AdaptiveMtTranslateRequest.GlossaryConfig.newBuilder().build())
* .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())
* .setReferenceSentenceConfig(
* AdaptiveMtTranslateRequest.ReferenceSentenceConfig.newBuilder().build())
* .setGlossaryConfig(AdaptiveMtTranslateRequest.GlossaryConfig.newBuilder().build())
* .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();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Import sentence pairs into translation 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 dataset = "dataset1443214456";
* DatasetInputConfig inputConfig = DatasetInputConfig.newBuilder().build();
* translationServiceClient.importDataAsync(dataset, inputConfig).get();
* }
* }
*
* @param dataset Required. Name of the dataset. In form of
* `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
* @param inputConfig Required. The config for the input content.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture importDataAsync(
String dataset, DatasetInputConfig inputConfig) {
ImportDataRequest request =
ImportDataRequest.newBuilder().setDataset(dataset).setInputConfig(inputConfig).build();
return importDataAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Import sentence pairs into translation 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()) {
* ImportDataRequest request =
* ImportDataRequest.newBuilder()
* .setDataset("dataset1443214456")
* .setInputConfig(DatasetInputConfig.newBuilder().build())
* .build();
* translationServiceClient.importDataAsync(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 importDataAsync(
ImportDataRequest request) {
return importDataOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Import sentence pairs into translation 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()) {
* ImportDataRequest request =
* ImportDataRequest.newBuilder()
* .setDataset("dataset1443214456")
* .setInputConfig(DatasetInputConfig.newBuilder().build())
* .build();
* OperationFuture future =
* translationServiceClient.importDataOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
importDataOperationCallable() {
return stub.importDataOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Import sentence pairs into translation 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()) {
* ImportDataRequest request =
* ImportDataRequest.newBuilder()
* .setDataset("dataset1443214456")
* .setInputConfig(DatasetInputConfig.newBuilder().build())
* .build();
* ApiFuture future =
* translationServiceClient.importDataCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable importDataCallable() {
return stub.importDataCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Exports dataset's data to the provided output location.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
* String dataset = "dataset1443214456";
* DatasetOutputConfig outputConfig = DatasetOutputConfig.newBuilder().build();
* translationServiceClient.exportDataAsync(dataset, outputConfig).get();
* }
* }
*
* @param dataset Required. Name of the dataset. In form of
* `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
* @param outputConfig Required. The config for the output content.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture exportDataAsync(
String dataset, DatasetOutputConfig outputConfig) {
ExportDataRequest request =
ExportDataRequest.newBuilder().setDataset(dataset).setOutputConfig(outputConfig).build();
return exportDataAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Exports dataset's data to the provided output location.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
* ExportDataRequest request =
* ExportDataRequest.newBuilder()
* .setDataset("dataset1443214456")
* .setOutputConfig(DatasetOutputConfig.newBuilder().build())
* .build();
* translationServiceClient.exportDataAsync(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 exportDataAsync(
ExportDataRequest request) {
return exportDataOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Exports dataset's data to the provided output location.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
* ExportDataRequest request =
* ExportDataRequest.newBuilder()
* .setDataset("dataset1443214456")
* .setOutputConfig(DatasetOutputConfig.newBuilder().build())
* .build();
* OperationFuture future =
* translationServiceClient.exportDataOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
exportDataOperationCallable() {
return stub.exportDataOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Exports dataset's data to the provided output location.
*
* Sample code:
*
*
{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
* ExportDataRequest request =
* ExportDataRequest.newBuilder()
* .setDataset("dataset1443214456")
* .setOutputConfig(DatasetOutputConfig.newBuilder().build())
* .build();
* ApiFuture future =
* translationServiceClient.exportDataCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable exportDataCallable() {
return stub.exportDataCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists sentence pairs in the 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()) {
* DatasetName parent = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]");
* for (Example element : translationServiceClient.listExamples(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. Name of the parent dataset. In form of
* `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListExamplesPagedResponse listExamples(DatasetName parent) {
ListExamplesRequest request =
ListExamplesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listExamples(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists sentence pairs in the 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 = DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString();
* for (Example element : translationServiceClient.listExamples(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. Name of the parent dataset. In form of
* `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListExamplesPagedResponse listExamples(String parent) {
ListExamplesRequest request = ListExamplesRequest.newBuilder().setParent(parent).build();
return listExamples(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists sentence pairs in the 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()) {
* ListExamplesRequest request =
* ListExamplesRequest.newBuilder()
* .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Example element : translationServiceClient.listExamples(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 ListExamplesPagedResponse listExamples(ListExamplesRequest request) {
return listExamplesPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists sentence pairs in the 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()) {
* ListExamplesRequest request =
* ListExamplesRequest.newBuilder()
* .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future =
* translationServiceClient.listExamplesPagedCallable().futureCall(request);
* // Do something.
* for (Example element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listExamplesPagedCallable() {
return stub.listExamplesPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists sentence pairs in the 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()) {
* ListExamplesRequest request =
* ListExamplesRequest.newBuilder()
* .setParent(DatasetName.of("[PROJECT]", "[LOCATION]", "[DATASET]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListExamplesResponse response =
* translationServiceClient.listExamplesCallable().call(request);
* for (Example element : response.getExamplesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listExamplesCallable() {
return stub.listExamplesCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Model.
*
* 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]");
* Model model = Model.newBuilder().build();
* Model response = translationServiceClient.createModelAsync(parent, model).get();
* }
* }
*
* @param parent Required. The project name, in form of `projects/{project}/locations/{location}`
* @param model Required. The Model to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createModelAsync(
LocationName parent, Model model) {
CreateModelRequest request =
CreateModelRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setModel(model)
.build();
return createModelAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Model.
*
* 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();
* Model model = Model.newBuilder().build();
* Model response = translationServiceClient.createModelAsync(parent, model).get();
* }
* }
*
* @param parent Required. The project name, in form of `projects/{project}/locations/{location}`
* @param model Required. The Model to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture createModelAsync(
String parent, Model model) {
CreateModelRequest request =
CreateModelRequest.newBuilder().setParent(parent).setModel(model).build();
return createModelAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Model.
*
* 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()) {
* CreateModelRequest request =
* CreateModelRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setModel(Model.newBuilder().build())
* .build();
* Model response = translationServiceClient.createModelAsync(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 createModelAsync(
CreateModelRequest request) {
return createModelOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Model.
*
* 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()) {
* CreateModelRequest request =
* CreateModelRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setModel(Model.newBuilder().build())
* .build();
* OperationFuture future =
* translationServiceClient.createModelOperationCallable().futureCall(request);
* // Do something.
* Model response = future.get();
* }
* }
*/
public final OperationCallable
createModelOperationCallable() {
return stub.createModelOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a Model.
*
* 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()) {
* CreateModelRequest request =
* CreateModelRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setModel(Model.newBuilder().build())
* .build();
* ApiFuture future =
* translationServiceClient.createModelCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }
*/
public final UnaryCallable createModelCallable() {
return stub.createModelCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists models.
*
* 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 (Model element : translationServiceClient.listModels(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. Name of the parent project. In form of
* `projects/{project-number-or-id}/locations/{location-id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListModelsPagedResponse listModels(LocationName parent) {
ListModelsRequest request =
ListModelsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
return listModels(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists models.
*
* 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 (Model element : translationServiceClient.listModels(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. Name of the parent project. In form of
* `projects/{project-number-or-id}/locations/{location-id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListModelsPagedResponse listModels(String parent) {
ListModelsRequest request = ListModelsRequest.newBuilder().setParent(parent).build();
return listModels(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists models.
*
* 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()) {
* ListModelsRequest request =
* ListModelsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Model element : translationServiceClient.listModels(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 ListModelsPagedResponse listModels(ListModelsRequest request) {
return listModelsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists models.
*
* 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()) {
* ListModelsRequest request =
* ListModelsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future =
* translationServiceClient.listModelsPagedCallable().futureCall(request);
* // Do something.
* for (Model element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable listModelsPagedCallable() {
return stub.listModelsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists models.
*
* 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()) {
* ListModelsRequest request =
* ListModelsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListModelsResponse response = translationServiceClient.listModelsCallable().call(request);
* for (Model element : response.getModelsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listModelsCallable() {
return stub.listModelsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a model.
*
* 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()) {
* ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
* Model response = translationServiceClient.getModel(name);
* }
* }
*
* @param name Required. The resource name of the model to retrieve.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Model getModel(ModelName name) {
GetModelRequest request =
GetModelRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getModel(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a model.
*
* 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 = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
* Model response = translationServiceClient.getModel(name);
* }
* }
*
* @param name Required. The resource name of the model to retrieve.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Model getModel(String name) {
GetModelRequest request = GetModelRequest.newBuilder().setName(name).build();
return getModel(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a model.
*
* 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()) {
* GetModelRequest request =
* GetModelRequest.newBuilder()
* .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
* .build();
* Model response = translationServiceClient.getModel(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 Model getModel(GetModelRequest request) {
return getModelCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets a model.
*
* 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()) {
* GetModelRequest request =
* GetModelRequest.newBuilder()
* .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
* .build();
* ApiFuture future = translationServiceClient.getModelCallable().futureCall(request);
* // Do something.
* Model response = future.get();
* }
* }
*/
public final UnaryCallable getModelCallable() {
return stub.getModelCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a model.
*
* 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()) {
* ModelName name = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]");
* translationServiceClient.deleteModelAsync(name).get();
* }
* }
*
* @param name Required. The name of the model to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteModelAsync(ModelName name) {
DeleteModelRequest request =
DeleteModelRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return deleteModelAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a model.
*
* 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 = ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString();
* translationServiceClient.deleteModelAsync(name).get();
* }
* }
*
* @param name Required. The name of the model to delete.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture deleteModelAsync(String name) {
DeleteModelRequest request = DeleteModelRequest.newBuilder().setName(name).build();
return deleteModelAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a model.
*
* 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()) {
* DeleteModelRequest request =
* DeleteModelRequest.newBuilder()
* .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
* .build();
* translationServiceClient.deleteModelAsync(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 deleteModelAsync(
DeleteModelRequest request) {
return deleteModelOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a model.
*
* 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()) {
* DeleteModelRequest request =
* DeleteModelRequest.newBuilder()
* .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
* .build();
* OperationFuture future =
* translationServiceClient.deleteModelOperationCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final OperationCallable
deleteModelOperationCallable() {
return stub.deleteModelOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a model.
*
* 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()) {
* DeleteModelRequest request =
* DeleteModelRequest.newBuilder()
* .setName(ModelName.of("[PROJECT]", "[LOCATION]", "[MODEL]").toString())
* .build();
* ApiFuture future =
* translationServiceClient.deleteModelCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deleteModelCallable() {
return stub.deleteModelCallable();
}
@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 ListGlossaryEntriesPagedResponse
extends AbstractPagedListResponse<
ListGlossaryEntriesRequest,
ListGlossaryEntriesResponse,
GlossaryEntry,
ListGlossaryEntriesPage,
ListGlossaryEntriesFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListGlossaryEntriesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListGlossaryEntriesPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListGlossaryEntriesPagedResponse(ListGlossaryEntriesPage page) {
super(page, ListGlossaryEntriesFixedSizeCollection.createEmptyCollection());
}
}
public static class ListGlossaryEntriesPage
extends AbstractPage<
ListGlossaryEntriesRequest,
ListGlossaryEntriesResponse,
GlossaryEntry,
ListGlossaryEntriesPage> {
private ListGlossaryEntriesPage(
PageContext context,
ListGlossaryEntriesResponse response) {
super(context, response);
}
private static ListGlossaryEntriesPage createEmptyPage() {
return new ListGlossaryEntriesPage(null, null);
}
@Override
protected ListGlossaryEntriesPage createPage(
PageContext context,
ListGlossaryEntriesResponse response) {
return new ListGlossaryEntriesPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListGlossaryEntriesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListGlossaryEntriesRequest,
ListGlossaryEntriesResponse,
GlossaryEntry,
ListGlossaryEntriesPage,
ListGlossaryEntriesFixedSizeCollection> {
private ListGlossaryEntriesFixedSizeCollection(
List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListGlossaryEntriesFixedSizeCollection createEmptyCollection() {
return new ListGlossaryEntriesFixedSizeCollection(null, 0);
}
@Override
protected ListGlossaryEntriesFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListGlossaryEntriesFixedSizeCollection(pages, collectionSize);
}
}
public static class ListDatasetsPagedResponse
extends AbstractPagedListResponse<
ListDatasetsRequest,
ListDatasetsResponse,
Dataset,
ListDatasetsPage,
ListDatasetsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListDatasetsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListDatasetsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListDatasetsPagedResponse(ListDatasetsPage page) {
super(page, ListDatasetsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListDatasetsPage
extends AbstractPage {
private ListDatasetsPage(
PageContext context,
ListDatasetsResponse response) {
super(context, response);
}
private static ListDatasetsPage createEmptyPage() {
return new ListDatasetsPage(null, null);
}
@Override
protected ListDatasetsPage createPage(
PageContext context,
ListDatasetsResponse response) {
return new ListDatasetsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListDatasetsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListDatasetsRequest,
ListDatasetsResponse,
Dataset,
ListDatasetsPage,
ListDatasetsFixedSizeCollection> {
private ListDatasetsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListDatasetsFixedSizeCollection createEmptyCollection() {
return new ListDatasetsFixedSizeCollection(null, 0);
}
@Override
protected ListDatasetsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListDatasetsFixedSizeCollection(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);
}
}
public static class ListExamplesPagedResponse
extends AbstractPagedListResponse<
ListExamplesRequest,
ListExamplesResponse,
Example,
ListExamplesPage,
ListExamplesFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListExamplesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListExamplesPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListExamplesPagedResponse(ListExamplesPage page) {
super(page, ListExamplesFixedSizeCollection.createEmptyCollection());
}
}
public static class ListExamplesPage
extends AbstractPage {
private ListExamplesPage(
PageContext context,
ListExamplesResponse response) {
super(context, response);
}
private static ListExamplesPage createEmptyPage() {
return new ListExamplesPage(null, null);
}
@Override
protected ListExamplesPage createPage(
PageContext context,
ListExamplesResponse response) {
return new ListExamplesPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListExamplesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListExamplesRequest,
ListExamplesResponse,
Example,
ListExamplesPage,
ListExamplesFixedSizeCollection> {
private ListExamplesFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListExamplesFixedSizeCollection createEmptyCollection() {
return new ListExamplesFixedSizeCollection(null, 0);
}
@Override
protected ListExamplesFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListExamplesFixedSizeCollection(pages, collectionSize);
}
}
public static class ListModelsPagedResponse
extends AbstractPagedListResponse<
ListModelsRequest,
ListModelsResponse,
Model,
ListModelsPage,
ListModelsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListModelsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage, input -> new ListModelsPagedResponse(input), MoreExecutors.directExecutor());
}
private ListModelsPagedResponse(ListModelsPage page) {
super(page, ListModelsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListModelsPage
extends AbstractPage {
private ListModelsPage(
PageContext context,
ListModelsResponse response) {
super(context, response);
}
private static ListModelsPage createEmptyPage() {
return new ListModelsPage(null, null);
}
@Override
protected ListModelsPage createPage(
PageContext context,
ListModelsResponse response) {
return new ListModelsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListModelsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListModelsRequest,
ListModelsResponse,
Model,
ListModelsPage,
ListModelsFixedSizeCollection> {
private ListModelsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListModelsFixedSizeCollection createEmptyCollection() {
return new ListModelsFixedSizeCollection(null, 0);
}
@Override
protected ListModelsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListModelsFixedSizeCollection(pages, collectionSize);
}
}
}