@Generated(value="by gapic-generator-java") public class TranslationServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> 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().
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TranslateDocument |
Translates documents in synchronous mode. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateGlossaryEntry |
Creates a glossary entry. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateGlossaryEntry |
Updates a glossary entry. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateDataset |
Creates a Dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetDataset |
Gets a Dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListDatasets |
Lists datasets. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateAdaptiveMtDataset |
Creates an Adaptive MT dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetAdaptiveMtDataset |
Gets the Adaptive MT dataset. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AdaptiveMtTranslate |
Translate text using Adaptive MT. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetAdaptiveMtFile |
Gets and AdaptiveMtFile |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateModel |
Creates a Model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListModels |
Lists models. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetModel |
Gets a model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteModel |
Deletes a model. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of TranslationServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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.
| Modifier | Constructor and Description |
|---|---|
protected |
TranslationServiceClient(TranslationServiceSettings settings)
Constructs an instance of TranslationServiceClient, using the given settings.
|
protected |
TranslationServiceClient(TranslationServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
AdaptiveMtTranslateResponse |
adaptiveMtTranslate(AdaptiveMtTranslateRequest request)
Translate text using Adaptive MT.
|
AdaptiveMtTranslateResponse |
adaptiveMtTranslate(LocationName parent,
List<String> content)
Translate text using Adaptive MT.
|
AdaptiveMtTranslateResponse |
adaptiveMtTranslate(String parent,
List<String> content)
Translate text using Adaptive MT.
|
com.google.api.gax.rpc.UnaryCallable<AdaptiveMtTranslateRequest,AdaptiveMtTranslateResponse> |
adaptiveMtTranslateCallable()
Translate text using Adaptive MT.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
com.google.api.gax.longrunning.OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> |
batchTranslateDocumentAsync(BatchTranslateDocumentRequest request)
Translates a large volume of document in asynchronous batch mode.
|
com.google.api.gax.longrunning.OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> |
batchTranslateDocumentAsync(LocationName parent,
String sourceLanguageCode,
List<String> targetLanguageCodes,
List<BatchDocumentInputConfig> inputConfigs,
BatchDocumentOutputConfig outputConfig)
Translates a large volume of document in asynchronous batch mode.
|
com.google.api.gax.longrunning.OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> |
batchTranslateDocumentAsync(String parent,
String sourceLanguageCode,
List<String> targetLanguageCodes,
List<BatchDocumentInputConfig> inputConfigs,
BatchDocumentOutputConfig outputConfig)
Translates a large volume of document in asynchronous batch mode.
|
com.google.api.gax.rpc.UnaryCallable<BatchTranslateDocumentRequest,com.google.longrunning.Operation> |
batchTranslateDocumentCallable()
Translates a large volume of document in asynchronous batch mode.
|
com.google.api.gax.rpc.OperationCallable<BatchTranslateDocumentRequest,BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> |
batchTranslateDocumentOperationCallable()
Translates a large volume of document in asynchronous batch mode.
|
com.google.api.gax.longrunning.OperationFuture<BatchTranslateResponse,BatchTranslateMetadata> |
batchTranslateTextAsync(BatchTranslateTextRequest request)
Translates a large volume of text in asynchronous batch mode.
|
com.google.api.gax.rpc.UnaryCallable<BatchTranslateTextRequest,com.google.longrunning.Operation> |
batchTranslateTextCallable()
Translates a large volume of text in asynchronous batch mode.
|
com.google.api.gax.rpc.OperationCallable<BatchTranslateTextRequest,BatchTranslateResponse,BatchTranslateMetadata> |
batchTranslateTextOperationCallable()
Translates a large volume of text in asynchronous batch mode.
|
void |
close() |
static TranslationServiceClient |
create()
Constructs an instance of TranslationServiceClient with default settings.
|
static TranslationServiceClient |
create(TranslationServiceSettings settings)
Constructs an instance of TranslationServiceClient, using the given settings.
|
static TranslationServiceClient |
create(TranslationServiceStub stub)
Constructs an instance of TranslationServiceClient, using the given stub for making calls.
|
AdaptiveMtDataset |
createAdaptiveMtDataset(CreateAdaptiveMtDatasetRequest request)
Creates an Adaptive MT dataset.
|
AdaptiveMtDataset |
createAdaptiveMtDataset(LocationName parent,
AdaptiveMtDataset adaptiveMtDataset)
Creates an Adaptive MT dataset.
|
AdaptiveMtDataset |
createAdaptiveMtDataset(String parent,
AdaptiveMtDataset adaptiveMtDataset)
Creates an Adaptive MT dataset.
|
com.google.api.gax.rpc.UnaryCallable<CreateAdaptiveMtDatasetRequest,AdaptiveMtDataset> |
createAdaptiveMtDatasetCallable()
Creates an Adaptive MT dataset.
|
com.google.api.gax.longrunning.OperationFuture<Dataset,CreateDatasetMetadata> |
createDatasetAsync(CreateDatasetRequest request)
Creates a Dataset.
|
com.google.api.gax.longrunning.OperationFuture<Dataset,CreateDatasetMetadata> |
createDatasetAsync(LocationName parent,
Dataset dataset)
Creates a Dataset.
|
com.google.api.gax.longrunning.OperationFuture<Dataset,CreateDatasetMetadata> |
createDatasetAsync(String parent,
Dataset dataset)
Creates a Dataset.
|
com.google.api.gax.rpc.UnaryCallable<CreateDatasetRequest,com.google.longrunning.Operation> |
createDatasetCallable()
Creates a Dataset.
|
com.google.api.gax.rpc.OperationCallable<CreateDatasetRequest,Dataset,CreateDatasetMetadata> |
createDatasetOperationCallable()
Creates a Dataset.
|
com.google.api.gax.longrunning.OperationFuture<Glossary,CreateGlossaryMetadata> |
createGlossaryAsync(CreateGlossaryRequest request)
Creates a glossary and returns the long-running operation.
|
com.google.api.gax.longrunning.OperationFuture<Glossary,CreateGlossaryMetadata> |
createGlossaryAsync(LocationName parent,
Glossary glossary)
Creates a glossary and returns the long-running operation.
|
com.google.api.gax.longrunning.OperationFuture<Glossary,CreateGlossaryMetadata> |
createGlossaryAsync(String parent,
Glossary glossary)
Creates a glossary and returns the long-running operation.
|
com.google.api.gax.rpc.UnaryCallable<CreateGlossaryRequest,com.google.longrunning.Operation> |
createGlossaryCallable()
Creates a glossary and returns the long-running operation.
|
GlossaryEntry |
createGlossaryEntry(CreateGlossaryEntryRequest request)
Creates a glossary entry.
|
GlossaryEntry |
createGlossaryEntry(GlossaryName parent,
GlossaryEntry glossaryEntry)
Creates a glossary entry.
|
GlossaryEntry |
createGlossaryEntry(String parent,
GlossaryEntry glossaryEntry)
Creates a glossary entry.
|
com.google.api.gax.rpc.UnaryCallable<CreateGlossaryEntryRequest,GlossaryEntry> |
createGlossaryEntryCallable()
Creates a glossary entry.
|
com.google.api.gax.rpc.OperationCallable<CreateGlossaryRequest,Glossary,CreateGlossaryMetadata> |
createGlossaryOperationCallable()
Creates a glossary and returns the long-running operation.
|
com.google.api.gax.longrunning.OperationFuture<Model,CreateModelMetadata> |
createModelAsync(CreateModelRequest request)
Creates a Model.
|
com.google.api.gax.longrunning.OperationFuture<Model,CreateModelMetadata> |
createModelAsync(LocationName parent,
Model model)
Creates a Model.
|
com.google.api.gax.longrunning.OperationFuture<Model,CreateModelMetadata> |
createModelAsync(String parent,
Model model)
Creates a Model.
|
com.google.api.gax.rpc.UnaryCallable<CreateModelRequest,com.google.longrunning.Operation> |
createModelCallable()
Creates a Model.
|
com.google.api.gax.rpc.OperationCallable<CreateModelRequest,Model,CreateModelMetadata> |
createModelOperationCallable()
Creates a Model.
|
void |
deleteAdaptiveMtDataset(AdaptiveMtDatasetName name)
Deletes an Adaptive MT dataset, including all its entries and associated metadata.
|
void |
deleteAdaptiveMtDataset(DeleteAdaptiveMtDatasetRequest request)
Deletes an Adaptive MT dataset, including all its entries and associated metadata.
|
void |
deleteAdaptiveMtDataset(String name)
Deletes an Adaptive MT dataset, including all its entries and associated metadata.
|
com.google.api.gax.rpc.UnaryCallable<DeleteAdaptiveMtDatasetRequest,com.google.protobuf.Empty> |
deleteAdaptiveMtDatasetCallable()
Deletes an Adaptive MT dataset, including all its entries and associated metadata.
|
void |
deleteAdaptiveMtFile(AdaptiveMtFileName name)
Deletes an AdaptiveMtFile along with its sentences.
|
void |
deleteAdaptiveMtFile(DeleteAdaptiveMtFileRequest request)
Deletes an AdaptiveMtFile along with its sentences.
|
void |
deleteAdaptiveMtFile(String name)
Deletes an AdaptiveMtFile along with its sentences.
|
com.google.api.gax.rpc.UnaryCallable<DeleteAdaptiveMtFileRequest,com.google.protobuf.Empty> |
deleteAdaptiveMtFileCallable()
Deletes an AdaptiveMtFile along with its sentences.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDatasetMetadata> |
deleteDatasetAsync(DatasetName name)
Deletes a dataset and all of its contents.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDatasetMetadata> |
deleteDatasetAsync(DeleteDatasetRequest request)
Deletes a dataset and all of its contents.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDatasetMetadata> |
deleteDatasetAsync(String name)
Deletes a dataset and all of its contents.
|
com.google.api.gax.rpc.UnaryCallable<DeleteDatasetRequest,com.google.longrunning.Operation> |
deleteDatasetCallable()
Deletes a dataset and all of its contents.
|
com.google.api.gax.rpc.OperationCallable<DeleteDatasetRequest,com.google.protobuf.Empty,DeleteDatasetMetadata> |
deleteDatasetOperationCallable()
Deletes a dataset and all of its contents.
|
com.google.api.gax.longrunning.OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> |
deleteGlossaryAsync(DeleteGlossaryRequest request)
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet.
|
com.google.api.gax.longrunning.OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> |
deleteGlossaryAsync(GlossaryName name)
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet.
|
com.google.api.gax.longrunning.OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> |
deleteGlossaryAsync(String name)
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet.
|
com.google.api.gax.rpc.UnaryCallable<DeleteGlossaryRequest,com.google.longrunning.Operation> |
deleteGlossaryCallable()
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet.
|
void |
deleteGlossaryEntry(DeleteGlossaryEntryRequest request)
Deletes a single entry from the glossary
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
|
void |
deleteGlossaryEntry(GlossaryEntryName name)
Deletes a single entry from the glossary
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
|
void |
deleteGlossaryEntry(String name)
Deletes a single entry from the glossary
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
|
com.google.api.gax.rpc.UnaryCallable<DeleteGlossaryEntryRequest,com.google.protobuf.Empty> |
deleteGlossaryEntryCallable()
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
|
com.google.api.gax.rpc.OperationCallable<DeleteGlossaryRequest,DeleteGlossaryResponse,DeleteGlossaryMetadata> |
deleteGlossaryOperationCallable()
Deletes a glossary, or cancels glossary construction if the glossary isn't created yet.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteModelMetadata> |
deleteModelAsync(DeleteModelRequest request)
Deletes a model.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteModelMetadata> |
deleteModelAsync(ModelName name)
Deletes a model.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteModelMetadata> |
deleteModelAsync(String name)
Deletes a model.
|
com.google.api.gax.rpc.UnaryCallable<DeleteModelRequest,com.google.longrunning.Operation> |
deleteModelCallable()
Deletes a model.
|
com.google.api.gax.rpc.OperationCallable<DeleteModelRequest,com.google.protobuf.Empty,DeleteModelMetadata> |
deleteModelOperationCallable()
Deletes a model.
|
DetectLanguageResponse |
detectLanguage(DetectLanguageRequest request)
Detects the language of text within a request.
|
DetectLanguageResponse |
detectLanguage(LocationName parent,
String model,
String mimeType,
String content)
Detects the language of text within a request.
|
DetectLanguageResponse |
detectLanguage(String parent,
String model,
String mimeType,
String content)
Detects the language of text within a request.
|
com.google.api.gax.rpc.UnaryCallable<DetectLanguageRequest,DetectLanguageResponse> |
detectLanguageCallable()
Detects the language of text within a request.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ExportDataMetadata> |
exportDataAsync(ExportDataRequest request)
Exports dataset's data to the provided output location.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ExportDataMetadata> |
exportDataAsync(String dataset,
DatasetOutputConfig outputConfig)
Exports dataset's data to the provided output location.
|
com.google.api.gax.rpc.UnaryCallable<ExportDataRequest,com.google.longrunning.Operation> |
exportDataCallable()
Exports dataset's data to the provided output location.
|
com.google.api.gax.rpc.OperationCallable<ExportDataRequest,com.google.protobuf.Empty,ExportDataMetadata> |
exportDataOperationCallable()
Exports dataset's data to the provided output location.
|
AdaptiveMtDataset |
getAdaptiveMtDataset(AdaptiveMtDatasetName name)
Gets the Adaptive MT dataset.
|
AdaptiveMtDataset |
getAdaptiveMtDataset(GetAdaptiveMtDatasetRequest request)
Gets the Adaptive MT dataset.
|
AdaptiveMtDataset |
getAdaptiveMtDataset(String name)
Gets the Adaptive MT dataset.
|
com.google.api.gax.rpc.UnaryCallable<GetAdaptiveMtDatasetRequest,AdaptiveMtDataset> |
getAdaptiveMtDatasetCallable()
Gets the Adaptive MT dataset.
|
AdaptiveMtFile |
getAdaptiveMtFile(AdaptiveMtFileName name)
Gets and AdaptiveMtFile
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
|
AdaptiveMtFile |
getAdaptiveMtFile(GetAdaptiveMtFileRequest request)
Gets and AdaptiveMtFile
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
|
AdaptiveMtFile |
getAdaptiveMtFile(String name)
Gets and AdaptiveMtFile
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
|
com.google.api.gax.rpc.UnaryCallable<GetAdaptiveMtFileRequest,AdaptiveMtFile> |
getAdaptiveMtFileCallable()
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
|
Dataset |
getDataset(DatasetName name)
Gets a Dataset.
|
Dataset |
getDataset(GetDatasetRequest request)
Gets a Dataset.
|
Dataset |
getDataset(String name)
Gets a Dataset.
|
com.google.api.gax.rpc.UnaryCallable<GetDatasetRequest,Dataset> |
getDatasetCallable()
Gets a Dataset.
|
Glossary |
getGlossary(GetGlossaryRequest request)
Gets a glossary.
|
Glossary |
getGlossary(GlossaryName name)
Gets a glossary.
|
Glossary |
getGlossary(String name)
Gets a glossary.
|
com.google.api.gax.rpc.UnaryCallable<GetGlossaryRequest,Glossary> |
getGlossaryCallable()
Gets a glossary.
|
GlossaryEntry |
getGlossaryEntry(GetGlossaryEntryRequest request)
Gets a single glossary entry by the given id.
|
GlossaryEntry |
getGlossaryEntry(GlossaryEntryName name)
Gets a single glossary entry by the given id.
|
GlossaryEntry |
getGlossaryEntry(String name)
Gets a single glossary entry by the given id.
|
com.google.api.gax.rpc.UnaryCallable<GetGlossaryEntryRequest,GlossaryEntry> |
getGlossaryEntryCallable()
Gets a single glossary entry by the given id.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
Model |
getModel(GetModelRequest request)
Gets a model.
|
Model |
getModel(ModelName name)
Gets a model.
|
Model |
getModel(String name)
Gets a model.
|
com.google.api.gax.rpc.UnaryCallable<GetModelRequest,Model> |
getModelCallable()
Gets a model.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
TranslationServiceSettings |
getSettings() |
TranslationServiceStub |
getStub() |
SupportedLanguages |
getSupportedLanguages(GetSupportedLanguagesRequest request)
Returns a list of supported languages for translation.
|
SupportedLanguages |
getSupportedLanguages(LocationName parent,
String model,
String displayLanguageCode)
Returns a list of supported languages for translation.
|
SupportedLanguages |
getSupportedLanguages(String parent,
String model,
String displayLanguageCode)
Returns a list of supported languages for translation.
|
com.google.api.gax.rpc.UnaryCallable<GetSupportedLanguagesRequest,SupportedLanguages> |
getSupportedLanguagesCallable()
Returns a list of supported languages for translation.
|
ImportAdaptiveMtFileResponse |
importAdaptiveMtFile(AdaptiveMtDatasetName parent)
Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
|
ImportAdaptiveMtFileResponse |
importAdaptiveMtFile(ImportAdaptiveMtFileRequest request)
Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
|
ImportAdaptiveMtFileResponse |
importAdaptiveMtFile(String parent)
Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
|
com.google.api.gax.rpc.UnaryCallable<ImportAdaptiveMtFileRequest,ImportAdaptiveMtFileResponse> |
importAdaptiveMtFileCallable()
Imports an AdaptiveMtFile and adds all of its sentences into the AdaptiveMtDataset.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDataMetadata> |
importDataAsync(ImportDataRequest request)
Import sentence pairs into translation Dataset.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDataMetadata> |
importDataAsync(String dataset,
DatasetInputConfig inputConfig)
Import sentence pairs into translation Dataset.
|
com.google.api.gax.rpc.UnaryCallable<ImportDataRequest,com.google.longrunning.Operation> |
importDataCallable()
Import sentence pairs into translation Dataset.
|
com.google.api.gax.rpc.OperationCallable<ImportDataRequest,com.google.protobuf.Empty,ImportDataMetadata> |
importDataOperationCallable()
Import sentence pairs into translation Dataset.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse |
listAdaptiveMtDatasets(ListAdaptiveMtDatasetsRequest request)
Lists all Adaptive MT datasets for which the caller has read permission.
|
TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse |
listAdaptiveMtDatasets(LocationName parent)
Lists all Adaptive MT datasets for which the caller has read permission.
|
TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse |
listAdaptiveMtDatasets(String parent)
Lists all Adaptive MT datasets for which the caller has read permission.
|
com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtDatasetsRequest,ListAdaptiveMtDatasetsResponse> |
listAdaptiveMtDatasetsCallable()
Lists all Adaptive MT datasets for which the caller has read permission.
|
com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtDatasetsRequest,TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse> |
listAdaptiveMtDatasetsPagedCallable()
Lists all Adaptive MT datasets for which the caller has read permission.
|
TranslationServiceClient.ListAdaptiveMtFilesPagedResponse |
listAdaptiveMtFiles(AdaptiveMtDatasetName parent)
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
TranslationServiceClient.ListAdaptiveMtFilesPagedResponse |
listAdaptiveMtFiles(ListAdaptiveMtFilesRequest request)
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
TranslationServiceClient.ListAdaptiveMtFilesPagedResponse |
listAdaptiveMtFiles(String parent)
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtFilesRequest,ListAdaptiveMtFilesResponse> |
listAdaptiveMtFilesCallable()
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtFilesRequest,TranslationServiceClient.ListAdaptiveMtFilesPagedResponse> |
listAdaptiveMtFilesPagedCallable()
Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
|
TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse |
listAdaptiveMtSentences(AdaptiveMtFileName parent)
Lists all AdaptiveMtSentences under a given file/dataset.
|
TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse |
listAdaptiveMtSentences(ListAdaptiveMtSentencesRequest request)
Lists all AdaptiveMtSentences under a given file/dataset.
|
TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse |
listAdaptiveMtSentences(String parent)
Lists all AdaptiveMtSentences under a given file/dataset.
|
com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtSentencesRequest,ListAdaptiveMtSentencesResponse> |
listAdaptiveMtSentencesCallable()
Lists all AdaptiveMtSentences under a given file/dataset.
|
com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtSentencesRequest,TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse> |
listAdaptiveMtSentencesPagedCallable()
Lists all AdaptiveMtSentences under a given file/dataset.
|
TranslationServiceClient.ListDatasetsPagedResponse |
listDatasets(ListDatasetsRequest request)
Lists datasets.
|
TranslationServiceClient.ListDatasetsPagedResponse |
listDatasets(LocationName parent)
Lists datasets.
|
TranslationServiceClient.ListDatasetsPagedResponse |
listDatasets(String parent)
Lists datasets.
|
com.google.api.gax.rpc.UnaryCallable<ListDatasetsRequest,ListDatasetsResponse> |
listDatasetsCallable()
Lists datasets.
|
com.google.api.gax.rpc.UnaryCallable<ListDatasetsRequest,TranslationServiceClient.ListDatasetsPagedResponse> |
listDatasetsPagedCallable()
Lists datasets.
|
TranslationServiceClient.ListExamplesPagedResponse |
listExamples(DatasetName parent)
Lists sentence pairs in the dataset.
|
TranslationServiceClient.ListExamplesPagedResponse |
listExamples(ListExamplesRequest request)
Lists sentence pairs in the dataset.
|
TranslationServiceClient.ListExamplesPagedResponse |
listExamples(String parent)
Lists sentence pairs in the dataset.
|
com.google.api.gax.rpc.UnaryCallable<ListExamplesRequest,ListExamplesResponse> |
listExamplesCallable()
Lists sentence pairs in the dataset.
|
com.google.api.gax.rpc.UnaryCallable<ListExamplesRequest,TranslationServiceClient.ListExamplesPagedResponse> |
listExamplesPagedCallable()
Lists sentence pairs in the dataset.
|
TranslationServiceClient.ListGlossariesPagedResponse |
listGlossaries(ListGlossariesRequest request)
Lists glossaries in a project.
|
TranslationServiceClient.ListGlossariesPagedResponse |
listGlossaries(LocationName parent)
Lists glossaries in a project.
|
TranslationServiceClient.ListGlossariesPagedResponse |
listGlossaries(String parent)
Lists glossaries in a project.
|
com.google.api.gax.rpc.UnaryCallable<ListGlossariesRequest,ListGlossariesResponse> |
listGlossariesCallable()
Lists glossaries in a project.
|
com.google.api.gax.rpc.UnaryCallable<ListGlossariesRequest,TranslationServiceClient.ListGlossariesPagedResponse> |
listGlossariesPagedCallable()
Lists glossaries in a project.
|
TranslationServiceClient.ListGlossaryEntriesPagedResponse |
listGlossaryEntries(GlossaryName parent)
List the entries for the glossary.
|
TranslationServiceClient.ListGlossaryEntriesPagedResponse |
listGlossaryEntries(ListGlossaryEntriesRequest request)
List the entries for the glossary.
|
TranslationServiceClient.ListGlossaryEntriesPagedResponse |
listGlossaryEntries(String parent)
List the entries for the glossary.
|
com.google.api.gax.rpc.UnaryCallable<ListGlossaryEntriesRequest,ListGlossaryEntriesResponse> |
listGlossaryEntriesCallable()
List the entries for the glossary.
|
com.google.api.gax.rpc.UnaryCallable<ListGlossaryEntriesRequest,TranslationServiceClient.ListGlossaryEntriesPagedResponse> |
listGlossaryEntriesPagedCallable()
List the entries for the glossary.
|
TranslationServiceClient.ListModelsPagedResponse |
listModels(ListModelsRequest request)
Lists models.
|
TranslationServiceClient.ListModelsPagedResponse |
listModels(LocationName parent)
Lists models.
|
TranslationServiceClient.ListModelsPagedResponse |
listModels(String parent)
Lists models.
|
com.google.api.gax.rpc.UnaryCallable<ListModelsRequest,ListModelsResponse> |
listModelsCallable()
Lists models.
|
com.google.api.gax.rpc.UnaryCallable<ListModelsRequest,TranslationServiceClient.ListModelsPagedResponse> |
listModelsPagedCallable()
Lists models.
|
RomanizeTextResponse |
romanizeText(LocationName parent,
List<String> contents)
Romanize input text written in non-Latin scripts to Latin text.
|
RomanizeTextResponse |
romanizeText(RomanizeTextRequest request)
Romanize input text written in non-Latin scripts to Latin text.
|
RomanizeTextResponse |
romanizeText(String parent,
List<String> contents)
Romanize input text written in non-Latin scripts to Latin text.
|
com.google.api.gax.rpc.UnaryCallable<RomanizeTextRequest,RomanizeTextResponse> |
romanizeTextCallable()
Romanize input text written in non-Latin scripts to Latin text.
|
void |
shutdown() |
void |
shutdownNow() |
TranslateDocumentResponse |
translateDocument(TranslateDocumentRequest request)
Translates documents in synchronous mode.
|
com.google.api.gax.rpc.UnaryCallable<TranslateDocumentRequest,TranslateDocumentResponse> |
translateDocumentCallable()
Translates documents in synchronous mode.
|
TranslateTextResponse |
translateText(LocationName parent,
String targetLanguageCode,
List<String> contents)
Translates input text and returns translated text.
|
TranslateTextResponse |
translateText(LocationName parent,
String model,
String mimeType,
String sourceLanguageCode,
String targetLanguageCode,
List<String> contents)
Translates input text and returns translated text.
|
TranslateTextResponse |
translateText(String parent,
String targetLanguageCode,
List<String> contents)
Translates input text and returns translated text.
|
TranslateTextResponse |
translateText(String parent,
String model,
String mimeType,
String sourceLanguageCode,
String targetLanguageCode,
List<String> contents)
Translates input text and returns translated text.
|
TranslateTextResponse |
translateText(TranslateTextRequest request)
Translates input text and returns translated text.
|
com.google.api.gax.rpc.UnaryCallable<TranslateTextRequest,TranslateTextResponse> |
translateTextCallable()
Translates input text and returns translated text.
|
com.google.api.gax.longrunning.OperationFuture<Glossary,UpdateGlossaryMetadata> |
updateGlossaryAsync(Glossary glossary,
com.google.protobuf.FieldMask updateMask)
Updates a glossary.
|
com.google.api.gax.longrunning.OperationFuture<Glossary,UpdateGlossaryMetadata> |
updateGlossaryAsync(UpdateGlossaryRequest request)
Updates a glossary.
|
com.google.api.gax.rpc.UnaryCallable<UpdateGlossaryRequest,com.google.longrunning.Operation> |
updateGlossaryCallable()
Updates a glossary.
|
GlossaryEntry |
updateGlossaryEntry(GlossaryEntry glossaryEntry)
Updates a glossary entry.
|
GlossaryEntry |
updateGlossaryEntry(UpdateGlossaryEntryRequest request)
Updates a glossary entry.
|
com.google.api.gax.rpc.UnaryCallable<UpdateGlossaryEntryRequest,GlossaryEntry> |
updateGlossaryEntryCallable()
Updates a glossary entry.
|
com.google.api.gax.rpc.OperationCallable<UpdateGlossaryRequest,Glossary,UpdateGlossaryMetadata> |
updateGlossaryOperationCallable()
Updates a glossary.
|
protected TranslationServiceClient(TranslationServiceSettings settings) throws IOException
IOExceptionprotected TranslationServiceClient(TranslationServiceStub stub)
public static final TranslationServiceClient create() throws IOException
IOExceptionpublic static final TranslationServiceClient create(TranslationServiceSettings settings) throws IOException
IOExceptionpublic static final TranslationServiceClient create(TranslationServiceStub stub)
public final TranslationServiceSettings getSettings()
public TranslationServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final TranslateTextResponse translateText(LocationName parent, String targetLanguageCode, List<String> contents)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> contents = new ArrayList<>();
TranslateTextResponse response =
translationServiceClient.translateText(parent, targetLanguageCode, contents);
}
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.
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.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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslateTextResponse translateText(String parent, String targetLanguageCode, List<String> contents)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> contents = new ArrayList<>();
TranslateTextResponse response =
translationServiceClient.translateText(parent, targetLanguageCode, contents);
}
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.
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.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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslateTextResponse translateText(LocationName parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List<String> contents)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> contents = new ArrayList<>();
TranslateTextResponse response =
translationServiceClient.translateText(
parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);
}
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.
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
mimeType - Optional. The format of the source text, for example, "text/html",
"text/plain". If left blank, the MIME type defaults to "text/html".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.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.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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslateTextResponse translateText(String parent, String model, String mimeType, String sourceLanguageCode, String targetLanguageCode, List<String> contents)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> contents = new ArrayList<>();
TranslateTextResponse response =
translationServiceClient.translateText(
parent, model, mimeType, sourceLanguageCode, targetLanguageCode, contents);
}
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.
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
mimeType - Optional. The format of the source text, for example, "text/html",
"text/plain". If left blank, the MIME type defaults to "text/html".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.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.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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslateTextResponse translateText(TranslateTextRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.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<String, String>())
.build();
TranslateTextResponse response = translationServiceClient.translateText(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<TranslateTextRequest,TranslateTextResponse> translateTextCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.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<String, String>())
.build();
ApiFuture<TranslateTextResponse> future =
translationServiceClient.translateTextCallable().futureCall(request);
// Do something.
TranslateTextResponse response = future.get();
}
public final RomanizeTextResponse romanizeText(LocationName parent, List<String> contents)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> contents = new ArrayList<>();
RomanizeTextResponse response = translationServiceClient.romanizeText(parent, contents);
}
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}`.
contents - Required. The content of the input in string format.com.google.api.gax.rpc.ApiException - if the remote call failspublic final RomanizeTextResponse romanizeText(String parent, List<String> contents)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> contents = new ArrayList<>();
RomanizeTextResponse response = translationServiceClient.romanizeText(parent, contents);
}
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}`.
contents - Required. The content of the input in string format.com.google.api.gax.rpc.ApiException - if the remote call failspublic final RomanizeTextResponse romanizeText(RomanizeTextRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.build();
RomanizeTextResponse response = translationServiceClient.romanizeText(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<RomanizeTextRequest,RomanizeTextResponse> romanizeTextCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.build();
ApiFuture<RomanizeTextResponse> future =
translationServiceClient.romanizeTextCallable().futureCall(request);
// Do something.
RomanizeTextResponse response = future.get();
}
public final DetectLanguageResponse detectLanguage(LocationName parent, String model, String mimeType, String content)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
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.
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.
mimeType - Optional. The format of the source text, for example, "text/html",
"text/plain". If left blank, the MIME type defaults to "text/html".content - The content of the input stored as a string.com.google.api.gax.rpc.ApiException - if the remote call failspublic final DetectLanguageResponse detectLanguage(String parent, String model, String mimeType, String content)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
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.
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.
mimeType - Optional. The format of the source text, for example, "text/html",
"text/plain". If left blank, the MIME type defaults to "text/html".content - The content of the input stored as a string.com.google.api.gax.rpc.ApiException - if the remote call failspublic final DetectLanguageResponse detectLanguage(DetectLanguageRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String, String>())
.build();
DetectLanguageResponse response = translationServiceClient.detectLanguage(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DetectLanguageRequest,DetectLanguageResponse> detectLanguageCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String, String>())
.build();
ApiFuture<DetectLanguageResponse> future =
translationServiceClient.detectLanguageCallable().futureCall(request);
// Do something.
DetectLanguageResponse response = future.get();
}
public final SupportedLanguages getSupportedLanguages(LocationName parent, String model, String displayLanguageCode)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
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.
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.
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SupportedLanguages getSupportedLanguages(String parent, String model, String displayLanguageCode)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
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.
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.
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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SupportedLanguages getSupportedLanguages(GetSupportedLanguagesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetSupportedLanguagesRequest,SupportedLanguages> getSupportedLanguagesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<SupportedLanguages> future =
translationServiceClient.getSupportedLanguagesCallable().futureCall(request);
// Do something.
SupportedLanguages response = future.get();
}
public final TranslateDocumentResponse translateDocument(TranslateDocumentRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setIsTranslateNativePdfOnly(true)
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
TranslateDocumentResponse response = translationServiceClient.translateDocument(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<TranslateDocumentRequest,TranslateDocumentResponse> translateDocumentCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setIsTranslateNativePdfOnly(true)
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
ApiFuture<TranslateDocumentResponse> future =
translationServiceClient.translateDocumentCallable().futureCall(request);
// Do something.
TranslateDocumentResponse response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<BatchTranslateResponse,BatchTranslateMetadata> batchTranslateTextAsync(BatchTranslateTextRequest request)
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.putAllModels(new HashMap<String, String>())
.addAllInputConfigs(new ArrayList<InputConfig>())
.setOutputConfig(OutputConfig.newBuilder().build())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllLabels(new HashMap<String, String>())
.build();
BatchTranslateResponse response =
translationServiceClient.batchTranslateTextAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<BatchTranslateTextRequest,BatchTranslateResponse,BatchTranslateMetadata> batchTranslateTextOperationCallable()
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.putAllModels(new HashMap<String, String>())
.addAllInputConfigs(new ArrayList<InputConfig>())
.setOutputConfig(OutputConfig.newBuilder().build())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllLabels(new HashMap<String, String>())
.build();
OperationFuture<BatchTranslateResponse, BatchTranslateMetadata> future =
translationServiceClient.batchTranslateTextOperationCallable().futureCall(request);
// Do something.
BatchTranslateResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<BatchTranslateTextRequest,com.google.longrunning.Operation> batchTranslateTextCallable()
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.putAllModels(new HashMap<String, String>())
.addAllInputConfigs(new ArrayList<InputConfig>())
.setOutputConfig(OutputConfig.newBuilder().build())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllLabels(new HashMap<String, String>())
.build();
ApiFuture<Operation> future =
translationServiceClient.batchTranslateTextCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> batchTranslateDocumentAsync(LocationName parent, String sourceLanguageCode, List<String> targetLanguageCodes, List<BatchDocumentInputConfig> inputConfigs, BatchDocumentOutputConfig outputConfig)
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> targetLanguageCodes = new ArrayList<>();
List<BatchDocumentInputConfig> inputConfigs = new ArrayList<>();
BatchDocumentOutputConfig outputConfig = BatchDocumentOutputConfig.newBuilder().build();
BatchTranslateDocumentResponse response =
translationServiceClient
.batchTranslateDocumentAsync(
parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig)
.get();
}
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.
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).targetLanguageCodes - Required. The ISO-639 language code to use for translation of the
input document. Specify up to 10 language codes here.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.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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> batchTranslateDocumentAsync(String parent, String sourceLanguageCode, List<String> targetLanguageCodes, List<BatchDocumentInputConfig> inputConfigs, BatchDocumentOutputConfig outputConfig)
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> targetLanguageCodes = new ArrayList<>();
List<BatchDocumentInputConfig> inputConfigs = new ArrayList<>();
BatchDocumentOutputConfig outputConfig = BatchDocumentOutputConfig.newBuilder().build();
BatchTranslateDocumentResponse response =
translationServiceClient
.batchTranslateDocumentAsync(
parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig)
.get();
}
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.
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).targetLanguageCodes - Required. The ISO-639 language code to use for translation of the
input document. Specify up to 10 language codes here.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.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.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> batchTranslateDocumentAsync(BatchTranslateDocumentRequest request)
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
.setOutputConfig(BatchDocumentOutputConfig.newBuilder().build())
.putAllModels(new HashMap<String, String>())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllFormatConversions(new HashMap<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
BatchTranslateDocumentResponse response =
translationServiceClient.batchTranslateDocumentAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<BatchTranslateDocumentRequest,BatchTranslateDocumentResponse,BatchTranslateDocumentMetadata> batchTranslateDocumentOperationCallable()
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
.setOutputConfig(BatchDocumentOutputConfig.newBuilder().build())
.putAllModels(new HashMap<String, String>())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllFormatConversions(new HashMap<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
OperationFuture<BatchTranslateDocumentResponse, BatchTranslateDocumentMetadata> future =
translationServiceClient.batchTranslateDocumentOperationCallable().futureCall(request);
// Do something.
BatchTranslateDocumentResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<BatchTranslateDocumentRequest,com.google.longrunning.Operation> batchTranslateDocumentCallable()
This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
.setOutputConfig(BatchDocumentOutputConfig.newBuilder().build())
.putAllModels(new HashMap<String, String>())
.putAllGlossaries(new HashMap<String, TranslateTextGlossaryConfig>())
.putAllFormatConversions(new HashMap<String, String>())
.setCustomizedAttribution("customizedAttribution557650238")
.setEnableShadowRemovalNativePdf(true)
.setEnableRotationCorrection(true)
.build();
ApiFuture<Operation> future =
translationServiceClient.batchTranslateDocumentCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Glossary,CreateGlossaryMetadata> createGlossaryAsync(LocationName parent, Glossary glossary)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
parent - Required. The project name.glossary - Required. The glossary to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Glossary,CreateGlossaryMetadata> createGlossaryAsync(String parent, Glossary glossary)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
parent - Required. The project name.glossary - Required. The glossary to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Glossary,CreateGlossaryMetadata> createGlossaryAsync(CreateGlossaryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateGlossaryRequest,Glossary,CreateGlossaryMetadata> createGlossaryOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Glossary, CreateGlossaryMetadata> future =
translationServiceClient.createGlossaryOperationCallable().futureCall(request);
// Do something.
Glossary response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateGlossaryRequest,com.google.longrunning.Operation> createGlossaryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Operation> future =
translationServiceClient.createGlossaryCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Glossary,UpdateGlossaryMetadata> updateGlossaryAsync(Glossary glossary, com.google.protobuf.FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
glossary - Required. The glossary entry to update.updateMask - The list of fields to be updated. Currently only `display_name` and
'input_config'com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Glossary,UpdateGlossaryMetadata> updateGlossaryAsync(UpdateGlossaryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateGlossaryRequest,Glossary,UpdateGlossaryMetadata> updateGlossaryOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Glossary, UpdateGlossaryMetadata> future =
translationServiceClient.updateGlossaryOperationCallable().futureCall(request);
// Do something.
Glossary response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateGlossaryRequest,com.google.longrunning.Operation> updateGlossaryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Operation> future =
translationServiceClient.updateGlossaryCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final TranslationServiceClient.ListGlossariesPagedResponse listGlossaries(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. The name of the project from which to list all of the glossaries.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListGlossariesPagedResponse listGlossaries(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. The name of the project from which to list all of the glossaries.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListGlossariesPagedResponse listGlossaries(ListGlossariesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListGlossariesRequest,TranslationServiceClient.ListGlossariesPagedResponse> listGlossariesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Glossary> future =
translationServiceClient.listGlossariesPagedCallable().futureCall(request);
// Do something.
for (Glossary element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListGlossariesRequest,ListGlossariesResponse> listGlossariesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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 Glossary getGlossary(GlossaryName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The name of the glossary to retrieve.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Glossary getGlossary(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The name of the glossary to retrieve.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Glossary getGlossary(GetGlossaryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetGlossaryRequest,Glossary> getGlossaryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Glossary> future =
translationServiceClient.getGlossaryCallable().futureCall(request);
// Do something.
Glossary response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> deleteGlossaryAsync(GlossaryName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
name - Required. The name of the glossary to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> deleteGlossaryAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
name - Required. The name of the glossary to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<DeleteGlossaryResponse,DeleteGlossaryMetadata> deleteGlossaryAsync(DeleteGlossaryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteGlossaryRequest,DeleteGlossaryResponse,DeleteGlossaryMetadata> deleteGlossaryOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<DeleteGlossaryResponse, DeleteGlossaryMetadata> future =
translationServiceClient.deleteGlossaryOperationCallable().futureCall(request);
// Do something.
DeleteGlossaryResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteGlossaryRequest,com.google.longrunning.Operation> deleteGlossaryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Operation> future =
translationServiceClient.deleteGlossaryCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final GlossaryEntry getGlossaryEntry(GlossaryEntryName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the glossary entry to getcom.google.api.gax.rpc.ApiException - if the remote call failspublic final GlossaryEntry getGlossaryEntry(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the glossary entry to getcom.google.api.gax.rpc.ApiException - if the remote call failspublic final GlossaryEntry getGlossaryEntry(GetGlossaryEntryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetGlossaryEntryRequest,GlossaryEntry> getGlossaryEntryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<GlossaryEntry> future =
translationServiceClient.getGlossaryEntryCallable().futureCall(request);
// Do something.
GlossaryEntry response = future.get();
}
public final TranslationServiceClient.ListGlossaryEntriesPagedResponse listGlossaryEntries(GlossaryName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. The parent glossary resource name for listing the glossary's entries.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListGlossaryEntriesPagedResponse listGlossaryEntries(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. The parent glossary resource name for listing the glossary's entries.com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListGlossaryEntriesPagedResponse listGlossaryEntries(ListGlossaryEntriesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListGlossaryEntriesRequest,TranslationServiceClient.ListGlossaryEntriesPagedResponse> listGlossaryEntriesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<GlossaryEntry> future =
translationServiceClient.listGlossaryEntriesPagedCallable().futureCall(request);
// Do something.
for (GlossaryEntry element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListGlossaryEntriesRequest,ListGlossaryEntriesResponse> listGlossaryEntriesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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 GlossaryEntry createGlossaryEntry(GlossaryName parent, GlossaryEntry glossaryEntry)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
parent - Required. The resource name of the glossary to create the entry under.glossaryEntry - Required. The glossary entry to createcom.google.api.gax.rpc.ApiException - if the remote call failspublic final GlossaryEntry createGlossaryEntry(String parent, GlossaryEntry glossaryEntry)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
parent - Required. The resource name of the glossary to create the entry under.glossaryEntry - Required. The glossary entry to createcom.google.api.gax.rpc.ApiException - if the remote call failspublic final GlossaryEntry createGlossaryEntry(CreateGlossaryEntryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateGlossaryEntryRequest,GlossaryEntry> createGlossaryEntryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<GlossaryEntry> future =
translationServiceClient.createGlossaryEntryCallable().futureCall(request);
// Do something.
GlossaryEntry response = future.get();
}
public final GlossaryEntry updateGlossaryEntry(GlossaryEntry glossaryEntry)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
glossaryEntry - Required. The glossary entry to update.com.google.api.gax.rpc.ApiException - if the remote call failspublic final GlossaryEntry updateGlossaryEntry(UpdateGlossaryEntryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateGlossaryEntryRequest,GlossaryEntry> updateGlossaryEntryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<GlossaryEntry> future =
translationServiceClient.updateGlossaryEntryCallable().futureCall(request);
// Do something.
GlossaryEntry response = future.get();
}
public final void deleteGlossaryEntry(GlossaryEntryName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the glossary entry to deletecom.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteGlossaryEntry(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the glossary entry to deletecom.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteGlossaryEntry(DeleteGlossaryEntryRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteGlossaryEntryRequest,com.google.protobuf.Empty> deleteGlossaryEntryCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Empty> future =
translationServiceClient.deleteGlossaryEntryCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Dataset,CreateDatasetMetadata> createDatasetAsync(LocationName parent, Dataset dataset)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
parent - Required. The project name.dataset - Required. The Dataset to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Dataset,CreateDatasetMetadata> createDatasetAsync(String parent, Dataset dataset)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
parent - Required. The project name.dataset - Required. The Dataset to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Dataset,CreateDatasetMetadata> createDatasetAsync(CreateDatasetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateDatasetRequest,Dataset,CreateDatasetMetadata> createDatasetOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Dataset, CreateDatasetMetadata> future =
translationServiceClient.createDatasetOperationCallable().futureCall(request);
// Do something.
Dataset response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateDatasetRequest,com.google.longrunning.Operation> createDatasetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Operation> future =
translationServiceClient.createDatasetCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final Dataset getDataset(DatasetName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the dataset to retrieve.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Dataset getDataset(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the dataset to retrieve.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Dataset getDataset(GetDatasetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetDatasetRequest,Dataset> getDatasetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Dataset> future = translationServiceClient.getDatasetCallable().futureCall(request);
// Do something.
Dataset response = future.get();
}
public final TranslationServiceClient.ListDatasetsPagedResponse listDatasets(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. Name of the parent project. In form of
`projects/{project-number-or-id}/locations/{location-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListDatasetsPagedResponse listDatasets(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. Name of the parent project. In form of
`projects/{project-number-or-id}/locations/{location-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListDatasetsPagedResponse listDatasets(ListDatasetsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListDatasetsRequest,TranslationServiceClient.ListDatasetsPagedResponse> listDatasetsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Dataset> future =
translationServiceClient.listDatasetsPagedCallable().futureCall(request);
// Do something.
for (Dataset element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListDatasetsRequest,ListDatasetsResponse> listDatasetsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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 com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDatasetMetadata> deleteDatasetAsync(DatasetName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
name - Required. The name of the dataset to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDatasetMetadata> deleteDatasetAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
name - Required. The name of the dataset to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteDatasetMetadata> deleteDatasetAsync(DeleteDatasetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteDatasetRequest,com.google.protobuf.Empty,DeleteDatasetMetadata> deleteDatasetOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Empty, DeleteDatasetMetadata> future =
translationServiceClient.deleteDatasetOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteDatasetRequest,com.google.longrunning.Operation> deleteDatasetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Operation> future =
translationServiceClient.deleteDatasetCallable().futureCall(request);
// Do something.
future.get();
}
public final AdaptiveMtDataset createAdaptiveMtDataset(LocationName parent, AdaptiveMtDataset adaptiveMtDataset)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
parent - Required. Name of the parent project. In form of
`projects/{project-number-or-id}/locations/{location-id}`adaptiveMtDataset - Required. The AdaptiveMtDataset to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdaptiveMtDataset createAdaptiveMtDataset(String parent, AdaptiveMtDataset adaptiveMtDataset)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
parent - Required. Name of the parent project. In form of
`projects/{project-number-or-id}/locations/{location-id}`adaptiveMtDataset - Required. The AdaptiveMtDataset to be created.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdaptiveMtDataset createAdaptiveMtDataset(CreateAdaptiveMtDatasetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateAdaptiveMtDatasetRequest,AdaptiveMtDataset> createAdaptiveMtDatasetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<AdaptiveMtDataset> future =
translationServiceClient.createAdaptiveMtDatasetCallable().futureCall(request);
// Do something.
AdaptiveMtDataset response = future.get();
}
public final void deleteAdaptiveMtDataset(AdaptiveMtDatasetName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. Name of the dataset. In the form of
`projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteAdaptiveMtDataset(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. Name of the dataset. In the form of
`projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteAdaptiveMtDataset(DeleteAdaptiveMtDatasetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteAdaptiveMtDatasetRequest,com.google.protobuf.Empty> deleteAdaptiveMtDatasetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Empty> future =
translationServiceClient.deleteAdaptiveMtDatasetCallable().futureCall(request);
// Do something.
future.get();
}
public final AdaptiveMtDataset getAdaptiveMtDataset(AdaptiveMtDatasetName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. Name of the dataset. In the form of
`projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdaptiveMtDataset getAdaptiveMtDataset(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. Name of the dataset. In the form of
`projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets/{adaptive-mt-dataset-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdaptiveMtDataset getAdaptiveMtDataset(GetAdaptiveMtDatasetRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetAdaptiveMtDatasetRequest,AdaptiveMtDataset> getAdaptiveMtDatasetCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<AdaptiveMtDataset> future =
translationServiceClient.getAdaptiveMtDatasetCallable().futureCall(request);
// Do something.
AdaptiveMtDataset response = future.get();
}
public final TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse listAdaptiveMtDatasets(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. The resource name of the project from which to list the Adaptive MT
datasets. `projects/{project-number-or-id}/locations/{location-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse listAdaptiveMtDatasets(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. The resource name of the project from which to list the Adaptive MT
datasets. `projects/{project-number-or-id}/locations/{location-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse listAdaptiveMtDatasets(ListAdaptiveMtDatasetsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtDatasetsRequest,TranslationServiceClient.ListAdaptiveMtDatasetsPagedResponse> listAdaptiveMtDatasetsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<AdaptiveMtDataset> future =
translationServiceClient.listAdaptiveMtDatasetsPagedCallable().futureCall(request);
// Do something.
for (AdaptiveMtDataset element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtDatasetsRequest,ListAdaptiveMtDatasetsResponse> listAdaptiveMtDatasetsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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 AdaptiveMtTranslateResponse adaptiveMtTranslate(LocationName parent, List<String> content)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> content = new ArrayList<>();
AdaptiveMtTranslateResponse response =
translationServiceClient.adaptiveMtTranslate(parent, content);
}
parent - Required. Location to make a regional call.
Format: `projects/{project-number-or-id}/locations/{location-id}`.
content - Required. The content of the input in string format.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdaptiveMtTranslateResponse adaptiveMtTranslate(String parent, List<String> content)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String> content = new ArrayList<>();
AdaptiveMtTranslateResponse response =
translationServiceClient.adaptiveMtTranslate(parent, content);
}
parent - Required. Location to make a regional call.
Format: `projects/{project-number-or-id}/locations/{location-id}`.
content - Required. The content of the input in string format.com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdaptiveMtTranslateResponse adaptiveMtTranslate(AdaptiveMtTranslateRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.setReferenceSentenceConfig(
AdaptiveMtTranslateRequest.ReferenceSentenceConfig.newBuilder().build())
.setGlossaryConfig(AdaptiveMtTranslateRequest.GlossaryConfig.newBuilder().build())
.build();
AdaptiveMtTranslateResponse response = translationServiceClient.adaptiveMtTranslate(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<AdaptiveMtTranslateRequest,AdaptiveMtTranslateResponse> adaptiveMtTranslateCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<String>())
.setReferenceSentenceConfig(
AdaptiveMtTranslateRequest.ReferenceSentenceConfig.newBuilder().build())
.setGlossaryConfig(AdaptiveMtTranslateRequest.GlossaryConfig.newBuilder().build())
.build();
ApiFuture<AdaptiveMtTranslateResponse> future =
translationServiceClient.adaptiveMtTranslateCallable().futureCall(request);
// Do something.
AdaptiveMtTranslateResponse response = future.get();
}
public final AdaptiveMtFile getAdaptiveMtFile(AdaptiveMtFileName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the file, in form of
`projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdaptiveMtFile getAdaptiveMtFile(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the file, in form of
`projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}/adaptiveMtFiles/{file}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final AdaptiveMtFile getAdaptiveMtFile(GetAdaptiveMtFileRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetAdaptiveMtFileRequest,AdaptiveMtFile> getAdaptiveMtFileCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<AdaptiveMtFile> future =
translationServiceClient.getAdaptiveMtFileCallable().futureCall(request);
// Do something.
AdaptiveMtFile response = future.get();
}
public final void deleteAdaptiveMtFile(AdaptiveMtFileName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
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}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteAdaptiveMtFile(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
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}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteAdaptiveMtFile(DeleteAdaptiveMtFileRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteAdaptiveMtFileRequest,com.google.protobuf.Empty> deleteAdaptiveMtFileCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Empty> future =
translationServiceClient.deleteAdaptiveMtFileCallable().futureCall(request);
// Do something.
future.get();
}
public final ImportAdaptiveMtFileResponse importAdaptiveMtFile(AdaptiveMtDatasetName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
parent - Required. The resource name of the file, in form of
`projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final ImportAdaptiveMtFileResponse importAdaptiveMtFile(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
parent - Required. The resource name of the file, in form of
`projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final ImportAdaptiveMtFileResponse importAdaptiveMtFile(ImportAdaptiveMtFileRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ImportAdaptiveMtFileRequest,ImportAdaptiveMtFileResponse> importAdaptiveMtFileCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<ImportAdaptiveMtFileResponse> future =
translationServiceClient.importAdaptiveMtFileCallable().futureCall(request);
// Do something.
ImportAdaptiveMtFileResponse response = future.get();
}
public final TranslationServiceClient.ListAdaptiveMtFilesPagedResponse listAdaptiveMtFiles(AdaptiveMtDatasetName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. The resource name of the project from which to list the Adaptive MT
files. `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListAdaptiveMtFilesPagedResponse listAdaptiveMtFiles(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. The resource name of the project from which to list the Adaptive MT
files. `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListAdaptiveMtFilesPagedResponse listAdaptiveMtFiles(ListAdaptiveMtFilesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtFilesRequest,TranslationServiceClient.ListAdaptiveMtFilesPagedResponse> listAdaptiveMtFilesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<AdaptiveMtFile> future =
translationServiceClient.listAdaptiveMtFilesPagedCallable().futureCall(request);
// Do something.
for (AdaptiveMtFile element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtFilesRequest,ListAdaptiveMtFilesResponse> listAdaptiveMtFilesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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 TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse listAdaptiveMtSentences(AdaptiveMtFileName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
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}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse listAdaptiveMtSentences(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
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}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse listAdaptiveMtSentences(ListAdaptiveMtSentencesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtSentencesRequest,TranslationServiceClient.ListAdaptiveMtSentencesPagedResponse> listAdaptiveMtSentencesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<AdaptiveMtSentence> future =
translationServiceClient.listAdaptiveMtSentencesPagedCallable().futureCall(request);
// Do something.
for (AdaptiveMtSentence element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListAdaptiveMtSentencesRequest,ListAdaptiveMtSentencesResponse> listAdaptiveMtSentencesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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 com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDataMetadata> importDataAsync(String dataset, DatasetInputConfig inputConfig)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
dataset - Required. Name of the dataset. In form of
`projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`inputConfig - Required. The config for the input content.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDataMetadata> importDataAsync(ImportDataRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ImportDataRequest,com.google.protobuf.Empty,ImportDataMetadata> importDataOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Empty, ImportDataMetadata> future =
translationServiceClient.importDataOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ImportDataRequest,com.google.longrunning.Operation> importDataCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Operation> future =
translationServiceClient.importDataCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ExportDataMetadata> exportDataAsync(String dataset, DatasetOutputConfig outputConfig)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
dataset - Required. Name of the dataset. In form of
`projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`outputConfig - Required. The config for the output content.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ExportDataMetadata> exportDataAsync(ExportDataRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ExportDataRequest,com.google.protobuf.Empty,ExportDataMetadata> exportDataOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Empty, ExportDataMetadata> future =
translationServiceClient.exportDataOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ExportDataRequest,com.google.longrunning.Operation> exportDataCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Operation> future =
translationServiceClient.exportDataCallable().futureCall(request);
// Do something.
future.get();
}
public final TranslationServiceClient.ListExamplesPagedResponse listExamples(DatasetName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. Name of the parent dataset. In form of
`projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListExamplesPagedResponse listExamples(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. Name of the parent dataset. In form of
`projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListExamplesPagedResponse listExamples(ListExamplesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListExamplesRequest,TranslationServiceClient.ListExamplesPagedResponse> listExamplesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Example> future =
translationServiceClient.listExamplesPagedCallable().futureCall(request);
// Do something.
for (Example element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListExamplesRequest,ListExamplesResponse> listExamplesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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 com.google.api.gax.longrunning.OperationFuture<Model,CreateModelMetadata> createModelAsync(LocationName parent, Model model)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
parent - Required. The project name, in form of `projects/{project}/locations/{location}`model - Required. The Model to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Model,CreateModelMetadata> createModelAsync(String parent, Model model)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
parent - Required. The project name, in form of `projects/{project}/locations/{location}`model - Required. The Model to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Model,CreateModelMetadata> createModelAsync(CreateModelRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateModelRequest,Model,CreateModelMetadata> createModelOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Model, CreateModelMetadata> future =
translationServiceClient.createModelOperationCallable().futureCall(request);
// Do something.
Model response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateModelRequest,com.google.longrunning.Operation> createModelCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Operation> future =
translationServiceClient.createModelCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final TranslationServiceClient.ListModelsPagedResponse listModels(LocationName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. Name of the parent project. In form of
`projects/{project-number-or-id}/locations/{location-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListModelsPagedResponse listModels(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
parent - Required. Name of the parent project. In form of
`projects/{project-number-or-id}/locations/{location-id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final TranslationServiceClient.ListModelsPagedResponse listModels(ListModelsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListModelsRequest,TranslationServiceClient.ListModelsPagedResponse> listModelsPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Model> future =
translationServiceClient.listModelsPagedCallable().futureCall(request);
// Do something.
for (Model element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListModelsRequest,ListModelsResponse> listModelsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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 Model getModel(ModelName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the model to retrieve.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Model getModel(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
name - Required. The resource name of the model to retrieve.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Model getModel(GetModelRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetModelRequest,Model> getModelCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Model> future = translationServiceClient.getModelCallable().futureCall(request);
// Do something.
Model response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteModelMetadata> deleteModelAsync(ModelName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
name - Required. The name of the model to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteModelMetadata> deleteModelAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
name - Required. The name of the model to delete.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteModelMetadata> deleteModelAsync(DeleteModelRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteModelRequest,com.google.protobuf.Empty,DeleteModelMetadata> deleteModelOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Empty, DeleteModelMetadata> future =
translationServiceClient.deleteModelOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteModelRequest,com.google.longrunning.Operation> deleteModelCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating 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<Operation> future =
translationServiceClient.deleteModelCallable().futureCall(request);
// Do something.
future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.