Navigation Menu

Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
feat: added v3beta1 proto for online and batch document translation (#…
Browse files Browse the repository at this point in the history
…478)

This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/4a2226f3-4bc7-46d7-9a62-8b2d1917946d/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 364358156
Source-Link: googleapis/googleapis@d6b4fb3
  • Loading branch information
yoshi-automation committed Mar 31, 2021
1 parent 88abdab commit edd06a1
Show file tree
Hide file tree
Showing 57 changed files with 22,090 additions and 961 deletions.
8 changes: 2 additions & 6 deletions google-cloud-translate/clirr-ignored-differences.xml
@@ -1,14 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<!-- TODO: remove after 2.0.0 release -->
<difference>
<differenceType>7002</differenceType>
<className>com/google/cloud/translate/v3beta1/TranslationServiceClient</className>
<method>java.lang.String parse*From*Name(java.lang.String)</method>
</difference>
<difference>
<differenceType>7002</differenceType>
<className>com/google/cloud/translate/v3beta1/TranslationServiceClient</className>
<method>java.lang.String format*Name(*)</method>
<method>* listGlossaries*(*)</method>
</difference>
</differences>

Large diffs are not rendered by default.

Expand Up @@ -89,6 +89,12 @@ public UnaryCallSettings<DetectLanguageRequest, DetectLanguageResponse> detectLa
return ((TranslationServiceStubSettings) getStubSettings()).getSupportedLanguagesSettings();
}

/** Returns the object with the settings used for calls to translateDocument. */
public UnaryCallSettings<TranslateDocumentRequest, TranslateDocumentResponse>
translateDocumentSettings() {
return ((TranslationServiceStubSettings) getStubSettings()).translateDocumentSettings();
}

/** Returns the object with the settings used for calls to batchTranslateText. */
public UnaryCallSettings<BatchTranslateTextRequest, Operation> batchTranslateTextSettings() {
return ((TranslationServiceStubSettings) getStubSettings()).batchTranslateTextSettings();
Expand All @@ -102,6 +108,22 @@ public UnaryCallSettings<BatchTranslateTextRequest, Operation> batchTranslateTex
.batchTranslateTextOperationSettings();
}

/** Returns the object with the settings used for calls to batchTranslateDocument. */
public UnaryCallSettings<BatchTranslateDocumentRequest, Operation>
batchTranslateDocumentSettings() {
return ((TranslationServiceStubSettings) getStubSettings()).batchTranslateDocumentSettings();
}

/** Returns the object with the settings used for calls to batchTranslateDocument. */
public OperationCallSettings<
BatchTranslateDocumentRequest,
BatchTranslateDocumentResponse,
BatchTranslateDocumentMetadata>
batchTranslateDocumentOperationSettings() {
return ((TranslationServiceStubSettings) getStubSettings())
.batchTranslateDocumentOperationSettings();
}

