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

fix: add missing annotation for batch document translation #759

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -57,13 +57,13 @@ compile 'com.google.cloud:google-cloud-translate'
If you are using Gradle without BOM, add this to your dependencies

```Groovy
compile 'com.google.cloud:google-cloud-translate:2.0.4'
compile 'com.google.cloud:google-cloud-translate:2.0.5'
```

If you are using SBT, add this to your dependencies

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-translate" % "2.0.4"
libraryDependencies += "com.google.cloud" % "google-cloud-translate" % "2.0.5"
```

## Authentication
Expand Down
Expand Up @@ -287,7 +287,9 @@ public static List<String> getDefaultServiceScopes() {

/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES);
return GoogleCredentialsProvider.newBuilder()
.setScopesToApply(DEFAULT_SERVICE_SCOPES)
.setUseJwtAccessWithScope(true);
}

/** Returns a builder for the default ChannelProvider for this service. */
Expand Down
Expand Up @@ -256,8 +256,8 @@ public final UnaryCallable<TranslateTextRequest, TranslateTextResponse> translat
* `projects/{project-number-or-id}`.
* <p>For global calls, use `projects/{project-number-or-id}/locations/global` or
* `projects/{project-number-or-id}`.
* <p>Only models within the same region, which have the same location-id, can be used.
* Otherwise an INVALID_ARGUMENT (400) error is returned.
* <p>Only models within the same region (has same location-id) can be used. Otherwise an
* INVALID_ARGUMENT (400) error is returned.
* @param model Optional. The language detection model to be used.
* <p>Format:
* `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
Expand Down Expand Up @@ -300,8 +300,8 @@ public final DetectLanguageResponse detectLanguage(
* `projects/{project-number-or-id}`.
* <p>For global calls, use `projects/{project-number-or-id}/locations/global` or
* `projects/{project-number-or-id}`.
* <p>Only models within the same region, which have the same location-id, can be used.
* Otherwise an INVALID_ARGUMENT (400) error is returned.
* <p>Only models within the same region (has same location-id) can be used. Otherwise an
* INVALID_ARGUMENT (400) error is returned.
* @param model Optional. The language detection model to be used.
* <p>Format:
* `projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}`
Expand Down Expand Up @@ -408,9 +408,8 @@ public final DetectLanguageResponse detectLanguage(DetectLanguageRequest request
* `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
* <p>- General (built-in) models:
* `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
* `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
* <p>Returns languages supported by the specified model. If missing, we get supported
* languages of Google general base (PBMT) model.
* languages of Google general NMT model.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final SupportedLanguages getSupportedLanguages(
Expand Down Expand Up @@ -457,9 +456,8 @@ public final SupportedLanguages getSupportedLanguages(
* `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
* <p>- General (built-in) models:
* `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
* `projects/{project-number-or-id}/locations/{location-id}/models/general/base`
* <p>Returns languages supported by the specified model. If missing, we get supported
* languages of Google general base (PBMT) model.
* languages of Google general NMT model.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final SupportedLanguages getSupportedLanguages(
Expand Down Expand Up @@ -710,7 +708,7 @@ public final UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateT
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
* BatchTranslateDocumentRequest request =
* BatchTranslateDocumentRequest.newBuilder()
* .setParent("parent-995424086")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setSourceLanguageCode("sourceLanguageCode1645917472")
* .addAllTargetLanguageCodes(new ArrayList<String>())
* .addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
Expand Down Expand Up @@ -747,7 +745,7 @@ public final UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateT
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
* BatchTranslateDocumentRequest request =
* BatchTranslateDocumentRequest.newBuilder()
* .setParent("parent-995424086")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setSourceLanguageCode("sourceLanguageCode1645917472")
* .addAllTargetLanguageCodes(new ArrayList<String>())
* .addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
Expand Down Expand Up @@ -786,7 +784,7 @@ public final UnaryCallable<BatchTranslateTextRequest, Operation> batchTranslateT
* try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
* BatchTranslateDocumentRequest request =
* BatchTranslateDocumentRequest.newBuilder()
* .setParent("parent-995424086")
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setSourceLanguageCode("sourceLanguageCode1645917472")
* .addAllTargetLanguageCodes(new ArrayList<String>())
* .addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
Expand Down
Expand Up @@ -323,7 +323,9 @@ public static List<String> getDefaultServiceScopes() {

/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES);
return GoogleCredentialsProvider.newBuilder()
.setScopesToApply(DEFAULT_SERVICE_SCOPES)
.setUseJwtAccessWithScope(true);
}

/** Returns a builder for the default ChannelProvider for this service. */
Expand Down
Expand Up @@ -498,7 +498,7 @@ public void batchTranslateDocumentTest() throws Exception {

BatchTranslateDocumentRequest request =
BatchTranslateDocumentRequest.newBuilder()
.setParent("parent-995424086")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.addAllTargetLanguageCodes(new ArrayList<String>())
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
Expand Down Expand Up @@ -538,7 +538,7 @@ public void batchTranslateDocumentExceptionTest() throws Exception {
try {
BatchTranslateDocumentRequest request =
BatchTranslateDocumentRequest.newBuilder()
.setParent("parent-995424086")
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setSourceLanguageCode("sourceLanguageCode1645917472")
.addAllTargetLanguageCodes(new ArrayList<String>())
.addAllInputConfigs(new ArrayList<BatchDocumentInputConfig>())
Expand Down
Expand Up @@ -180,10 +180,10 @@ public SourceCase getSourceCase() {
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -211,10 +211,10 @@ public boolean hasGcsSource() {
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -245,10 +245,10 @@ public com.google.cloud.translate.v3beta1.GcsSource getGcsSource() {
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -645,10 +645,10 @@ public Builder clearSource() {
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -676,10 +676,10 @@ public boolean hasGcsSource() {
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -717,10 +717,10 @@ public com.google.cloud.translate.v3beta1.GcsSource getGcsSource() {
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -755,10 +755,10 @@ public Builder setGcsSource(com.google.cloud.translate.v3beta1.GcsSource value)
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -791,10 +791,10 @@ public Builder setGcsSource(
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -838,10 +838,10 @@ public Builder mergeGcsSource(com.google.cloud.translate.v3beta1.GcsSource value
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -879,10 +879,10 @@ public Builder clearGcsSource() {
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand All @@ -907,10 +907,10 @@ public com.google.cloud.translate.v3beta1.GcsSource.Builder getGcsSourceBuilder(
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down Expand Up @@ -943,10 +943,10 @@ public com.google.cloud.translate.v3beta1.GcsSourceOrBuilder getGcsSourceOrBuild
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down
Expand Up @@ -40,10 +40,10 @@ public interface BatchDocumentInputConfigOrBuilder
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand All @@ -68,10 +68,10 @@ public interface BatchDocumentInputConfigOrBuilder
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand All @@ -96,10 +96,10 @@ public interface BatchDocumentInputConfigOrBuilder
* application/vnd.openxmlformats-officedocument.presentationml.presentation
* - `xlsx`,
* application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
* The max file size supported for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size supported for `.pdf` is 1GB and the max page limit is
* The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB.
* The max file size to support for `.pdf` is 1GB and the max page limit is
* 1000 pages.
* The max file size supported for all input documents is 1GB.
* The max file size to support for all input documents is 1GB.
* </pre>
*
* <code>.google.cloud.translation.v3beta1.GcsSource gcs_source = 1;</code>
Expand Down