/** Returns the object with the settings used for calls to createGlossary. */
public UnaryCallSettings<CreateGlossaryRequest, Operation> createGlossarySettings() {
return ((TranslationServiceStubSettings) getStubSettings()).createGlossarySettings();
Expand Down Expand Up @@ -253,6 +275,12 @@ public Builder applyToAllUnaryMethods(
return getStubSettingsBuilder().getSupportedLanguagesSettings();
}

/** Returns the builder for the settings used for calls to translateDocument. */
public UnaryCallSettings.Builder<TranslateDocumentRequest, TranslateDocumentResponse>
translateDocumentSettings() {
return getStubSettingsBuilder().translateDocumentSettings();
}

/** Returns the builder for the settings used for calls to batchTranslateText. */
public UnaryCallSettings.Builder<BatchTranslateTextRequest, Operation>
batchTranslateTextSettings() {
Expand All @@ -266,6 +294,21 @@ public Builder applyToAllUnaryMethods(
return getStubSettingsBuilder().batchTranslateTextOperationSettings();
}

/** Returns the builder for the settings used for calls to batchTranslateDocument. */
public UnaryCallSettings.Builder<BatchTranslateDocumentRequest, Operation>
batchTranslateDocumentSettings() {
return getStubSettingsBuilder().batchTranslateDocumentSettings();
}

/** Returns the builder for the settings used for calls to batchTranslateDocument. */
public OperationCallSettings.Builder<
BatchTranslateDocumentRequest,
BatchTranslateDocumentResponse,
BatchTranslateDocumentMetadata>
batchTranslateDocumentOperationSettings() {
return getStubSettingsBuilder().batchTranslateDocumentOperationSettings();
}

/** Returns the builder for the settings used for calls to createGlossary. */
public UnaryCallSettings.Builder<CreateGlossaryRequest, Operation> createGlossarySettings() {
return getStubSettingsBuilder().createGlossarySettings();
Expand Down
Expand Up @@ -10,6 +10,9 @@
"grpc": {
"libraryClient": "TranslationServiceClient",
"rpcs": {
"BatchTranslateDocument": {
"methods": ["batchTranslateDocumentAsync", "batchTranslateDocumentOperationCallable", "batchTranslateDocumentCallable"]
},
"BatchTranslateText": {
"methods": ["batchTranslateTextAsync", "batchTranslateTextOperationCallable", "batchTranslateTextCallable"]
},
Expand All @@ -29,7 +32,10 @@
"methods": ["getSupportedLanguages", "getSupportedLanguages", "getSupportedLanguages", "getSupportedLanguagesCallable"]
},
"ListGlossaries": {
"methods": ["listGlossaries", "listGlossaries", "listGlossaries", "listGlossaries", "listGlossaries", "listGlossariesPagedCallable", "listGlossariesCallable"]
"methods": ["listGlossaries", "listGlossaries", "listGlossaries", "listGlossariesPagedCallable", "listGlossariesCallable"]
},
"TranslateDocument": {
"methods": ["translateDocument", "translateDocumentCallable"]
},
"TranslateText": {
"methods": ["translateText", "translateTextCallable"]
Expand Down
Expand Up @@ -27,6 +27,9 @@
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.RequestParamsExtractor;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.translate.v3beta1.BatchTranslateDocumentMetadata;
import com.google.cloud.translate.v3beta1.BatchTranslateDocumentRequest;
import com.google.cloud.translate.v3beta1.BatchTranslateDocumentResponse;
import com.google.cloud.translate.v3beta1.BatchTranslateMetadata;
import com.google.cloud.translate.v3beta1.BatchTranslateResponse;
import com.google.cloud.translate.v3beta1.BatchTranslateTextRequest;
Expand All @@ -43,6 +46,8 @@
import com.google.cloud.translate.v3beta1.ListGlossariesRequest;
import com.google.cloud.translate.v3beta1.ListGlossariesResponse;
import com.google.cloud.translate.v3beta1.SupportedLanguages;
import com.google.cloud.translate.v3beta1.TranslateDocumentRequest;
import com.google.cloud.translate.v3beta1.TranslateDocumentResponse;
import com.google.cloud.translate.v3beta1.TranslateTextRequest;
import com.google.cloud.translate.v3beta1.TranslateTextResponse;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -99,6 +104,18 @@ public class GrpcTranslationServiceStub extends TranslationServiceStub {
.setResponseMarshaller(ProtoUtils.marshaller(SupportedLanguages.getDefaultInstance()))
.build();

private static final MethodDescriptor<TranslateDocumentRequest, TranslateDocumentResponse>
translateDocumentMethodDescriptor =
MethodDescriptor.<TranslateDocumentRequest, TranslateDocumentResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.translation.v3beta1.TranslationService/TranslateDocument")
.setRequestMarshaller(
ProtoUtils.marshaller(TranslateDocumentRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(TranslateDocumentResponse.getDefaultInstance()))
.build();

private static final MethodDescriptor<BatchTranslateTextRequest, Operation>
batchTranslateTextMethodDescriptor =
MethodDescriptor.<BatchTranslateTextRequest, Operation>newBuilder()
Expand All @@ -110,6 +127,17 @@ public class GrpcTranslationServiceStub extends TranslationServiceStub {
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();

private static final MethodDescriptor<BatchTranslateDocumentRequest, Operation>
batchTranslateDocumentMethodDescriptor =
MethodDescriptor.<BatchTranslateDocumentRequest, Operation>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.translation.v3beta1.TranslationService/BatchTranslateDocument")
.setRequestMarshaller(
ProtoUtils.marshaller(BatchTranslateDocumentRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();

private static final MethodDescriptor<CreateGlossaryRequest, Operation>
createGlossaryMethodDescriptor =
MethodDescriptor.<CreateGlossaryRequest, Operation>newBuilder()
Expand Down Expand Up @@ -156,10 +184,19 @@ public class GrpcTranslationServiceStub extends TranslationServiceStub {
private final UnaryCallable<DetectLanguageRequest, DetectLanguageResponse> detectLanguageCallable;
private final UnaryCallable<GetSupportedLanguagesRequest, SupportedLanguages>
getSupportedLanguagesCallable;
private final UnaryCallable<TranslateDocumentRequest, TranslateDocumentResponse>
translateDocumentCallable;
private final UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateTextCallable;
private final OperationCallable<
BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata>
batchTranslateTextOperationCallable;
private final UnaryCallable<BatchTranslateDocumentRequest, Operation>
batchTranslateDocumentCallable;
private final OperationCallable<
BatchTranslateDocumentRequest,
BatchTranslateDocumentResponse,
BatchTranslateDocumentMetadata>
batchTranslateDocumentOperationCallable;
private final UnaryCallable<CreateGlossaryRequest, Operation> createGlossaryCallable;
private final OperationCallable<CreateGlossaryRequest, Glossary, CreateGlossaryMetadata>
createGlossaryOperationCallable;
Expand Down Expand Up @@ -257,6 +294,20 @@ public Map<String, String> extract(GetSupportedLanguagesRequest request) {
}
})
.build();
GrpcCallSettings<TranslateDocumentRequest, TranslateDocumentResponse>
translateDocumentTransportSettings =
GrpcCallSettings.<TranslateDocumentRequest, TranslateDocumentResponse>newBuilder()
.setMethodDescriptor(translateDocumentMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<TranslateDocumentRequest>() {
@Override
public Map<String, String> extract(TranslateDocumentRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
})
.build();
GrpcCallSettings<BatchTranslateTextRequest, Operation> batchTranslateTextTransportSettings =
GrpcCallSettings.<BatchTranslateTextRequest, Operation>newBuilder()
.setMethodDescriptor(batchTranslateTextMethodDescriptor)
Expand All @@ -270,6 +321,20 @@ public Map<String, String> extract(BatchTranslateTextRequest request) {
}
})
.build();
GrpcCallSettings<BatchTranslateDocumentRequest, Operation>
batchTranslateDocumentTransportSettings =
GrpcCallSettings.<BatchTranslateDocumentRequest, Operation>newBuilder()
.setMethodDescriptor(batchTranslateDocumentMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<BatchTranslateDocumentRequest>() {
@Override
public Map<String, String> extract(BatchTranslateDocumentRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
})
.build();
GrpcCallSettings<CreateGlossaryRequest, Operation> createGlossaryTransportSettings =
GrpcCallSettings.<CreateGlossaryRequest, Operation>newBuilder()
.setMethodDescriptor(createGlossaryMethodDescriptor)
Expand Down Expand Up @@ -335,6 +400,11 @@ public Map<String, String> extract(DeleteGlossaryRequest request) {
getSupportedLanguagesTransportSettings,
settings.getSupportedLanguagesSettings(),
clientContext);
this.translateDocumentCallable =
callableFactory.createUnaryCallable(
translateDocumentTransportSettings,
settings.translateDocumentSettings(),
clientContext);
this.batchTranslateTextCallable =
callableFactory.createUnaryCallable(
batchTranslateTextTransportSettings,
Expand All @@ -346,6 +416,17 @@ public Map<String, String> extract(DeleteGlossaryRequest request) {
settings.batchTranslateTextOperationSettings(),
clientContext,
operationsStub);
this.batchTranslateDocumentCallable =
callableFactory.createUnaryCallable(
batchTranslateDocumentTransportSettings,
settings.batchTranslateDocumentSettings(),
clientContext);
this.batchTranslateDocumentOperationCallable =
callableFactory.createOperationCallable(
batchTranslateDocumentTransportSettings,
settings.batchTranslateDocumentOperationSettings(),
clientContext,
operationsStub);
this.createGlossaryCallable =
callableFactory.createUnaryCallable(
createGlossaryTransportSettings, settings.createGlossarySettings(), clientContext);
Expand Down Expand Up @@ -398,6 +479,12 @@ public UnaryCallable<DetectLanguageRequest, DetectLanguageResponse> detectLangua
return getSupportedLanguagesCallable;
}

@Override
public UnaryCallable<TranslateDocumentRequest, TranslateDocumentResponse>
translateDocumentCallable() {
return translateDocumentCallable;
}

@Override
public UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateTextCallable() {
return batchTranslateTextCallable;
Expand All @@ -410,6 +497,20 @@ public UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateTextCal
return batchTranslateTextOperationCallable;
}

@Override
public UnaryCallable<BatchTranslateDocumentRequest, Operation> batchTranslateDocumentCallable() {
return batchTranslateDocumentCallable;
}

@Override
public OperationCallable<
BatchTranslateDocumentRequest,
BatchTranslateDocumentResponse,
BatchTranslateDocumentMetadata>
batchTranslateDocumentOperationCallable() {
return batchTranslateDocumentOperationCallable;
}

@Override
public UnaryCallable<CreateGlossaryRequest, Operation> createGlossaryCallable() {
return createGlossaryCallable;
Expand Down
Expand Up @@ -22,6 +22,9 @@
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.translate.v3beta1.BatchTranslateDocumentMetadata;
import com.google.cloud.translate.v3beta1.BatchTranslateDocumentRequest;
import com.google.cloud.translate.v3beta1.BatchTranslateDocumentResponse;
import com.google.cloud.translate.v3beta1.BatchTranslateMetadata;
import com.google.cloud.translate.v3beta1.BatchTranslateResponse;
import com.google.cloud.translate.v3beta1.BatchTranslateTextRequest;
Expand All @@ -38,6 +41,8 @@
import com.google.cloud.translate.v3beta1.ListGlossariesRequest;
import com.google.cloud.translate.v3beta1.ListGlossariesResponse;
import com.google.cloud.translate.v3beta1.SupportedLanguages;
import com.google.cloud.translate.v3beta1.TranslateDocumentRequest;
import com.google.cloud.translate.v3beta1.TranslateDocumentResponse;
import com.google.cloud.translate.v3beta1.TranslateTextRequest;
import com.google.cloud.translate.v3beta1.TranslateTextResponse;
import com.google.longrunning.Operation;
Expand Down Expand Up @@ -71,6 +76,11 @@ public UnaryCallable<DetectLanguageRequest, DetectLanguageResponse> detectLangua
throw new UnsupportedOperationException("Not implemented: getSupportedLanguagesCallable()");
}

public UnaryCallable<TranslateDocumentRequest, TranslateDocumentResponse>
translateDocumentCallable() {
throw new UnsupportedOperationException("Not implemented: translateDocumentCallable()");
}

public OperationCallable<
BatchTranslateTextRequest, BatchTranslateResponse, BatchTranslateMetadata>
batchTranslateTextOperationCallable() {
Expand All @@ -82,6 +92,19 @@ public UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateTextCal
throw new UnsupportedOperationException("Not implemented: batchTranslateTextCallable()");
}

public OperationCallable<
BatchTranslateDocumentRequest,
BatchTranslateDocumentResponse,
BatchTranslateDocumentMetadata>
batchTranslateDocumentOperationCallable() {
throw new UnsupportedOperationException(
"Not implemented: batchTranslateDocumentOperationCallable()");
}

public UnaryCallable<BatchTranslateDocumentRequest, Operation> batchTranslateDocumentCallable() {
throw new UnsupportedOperationException("Not implemented: batchTranslateDocumentCallable()");
}

public OperationCallable<CreateGlossaryRequest, Glossary, CreateGlossaryMetadata>
createGlossaryOperationCallable() {
throw new UnsupportedOperationException("Not implemented: createGlossaryOperationCallable()");
Expand Down

0 comments on commit edd06a1

Please sign in to comment.