diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata
index 99adbc99..8e623586 100644
--- a/.github/readme/synth.metadata/synth.metadata
+++ b/.github/readme/synth.metadata/synth.metadata
@@ -4,14 +4,14 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-document-ai.git",
- "sha": "981da1d86b4cd697278dfd874abf3396d0768288"
+ "sha": "fc70b1fe2653501f87d34725cd8001bccdb18962"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
- "sha": "a073c873f3928c561bdf87fdfbf1d081d1998984"
+ "sha": "996775eca5fd934edac3c2ae34b80ff0395b1717"
}
}
]
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a5a58623..930666a4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+### [0.3.7](https://www.github.com/googleapis/java-document-ai/compare/v0.3.6...v0.3.7) (2020-12-14)
+
+
+### Dependencies
+
+* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.1 ([#295](https://www.github.com/googleapis/java-document-ai/issues/295)) ([7564e4d](https://www.github.com/googleapis/java-document-ai/commit/7564e4db794ca7d9fdac0b32fdb2669c87b47621))
+
### [0.3.6](https://www.github.com/googleapis/java-document-ai/compare/v0.3.5...v0.3.6) (2020-12-08)
diff --git a/README.md b/README.md
index 92d9cedd..10e868af 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
com.google.cloudgoogle-cloud-document-ai
- 0.3.5
+ 0.3.6
```
@@ -42,18 +42,18 @@ If you are using Maven without BOM, add this to your dependencies:
com.google.cloudgoogle-cloud-document-ai
- 0.3.5
+ 0.3.6
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:google-cloud-document-ai:0.3.5'
+compile 'com.google.cloud:google-cloud-document-ai:0.3.6'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-document-ai" % "0.3.5"
+libraryDependencies += "com.google.cloud" % "google-cloud-document-ai" % "0.3.6"
```
## Authentication
@@ -153,6 +153,8 @@ Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3]
Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4]
Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5]
+Java is a registered trademark of Oracle and/or its affiliates.
+
[product-docs]: https://cloud.google.com/compute/docs/documentai/
[javadocs]: https://googleapis.dev/java/google-cloud-document-ai/latest/index.html
[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-document-ai/java7.svg
diff --git a/google-cloud-document-ai-bom/pom.xml b/google-cloud-document-ai-bom/pom.xml
index 19c883c3..a651939c 100644
--- a/google-cloud-document-ai-bom/pom.xml
+++ b/google-cloud-document-ai-bom/pom.xml
@@ -3,7 +3,7 @@
4.0.0com.google.cloudgoogle-cloud-document-ai-bom
- 0.3.6
+ 0.3.7pomcom.google.cloud
@@ -61,37 +61,37 @@
com.google.api.grpcproto-google-cloud-document-ai-v1beta1
- 0.3.6
+ 0.3.7com.google.api.grpcproto-google-cloud-document-ai-v1beta2
- 0.3.6
+ 0.3.7com.google.api.grpcproto-google-cloud-document-ai-v1beta3
- 0.3.6
+ 0.3.7com.google.api.grpcgrpc-google-cloud-document-ai-v1beta1
- 0.3.6
+ 0.3.7com.google.api.grpcgrpc-google-cloud-document-ai-v1beta2
- 0.3.6
+ 0.3.7com.google.api.grpcgrpc-google-cloud-document-ai-v1beta3
- 0.3.6
+ 0.3.7com.google.cloudgoogle-cloud-document-ai
- 0.3.6
+ 0.3.7
diff --git a/google-cloud-document-ai/pom.xml b/google-cloud-document-ai/pom.xml
index f579ab53..89681f3e 100644
--- a/google-cloud-document-ai/pom.xml
+++ b/google-cloud-document-ai/pom.xml
@@ -3,7 +3,7 @@
4.0.0com.google.cloudgoogle-cloud-document-ai
- 0.3.6
+ 0.3.7jarGoogle Cloud Document AIhttps://github.com/googleapis/java-document-ai
@@ -11,7 +11,7 @@
com.google.cloudgoogle-cloud-document-ai-parent
- 0.3.6
+ 0.3.7google-cloud-document-ai
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java
index 8f63c68f..2dabeae9 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta1;
import com.google.api.core.BetaApi;
@@ -29,7 +30,7 @@
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND SERVICE
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Service to parse structured information from unstructured or semi-structured
* documents using state-of-the-art Google AI such as natural language, computer vision, and
@@ -38,16 +39,7 @@
*
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:
*
- *
Note: close() needs to be called on the documentUnderstandingServiceClient object to clean up
+ *
Note: close() needs to be called on the DocumentUnderstandingServiceClient object to clean up
* resources such as threads. In the example above, try-with-resources is used, which automatically
* calls close().
*
@@ -76,30 +68,28 @@
*
*
Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
-@Generated("by gapic-generator")
@BetaApi
+@Generated("by gapic-generator")
public class DocumentUnderstandingServiceClient implements BackgroundResource {
private final DocumentUnderstandingServiceSettings settings;
private final DocumentUnderstandingServiceStub stub;
@@ -122,7 +112,7 @@ public static final DocumentUnderstandingServiceClient create(
/**
* Constructs an instance of DocumentUnderstandingServiceClient, using the given stub for making
- * calls. This is for advanced usage - prefer to use DocumentUnderstandingServiceSettings}.
+ * calls. This is for advanced usage - prefer using create(DocumentUnderstandingServiceSettings).
*/
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final DocumentUnderstandingServiceClient create(
@@ -163,30 +153,17 @@ public DocumentUnderstandingServiceStub getStub() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationsClient getOperationsClient() {
return operationsClient;
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents.
*
- *
- *
* @param requests Required. Individual requests for each document.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
batchProcessDocumentsAsync(List requests) {
BatchProcessDocumentsRequest request =
@@ -194,74 +171,35 @@ public final OperationsClient getOperationsClient() {
return batchProcessDocumentsAsync(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents.
*
- *
- *
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
batchProcessDocumentsAsync(BatchProcessDocumentsRequest request) {
return batchProcessDocumentsOperationCallable().futureCall(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents.
*
*
*/
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public final OperationCallable<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationCallable() {
return stub.batchProcessDocumentsOperationCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents.
*
*
*/
public final UnaryCallable
batchProcessDocumentsCallable() {
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceSettings.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceSettings.java
index 87ceed34..3838b99f 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceSettings.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceSettings.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta1;
import com.google.api.core.ApiFunction;
@@ -32,7 +33,7 @@
import java.util.List;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link DocumentUnderstandingServiceClient}.
*
@@ -47,26 +48,28 @@
*
The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
- *
For example, to set the total timeout of batchProcessDocumentsAsync to 30 seconds:
+ *
For example, to set the total timeout of batchProcessDocuments to 30 seconds:
*
- *
+ * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
+ * documentUnderstandingServiceSettingsBuilder.build();
+ * }
*/
-@Generated("by gapic-generator")
-@BetaApi
+@Generated("by gapic-generator-java")
public class DocumentUnderstandingServiceSettings
extends ClientSettings {
+
/** Returns the object with the settings used for calls to batchProcessDocuments. */
public UnaryCallSettings
batchProcessDocumentsSettings() {
@@ -75,8 +78,6 @@ public class DocumentUnderstandingServiceSettings
}
/** Returns the object with the settings used for calls to batchProcessDocuments. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationSettings() {
@@ -145,18 +146,15 @@ protected DocumentUnderstandingServiceSettings(Builder settingsBuilder) throws I
/** Builder for DocumentUnderstandingServiceSettings. */
public static class Builder
extends ClientSettings.Builder {
+
protected Builder() throws IOException {
- this((ClientContext) null);
+ this(((ClientContext) null));
}
protected Builder(ClientContext clientContext) {
super(DocumentUnderstandingServiceStubSettings.newBuilder(clientContext));
}
- private static Builder createDefault() {
- return new Builder(DocumentUnderstandingServiceStubSettings.newBuilder());
- }
-
protected Builder(DocumentUnderstandingServiceSettings settings) {
super(settings.getStubSettings().toBuilder());
}
@@ -165,11 +163,15 @@ protected Builder(DocumentUnderstandingServiceStubSettings.Builder stubSettings)
super(stubSettings);
}
+ private static Builder createDefault() {
+ return new Builder(DocumentUnderstandingServiceStubSettings.newBuilder());
+ }
+
public DocumentUnderstandingServiceStubSettings.Builder getStubSettingsBuilder() {
return ((DocumentUnderstandingServiceStubSettings.Builder) getStubSettings());
}
- // NEXT_MAJOR_VER: remove 'throws Exception'
+ // NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
@@ -189,8 +191,6 @@ public Builder applyToAllUnaryMethods(
}
/** Returns the builder for the settings used for calls to batchProcessDocuments. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationSettings() {
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java
index f7fc4875..0913ae45 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,29 +15,17 @@
*/
/**
- * A client to Cloud Document AI API.
+ * The interfaces provided are listed below, along with usage samples.
*
- *
The interfaces provided are listed below, along with usage samples.
- *
- *
Service Description: Service to parse structured information from unstructured or
* semi-structured documents using state-of-the-art Google AI such as natural language, computer
* vision, and translation.
*
*
Sample for DocumentUnderstandingServiceClient:
- *
- *
*/
-@Generated("by gapic-generator")
+@Generated("by gapic-generator-java")
package com.google.cloud.documentai.v1beta1;
import javax.annotation.Generated;
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java
index e121fb0d..6058c17e 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta1.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
@@ -26,22 +26,19 @@
import com.google.longrunning.stub.OperationsStub;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * Base stub class for Cloud Document AI API.
+ * Base stub class for the DocumentUnderstandingService service API.
*
*
This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator")
-@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public abstract class DocumentUnderstandingServiceStub implements BackgroundResource {
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallable<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationCallable() {
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java
index c3becb3d..f0544ae9 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta1.stub;
import com.google.api.core.ApiFunction;
@@ -47,7 +48,7 @@
import javax.annotation.Generated;
import org.threeten.bp.Duration;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link DocumentUnderstandingServiceStub}.
*
@@ -62,24 +63,26 @@
*
The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
- *
For example, to set the total timeout of batchProcessDocumentsAsync to 30 seconds:
+ *
For example, to set the total timeout of batchProcessDocuments to 30 seconds:
*
- *
+ * DocumentUnderstandingServiceStubSettings documentUnderstandingServiceSettings =
+ * documentUnderstandingServiceSettingsBuilder.build();
+ * }
*/
-@Generated("by gapic-generator")
@BetaApi
+@Generated("by gapic-generator-java")
public class DocumentUnderstandingServiceStubSettings
extends StubSettings {
/** The default scopes of the service. */
@@ -99,7 +102,6 @@ public class DocumentUnderstandingServiceStubSettings
}
/** Returns the object with the settings used for calls to batchProcessDocuments. */
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationSettings() {
@@ -112,10 +114,10 @@ public DocumentUnderstandingServiceStub createStub() throws IOException {
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcDocumentUnderstandingServiceStub.create(this);
- } else {
- throw new UnsupportedOperationException(
- "Transport not supported: " + getTransportChannelProvider().getTransportName());
}
+ throw new UnsupportedOperationException(
+ String.format(
+ "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
}
/** Returns a builder for the default ExecutorProvider for this service. */
@@ -185,13 +187,11 @@ protected DocumentUnderstandingServiceStubSettings(Builder settingsBuilder) thro
public static class Builder
extends StubSettings.Builder {
private final ImmutableList> unaryMethodSettingsBuilders;
-
private final UnaryCallSettings.Builder
batchProcessDocumentsSettings;
private final OperationCallSettings.Builder<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationSettings;
-
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -199,11 +199,10 @@ public static class Builder
ImmutableMap.Builder> definitions =
ImmutableMap.builder();
definitions.put(
- "retry_policy_1_codes",
+ "retry_policy_0_codes",
ImmutableSet.copyOf(
Lists.newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
- definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -222,51 +221,60 @@ public static class Builder
.setMaxRpcTimeout(Duration.ofMillis(60000L))
.setTotalTimeout(Duration.ofMillis(60000L))
.build();
- definitions.put("retry_policy_1_params", settings);
- settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
- definitions.put("no_retry_params", settings);
+ definitions.put("retry_policy_0_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}
protected Builder() {
- this((ClientContext) null);
+ this(((ClientContext) null));
}
protected Builder(ClientContext clientContext) {
super(clientContext);
batchProcessDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
-
batchProcessDocumentsOperationSettings = OperationCallSettings.newBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(batchProcessDocumentsSettings);
-
initDefaults(this);
}
+ protected Builder(DocumentUnderstandingServiceStubSettings settings) {
+ super(settings);
+
+ batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder();
+ batchProcessDocumentsOperationSettings =
+ settings.batchProcessDocumentsOperationSettings.toBuilder();
+
+ unaryMethodSettingsBuilders =
+ ImmutableList.>of(batchProcessDocumentsSettings);
+ }
+
private static Builder createDefault() {
- Builder builder = new Builder((ClientContext) null);
+ Builder builder = new Builder(((ClientContext) null));
+
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
+
return initDefaults(builder);
}
private static Builder initDefaults(Builder builder) {
-
builder
.batchProcessDocumentsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
builder
.batchProcessDocumentsOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(
@@ -276,30 +284,19 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
- .setInitialRetryDelay(Duration.ofMillis(500L))
+ .setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
- .setMaxRetryDelay(Duration.ofMillis(5000L))
- .setInitialRpcTimeout(Duration.ZERO) // ignored
- .setRpcTimeoutMultiplier(1.0) // ignored
- .setMaxRpcTimeout(Duration.ZERO) // ignored
+ .setMaxRetryDelay(Duration.ofMillis(45000L))
+ .setInitialRpcTimeout(Duration.ZERO)
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
return builder;
}
- protected Builder(DocumentUnderstandingServiceStubSettings settings) {
- super(settings);
-
- batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder();
- batchProcessDocumentsOperationSettings =
- settings.batchProcessDocumentsOperationSettings.toBuilder();
-
- unaryMethodSettingsBuilders =
- ImmutableList.>of(batchProcessDocumentsSettings);
- }
-
- // NEXT_MAJOR_VER: remove 'throws Exception'
+ // NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java
index f66ebe91..4154cc07 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta1.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcCallableFactory;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
@@ -31,18 +31,19 @@
import com.google.api.gax.rpc.StreamingCallSettings;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * gRPC callable factory implementation for Cloud Document AI API.
+ * gRPC callable factory implementation for the DocumentUnderstandingService service API.
*
*
This class is for advanced usage.
*/
@Generated("by gapic-generator")
-@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public class GrpcDocumentUnderstandingServiceCallableFactory implements GrpcStubCallableFactory {
+
@Override
public UnaryCallable createUnaryCallable(
GrpcCallSettings grpcCallSettings,
@@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla
public
UnaryCallable createPagedCallable(
GrpcCallSettings grpcCallSettings,
- PagedCallSettings pagedCallSettings,
+ PagedCallSettings callSettings,
ClientContext clientContext) {
- return GrpcCallableFactory.createPagedCallable(
- grpcCallSettings, pagedCallSettings, clientContext);
+ return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext);
}
@Override
public UnaryCallable createBatchingCallable(
GrpcCallSettings grpcCallSettings,
- BatchingCallSettings batchingCallSettings,
+ BatchingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createBatchingCallable(
- grpcCallSettings, batchingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
@Override
public
OperationCallable createOperationCallable(
- GrpcCallSettings grpcCallSettings,
- OperationCallSettings operationCallSettings,
+ GrpcCallSettings grpcCallSettings,
+ OperationCallSettings callSettings,
ClientContext clientContext,
OperationsStub operationsStub) {
return GrpcCallableFactory.createOperationCallable(
- grpcCallSettings, operationCallSettings, clientContext, operationsStub);
+ grpcCallSettings, callSettings, clientContext, operationsStub);
}
@Override
public
BidiStreamingCallable createBidiStreamingCallable(
GrpcCallSettings grpcCallSettings,
- StreamingCallSettings streamingCallSettings,
+ StreamingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createBidiStreamingCallable(
- grpcCallSettings, streamingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
@Override
public
ServerStreamingCallable createServerStreamingCallable(
GrpcCallSettings grpcCallSettings,
- ServerStreamingCallSettings streamingCallSettings,
+ ServerStreamingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createServerStreamingCallable(
- grpcCallSettings, streamingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
@Override
public
ClientStreamingCallable createClientStreamingCallable(
GrpcCallSettings grpcCallSettings,
- StreamingCallSettings streamingCallSettings,
+ StreamingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createClientStreamingCallable(
- grpcCallSettings, streamingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
}
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java
index 63bc20b3..bdf8d23c 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta1.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
@@ -37,16 +37,14 @@
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * gRPC stub implementation for Cloud Document AI API.
+ * gRPC stub implementation for the DocumentUnderstandingService service API.
*
*
This class is for advanced usage and reflects the underlying API directly.
*/
-@Generated("by gapic-generator")
-@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+@Generated("by gapic-generator-java")
public class GrpcDocumentUnderstandingServiceStub extends DocumentUnderstandingServiceStub {
-
private static final MethodDescriptor
batchProcessDocumentsMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -58,15 +56,14 @@ public class GrpcDocumentUnderstandingServiceStub extends DocumentUnderstandingS
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
- private final BackgroundResource backgroundResources;
- private final GrpcOperationsStub operationsStub;
-
private final UnaryCallable
batchProcessDocumentsCallable;
private final OperationCallable<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationCallable;
+ private final BackgroundResource backgroundResources;
+ private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcDocumentUnderstandingServiceStub create(
@@ -137,27 +134,26 @@ public Map extract(BatchProcessDocumentsRequest request) {
batchProcessDocumentsTransportSettings,
settings.batchProcessDocumentsOperationSettings(),
clientContext,
- this.operationsStub);
+ operationsStub);
- backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public UnaryCallable batchProcessDocumentsCallable() {
+ return batchProcessDocumentsCallable;
+ }
+
public OperationCallable<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationCallable() {
return batchProcessDocumentsOperationCallable;
}
- public UnaryCallable batchProcessDocumentsCallable() {
- return batchProcessDocumentsCallable;
- }
-
@Override
public final void close() {
shutdown();
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClient.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClient.java
index 33dc230e..dea9646d 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClient.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClient.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta2;
import com.google.api.core.BetaApi;
@@ -29,7 +30,7 @@
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND SERVICE
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Service to parse structured information from unstructured or semi-structured
* documents using state-of-the-art Google AI such as natural language, computer vision, and
@@ -38,19 +39,7 @@
*
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:
*
- *
Note: close() needs to be called on the documentUnderstandingServiceClient object to clean up
+ *
Note: close() needs to be called on the DocumentUnderstandingServiceClient object to clean up
* resources such as threads. In the example above, try-with-resources is used, which automatically
* calls close().
*
@@ -79,30 +68,28 @@
*
*
Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
-@Generated("by gapic-generator")
@BetaApi
+@Generated("by gapic-generator")
public class DocumentUnderstandingServiceClient implements BackgroundResource {
private final DocumentUnderstandingServiceSettings settings;
private final DocumentUnderstandingServiceStub stub;
@@ -125,7 +112,7 @@ public static final DocumentUnderstandingServiceClient create(
/**
* Constructs an instance of DocumentUnderstandingServiceClient, using the given stub for making
- * calls. This is for advanced usage - prefer to use DocumentUnderstandingServiceSettings}.
+ * calls. This is for advanced usage - prefer using create(DocumentUnderstandingServiceSettings).
*/
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final DocumentUnderstandingServiceClient create(
@@ -166,31 +153,18 @@ public DocumentUnderstandingServiceStub getStub() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationsClient getOperationsClient() {
return operationsClient;
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
- *
- *
* @param requests Required. Individual requests for each document.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
batchProcessDocumentsAsync(List requests) {
BatchProcessDocumentsRequest request =
@@ -198,99 +172,48 @@ public final OperationsClient getOperationsClient() {
return batchProcessDocumentsAsync(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
- *
- *
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
batchProcessDocumentsAsync(BatchProcessDocumentsRequest request) {
return batchProcessDocumentsOperationCallable().futureCall(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
*
*/
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public final OperationCallable<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationCallable() {
return stub.batchProcessDocumentsOperationCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
*
*/
public final UnaryCallable
batchProcessDocumentsCallable() {
return stub.batchProcessDocumentsCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Processes a single document.
*
- *
- *
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -298,23 +221,11 @@ public final Document processDocument(ProcessDocumentRequest request) {
return processDocumentCallable().call(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Processes a single document.
*
*
*/
public final UnaryCallable processDocumentCallable() {
return stub.processDocumentCallable();
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceSettings.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceSettings.java
index fe466b58..ecf9a8ae 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceSettings.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceSettings.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta2;
import com.google.api.core.ApiFunction;
@@ -32,7 +33,7 @@
import java.util.List;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link DocumentUnderstandingServiceClient}.
*
@@ -49,24 +50,26 @@
*
*
For example, to set the total timeout of processDocument to 30 seconds:
*
- *
+ * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
+ * documentUnderstandingServiceSettingsBuilder.build();
+ * }
*/
-@Generated("by gapic-generator")
-@BetaApi
+@Generated("by gapic-generator-java")
public class DocumentUnderstandingServiceSettings
extends ClientSettings {
+
/** Returns the object with the settings used for calls to batchProcessDocuments. */
public UnaryCallSettings
batchProcessDocumentsSettings() {
@@ -75,8 +78,6 @@ public class DocumentUnderstandingServiceSettings
}
/** Returns the object with the settings used for calls to batchProcessDocuments. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationSettings() {
@@ -150,18 +151,15 @@ protected DocumentUnderstandingServiceSettings(Builder settingsBuilder) throws I
/** Builder for DocumentUnderstandingServiceSettings. */
public static class Builder
extends ClientSettings.Builder {
+
protected Builder() throws IOException {
- this((ClientContext) null);
+ this(((ClientContext) null));
}
protected Builder(ClientContext clientContext) {
super(DocumentUnderstandingServiceStubSettings.newBuilder(clientContext));
}
- private static Builder createDefault() {
- return new Builder(DocumentUnderstandingServiceStubSettings.newBuilder());
- }
-
protected Builder(DocumentUnderstandingServiceSettings settings) {
super(settings.getStubSettings().toBuilder());
}
@@ -170,11 +168,15 @@ protected Builder(DocumentUnderstandingServiceStubSettings.Builder stubSettings)
super(stubSettings);
}
+ private static Builder createDefault() {
+ return new Builder(DocumentUnderstandingServiceStubSettings.newBuilder());
+ }
+
public DocumentUnderstandingServiceStubSettings.Builder getStubSettingsBuilder() {
return ((DocumentUnderstandingServiceStubSettings.Builder) getStubSettings());
}
- // NEXT_MAJOR_VER: remove 'throws Exception'
+ // NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
@@ -194,8 +196,6 @@ public Builder applyToAllUnaryMethods(
}
/** Returns the builder for the settings used for calls to batchProcessDocuments. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationSettings() {
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/package-info.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/package-info.java
index 07963129..4284f8dc 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/package-info.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/package-info.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,32 +15,17 @@
*/
/**
- * A client to Cloud Document AI API.
+ * The interfaces provided are listed below, along with usage samples.
*
- *
The interfaces provided are listed below, along with usage samples.
- *
- *
Service Description: Service to parse structured information from unstructured or
* semi-structured documents using state-of-the-art Google AI such as natural language, computer
* vision, and translation.
*
*
Sample for DocumentUnderstandingServiceClient:
- *
- *
*/
-@Generated("by gapic-generator")
+@Generated("by gapic-generator-java")
package com.google.cloud.documentai.v1beta2;
import javax.annotation.Generated;
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStub.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStub.java
index 5d3928b5..8f62eb5a 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStub.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStub.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta2.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
@@ -28,22 +28,19 @@
import com.google.longrunning.stub.OperationsStub;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * Base stub class for Cloud Document AI API.
+ * Base stub class for the DocumentUnderstandingService service API.
*
*
This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator")
-@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public abstract class DocumentUnderstandingServiceStub implements BackgroundResource {
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallable<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationCallable() {
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStubSettings.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStubSettings.java
index 1922073f..ffa878c3 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStubSettings.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStubSettings.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta2.stub;
import com.google.api.core.ApiFunction;
@@ -49,7 +50,7 @@
import javax.annotation.Generated;
import org.threeten.bp.Duration;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link DocumentUnderstandingServiceStub}.
*
@@ -66,22 +67,24 @@
*
*
For example, to set the total timeout of processDocument to 30 seconds:
*
- *
+ * DocumentUnderstandingServiceStubSettings documentUnderstandingServiceSettings =
+ * documentUnderstandingServiceSettingsBuilder.build();
+ * }
*/
-@Generated("by gapic-generator")
@BetaApi
+@Generated("by gapic-generator-java")
public class DocumentUnderstandingServiceStubSettings
extends StubSettings {
/** The default scopes of the service. */
@@ -102,7 +105,6 @@ public class DocumentUnderstandingServiceStubSettings
}
/** Returns the object with the settings used for calls to batchProcessDocuments. */
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationSettings() {
@@ -120,10 +122,10 @@ public DocumentUnderstandingServiceStub createStub() throws IOException {
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcDocumentUnderstandingServiceStub.create(this);
- } else {
- throw new UnsupportedOperationException(
- "Transport not supported: " + getTransportChannelProvider().getTransportName());
}
+ throw new UnsupportedOperationException(
+ String.format(
+ "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
}
/** Returns a builder for the default ExecutorProvider for this service. */
@@ -194,7 +196,6 @@ protected DocumentUnderstandingServiceStubSettings(Builder settingsBuilder) thro
public static class Builder
extends StubSettings.Builder {
private final ImmutableList> unaryMethodSettingsBuilders;
-
private final UnaryCallSettings.Builder
batchProcessDocumentsSettings;
private final OperationCallSettings.Builder<
@@ -202,7 +203,6 @@ public static class Builder
batchProcessDocumentsOperationSettings;
private final UnaryCallSettings.Builder
processDocumentSettings;
-
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -210,11 +210,10 @@ public static class Builder
ImmutableMap.Builder> definitions =
ImmutableMap.builder();
definitions.put(
- "retry_policy_1_codes",
+ "retry_policy_0_codes",
ImmutableSet.copyOf(
Lists.newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
- definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -233,59 +232,69 @@ public static class Builder
.setMaxRpcTimeout(Duration.ofMillis(120000L))
.setTotalTimeout(Duration.ofMillis(120000L))
.build();
- definitions.put("retry_policy_1_params", settings);
- settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
- definitions.put("no_retry_params", settings);
+ definitions.put("retry_policy_0_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}
protected Builder() {
- this((ClientContext) null);
+ this(((ClientContext) null));
}
protected Builder(ClientContext clientContext) {
super(clientContext);
batchProcessDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
-
batchProcessDocumentsOperationSettings = OperationCallSettings.newBuilder();
-
processDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
batchProcessDocumentsSettings, processDocumentSettings);
-
initDefaults(this);
}
+ protected Builder(DocumentUnderstandingServiceStubSettings settings) {
+ super(settings);
+
+ batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder();
+ batchProcessDocumentsOperationSettings =
+ settings.batchProcessDocumentsOperationSettings.toBuilder();
+ processDocumentSettings = settings.processDocumentSettings.toBuilder();
+
+ unaryMethodSettingsBuilders =
+ ImmutableList.>of(
+ batchProcessDocumentsSettings, processDocumentSettings);
+ }
+
private static Builder createDefault() {
- Builder builder = new Builder((ClientContext) null);
+ Builder builder = new Builder(((ClientContext) null));
+
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
+
return initDefaults(builder);
}
private static Builder initDefaults(Builder builder) {
-
builder
.batchProcessDocumentsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.processDocumentSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
builder
.batchProcessDocumentsOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(
@@ -295,32 +304,19 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
- .setInitialRetryDelay(Duration.ofMillis(500L))
+ .setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
- .setMaxRetryDelay(Duration.ofMillis(5000L))
- .setInitialRpcTimeout(Duration.ZERO) // ignored
- .setRpcTimeoutMultiplier(1.0) // ignored
- .setMaxRpcTimeout(Duration.ZERO) // ignored
+ .setMaxRetryDelay(Duration.ofMillis(45000L))
+ .setInitialRpcTimeout(Duration.ZERO)
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
return builder;
}
- protected Builder(DocumentUnderstandingServiceStubSettings settings) {
- super(settings);
-
- batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder();
- batchProcessDocumentsOperationSettings =
- settings.batchProcessDocumentsOperationSettings.toBuilder();
- processDocumentSettings = settings.processDocumentSettings.toBuilder();
-
- unaryMethodSettingsBuilders =
- ImmutableList.>of(
- batchProcessDocumentsSettings, processDocumentSettings);
- }
-
- // NEXT_MAJOR_VER: remove 'throws Exception'
+ // NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceCallableFactory.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceCallableFactory.java
index 6ea0b58a..19aa1f5f 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceCallableFactory.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceCallableFactory.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta2.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcCallableFactory;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
@@ -31,18 +31,19 @@
import com.google.api.gax.rpc.StreamingCallSettings;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * gRPC callable factory implementation for Cloud Document AI API.
+ * gRPC callable factory implementation for the DocumentUnderstandingService service API.
*
*
This class is for advanced usage.
*/
@Generated("by gapic-generator")
-@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public class GrpcDocumentUnderstandingServiceCallableFactory implements GrpcStubCallableFactory {
+
@Override
public UnaryCallable createUnaryCallable(
GrpcCallSettings grpcCallSettings,
@@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla
public
UnaryCallable createPagedCallable(
GrpcCallSettings grpcCallSettings,
- PagedCallSettings pagedCallSettings,
+ PagedCallSettings callSettings,
ClientContext clientContext) {
- return GrpcCallableFactory.createPagedCallable(
- grpcCallSettings, pagedCallSettings, clientContext);
+ return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext);
}
@Override
public UnaryCallable createBatchingCallable(
GrpcCallSettings grpcCallSettings,
- BatchingCallSettings batchingCallSettings,
+ BatchingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createBatchingCallable(
- grpcCallSettings, batchingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
@Override
public
OperationCallable createOperationCallable(
- GrpcCallSettings grpcCallSettings,
- OperationCallSettings operationCallSettings,
+ GrpcCallSettings grpcCallSettings,
+ OperationCallSettings callSettings,
ClientContext clientContext,
OperationsStub operationsStub) {
return GrpcCallableFactory.createOperationCallable(
- grpcCallSettings, operationCallSettings, clientContext, operationsStub);
+ grpcCallSettings, callSettings, clientContext, operationsStub);
}
@Override
public
BidiStreamingCallable createBidiStreamingCallable(
GrpcCallSettings grpcCallSettings,
- StreamingCallSettings streamingCallSettings,
+ StreamingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createBidiStreamingCallable(
- grpcCallSettings, streamingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
@Override
public
ServerStreamingCallable createServerStreamingCallable(
GrpcCallSettings grpcCallSettings,
- ServerStreamingCallSettings streamingCallSettings,
+ ServerStreamingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createServerStreamingCallable(
- grpcCallSettings, streamingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
@Override
public
ClientStreamingCallable createClientStreamingCallable(
GrpcCallSettings grpcCallSettings,
- StreamingCallSettings streamingCallSettings,
+ StreamingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createClientStreamingCallable(
- grpcCallSettings, streamingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
}
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceStub.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceStub.java
index 39430b8c..84be5044 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceStub.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceStub.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta2.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
@@ -39,16 +39,14 @@
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * gRPC stub implementation for Cloud Document AI API.
+ * gRPC stub implementation for the DocumentUnderstandingService service API.
*
*
This class is for advanced usage and reflects the underlying API directly.
*/
-@Generated("by gapic-generator")
-@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+@Generated("by gapic-generator-java")
public class GrpcDocumentUnderstandingServiceStub extends DocumentUnderstandingServiceStub {
-
private static final MethodDescriptor
batchProcessDocumentsMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -59,6 +57,7 @@ public class GrpcDocumentUnderstandingServiceStub extends DocumentUnderstandingS
ProtoUtils.marshaller(BatchProcessDocumentsRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
+
private static final MethodDescriptor
processDocumentMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -70,9 +69,6 @@ public class GrpcDocumentUnderstandingServiceStub extends DocumentUnderstandingS
.setResponseMarshaller(ProtoUtils.marshaller(Document.getDefaultInstance()))
.build();
- private final BackgroundResource backgroundResources;
- private final GrpcOperationsStub operationsStub;
-
private final UnaryCallable
batchProcessDocumentsCallable;
private final OperationCallable<
@@ -80,6 +76,8 @@ public class GrpcDocumentUnderstandingServiceStub extends DocumentUnderstandingS
batchProcessDocumentsOperationCallable;
private final UnaryCallable processDocumentCallable;
+ private final BackgroundResource backgroundResources;
+ private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcDocumentUnderstandingServiceStub create(
@@ -163,30 +161,29 @@ public Map extract(ProcessDocumentRequest request) {
batchProcessDocumentsTransportSettings,
settings.batchProcessDocumentsOperationSettings(),
clientContext,
- this.operationsStub);
+ operationsStub);
this.processDocumentCallable =
callableFactory.createUnaryCallable(
processDocumentTransportSettings, settings.processDocumentSettings(), clientContext);
- backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public UnaryCallable batchProcessDocumentsCallable() {
+ return batchProcessDocumentsCallable;
+ }
+
public OperationCallable<
BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata>
batchProcessDocumentsOperationCallable() {
return batchProcessDocumentsOperationCallable;
}
- public UnaryCallable batchProcessDocumentsCallable() {
- return batchProcessDocumentsCallable;
- }
-
public UnaryCallable processDocumentCallable() {
return processDocumentCallable;
}
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java
index 5715eb78..b8be53b9 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta3;
import com.google.api.core.BetaApi;
@@ -28,7 +29,7 @@
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND SERVICE
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Service to call Cloud DocumentAI to process documents according to the
* processor's definition. Processors are built using state-of-the-art Google AI such as natural
@@ -38,16 +39,7 @@
*
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:
*
- *
Note: close() needs to be called on the documentProcessorServiceClient object to clean up
+ *
Note: close() needs to be called on the DocumentProcessorServiceClient object to clean up
* resources such as threads. In the example above, try-with-resources is used, which automatically
* calls close().
*
@@ -76,30 +68,28 @@
*
*
Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
-@Generated("by gapic-generator")
@BetaApi
+@Generated("by gapic-generator")
public class DocumentProcessorServiceClient implements BackgroundResource {
private final DocumentProcessorServiceSettings settings;
private final DocumentProcessorServiceStub stub;
@@ -122,7 +112,7 @@ public static final DocumentProcessorServiceClient create(
/**
* Constructs an instance of DocumentProcessorServiceClient, using the given stub for making
- * calls. This is for advanced usage - prefer to use DocumentProcessorServiceSettings}.
+ * calls. This is for advanced usage - prefer using create(DocumentProcessorServiceSettings).
*/
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final DocumentProcessorServiceClient create(DocumentProcessorServiceStub stub) {
@@ -161,25 +151,14 @@ public DocumentProcessorServiceStub getStub() {
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationsClient getOperationsClient() {
return operationsClient;
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Processes a single document.
*
- *
- *
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -233,47 +191,24 @@ public final ProcessResponse processDocument(ProcessRequest request) {
return processDocumentCallable().call(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Processes a single document.
*
*
*/
public final UnaryCallable processDocumentCallable() {
return stub.processDocumentCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
- *
- *
* @param name Required. The processor resource name.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
batchProcessDocumentsAsync(ProcessorName name) {
BatchProcessRequest request =
@@ -281,126 +216,65 @@ public final UnaryCallable processDocumentCalla
return batchProcessDocumentsAsync(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
- *
- *
* @param name Required. The processor resource name.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
batchProcessDocumentsAsync(String name) {
BatchProcessRequest request = BatchProcessRequest.newBuilder().setName(name).build();
return batchProcessDocumentsAsync(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
- *
- *
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
batchProcessDocumentsAsync(BatchProcessRequest request) {
return batchProcessDocumentsOperationCallable().futureCall(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
*
*/
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public final OperationCallable
batchProcessDocumentsOperationCallable() {
return stub.batchProcessDocumentsOperationCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in
* the [Document] format.
*
*
*/
public final UnaryCallable batchProcessDocumentsCallable() {
return stub.batchProcessDocumentsCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Send a document for Human Review. The input document should be processed by the specified
* processor.
*
- *
- *
* @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document
* will be reviewed with.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
reviewDocumentAsync(HumanReviewConfigName humanReviewConfig) {
ReviewDocumentRequest request =
@@ -410,26 +284,15 @@ public final UnaryCallable batchProcessDocuments
return reviewDocumentAsync(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Send a document for Human Review. The input document should be processed by the specified
* processor.
*
- *
- *
* @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document
* will be reviewed with.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
reviewDocumentAsync(String humanReviewConfig) {
ReviewDocumentRequest request =
@@ -437,77 +300,38 @@ public final UnaryCallable batchProcessDocuments
return reviewDocumentAsync(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Send a document for Human Review. The input document should be processed by the specified
* processor.
*
- *
- *
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture
reviewDocumentAsync(ReviewDocumentRequest request) {
return reviewDocumentOperationCallable().futureCall(request);
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Send a document for Human Review. The input document should be processed by the specified
* processor.
*
*
*/
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public final OperationCallable<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationCallable() {
return stub.reviewDocumentOperationCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Send a document for Human Review. The input document should be processed by the specified
* processor.
*
*
*/
public final UnaryCallable reviewDocumentCallable() {
return stub.reviewDocumentCallable();
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java
index 0a65f139..1c5cedf7 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta3;
import com.google.api.core.ApiFunction;
@@ -32,7 +33,7 @@
import java.util.List;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link DocumentProcessorServiceClient}.
*
@@ -49,24 +50,26 @@
*
*
For example, to set the total timeout of processDocument to 30 seconds:
*
- *
+ * DocumentProcessorServiceSettings documentProcessorServiceSettings =
+ * documentProcessorServiceSettingsBuilder.build();
+ * }
*/
-@Generated("by gapic-generator")
-@BetaApi
+@Generated("by gapic-generator-java")
public class DocumentProcessorServiceSettings
extends ClientSettings {
+
/** Returns the object with the settings used for calls to processDocument. */
public UnaryCallSettings processDocumentSettings() {
return ((DocumentProcessorServiceStubSettings) getStubSettings()).processDocumentSettings();
@@ -79,8 +82,6 @@ public UnaryCallSettings batchProcessDocumentsSe
}
/** Returns the object with the settings used for calls to batchProcessDocuments. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings
batchProcessDocumentsOperationSettings() {
return ((DocumentProcessorServiceStubSettings) getStubSettings())
@@ -93,8 +94,6 @@ public UnaryCallSettings reviewDocumentSetting
}
/** Returns the object with the settings used for calls to reviewDocument. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationSettings() {
@@ -163,18 +162,15 @@ protected DocumentProcessorServiceSettings(Builder settingsBuilder) throws IOExc
/** Builder for DocumentProcessorServiceSettings. */
public static class Builder
extends ClientSettings.Builder {
+
protected Builder() throws IOException {
- this((ClientContext) null);
+ this(((ClientContext) null));
}
protected Builder(ClientContext clientContext) {
super(DocumentProcessorServiceStubSettings.newBuilder(clientContext));
}
- private static Builder createDefault() {
- return new Builder(DocumentProcessorServiceStubSettings.newBuilder());
- }
-
protected Builder(DocumentProcessorServiceSettings settings) {
super(settings.getStubSettings().toBuilder());
}
@@ -183,11 +179,15 @@ protected Builder(DocumentProcessorServiceStubSettings.Builder stubSettings) {
super(stubSettings);
}
+ private static Builder createDefault() {
+ return new Builder(DocumentProcessorServiceStubSettings.newBuilder());
+ }
+
public DocumentProcessorServiceStubSettings.Builder getStubSettingsBuilder() {
return ((DocumentProcessorServiceStubSettings.Builder) getStubSettings());
}
- // NEXT_MAJOR_VER: remove 'throws Exception'
+ // NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
@@ -212,8 +212,6 @@ public UnaryCallSettings.Builder processDocumen
}
/** Returns the builder for the settings used for calls to batchProcessDocuments. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
BatchProcessRequest, BatchProcessResponse, BatchProcessMetadata>
batchProcessDocumentsOperationSettings() {
@@ -226,8 +224,6 @@ public UnaryCallSettings.Builder reviewDocumen
}
/** Returns the builder for the settings used for calls to reviewDocument. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationSettings() {
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java
index 62aab8d1..99ba0a34 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,11 +15,9 @@
*/
/**
- * A client to Cloud Document AI API.
+ * The interfaces provided are listed below, along with usage samples.
*
- *
The interfaces provided are listed below, along with usage samples.
- *
- *
Service Description: Service to call Cloud DocumentAI to process documents according to the
* processor's definition. Processors are built using state-of-the-art Google AI such as natural
@@ -27,17 +25,8 @@
* semi-structured documents.
*
*
Sample for DocumentProcessorServiceClient:
- *
- *
*/
-@Generated("by gapic-generator")
+@Generated("by gapic-generator-java")
package com.google.cloud.documentai.v1beta3;
import javax.annotation.Generated;
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java
index a408e717..dd9423b0 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta3.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
@@ -31,17 +31,15 @@
import com.google.longrunning.stub.OperationsStub;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * Base stub class for Cloud Document AI API.
+ * Base stub class for the DocumentProcessorService service API.
*
*
This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator")
-@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public abstract class DocumentProcessorServiceStub implements BackgroundResource {
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
}
@@ -50,7 +48,6 @@ public UnaryCallable processDocumentCallable()
throw new UnsupportedOperationException("Not implemented: processDocumentCallable()");
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallable
batchProcessDocumentsOperationCallable() {
throw new UnsupportedOperationException(
@@ -61,7 +58,6 @@ public UnaryCallable batchProcessDocumentsCallab
throw new UnsupportedOperationException("Not implemented: batchProcessDocumentsCallable()");
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallable<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationCallable() {
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java
index acab2af4..b7b2814d 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta3.stub;
import com.google.api.core.ApiFunction;
@@ -52,7 +53,7 @@
import javax.annotation.Generated;
import org.threeten.bp.Duration;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link DocumentProcessorServiceStub}.
*
@@ -69,22 +70,24 @@
*
*
For example, to set the total timeout of processDocument to 30 seconds:
*
- *
+ * DocumentProcessorServiceStubSettings documentProcessorServiceSettings =
+ * documentProcessorServiceSettingsBuilder.build();
+ * }
*/
-@Generated("by gapic-generator")
@BetaApi
+@Generated("by gapic-generator-java")
public class DocumentProcessorServiceStubSettings
extends StubSettings {
/** The default scopes of the service. */
@@ -112,7 +115,6 @@ public UnaryCallSettings batchProcessDocumentsSe
}
/** Returns the object with the settings used for calls to batchProcessDocuments. */
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings
batchProcessDocumentsOperationSettings() {
return batchProcessDocumentsOperationSettings;
@@ -124,7 +126,6 @@ public UnaryCallSettings reviewDocumentSetting
}
/** Returns the object with the settings used for calls to reviewDocument. */
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationSettings() {
@@ -137,10 +138,10 @@ public DocumentProcessorServiceStub createStub() throws IOException {
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcDocumentProcessorServiceStub.create(this);
- } else {
- throw new UnsupportedOperationException(
- "Transport not supported: " + getTransportChannelProvider().getTransportName());
}
+ throw new UnsupportedOperationException(
+ String.format(
+ "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
}
/** Returns a builder for the default ExecutorProvider for this service. */
@@ -212,7 +213,6 @@ protected DocumentProcessorServiceStubSettings(Builder settingsBuilder) throws I
public static class Builder
extends StubSettings.Builder {
private final ImmutableList> unaryMethodSettingsBuilders;
-
private final UnaryCallSettings.Builder
processDocumentSettings;
private final UnaryCallSettings.Builder
@@ -225,7 +225,6 @@ public static class Builder
private final OperationCallSettings.Builder<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationSettings;
-
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -233,11 +232,10 @@ public static class Builder
ImmutableMap.Builder> definitions =
ImmutableMap.builder();
definitions.put(
- "retry_policy_1_codes",
+ "retry_policy_0_codes",
ImmutableSet.copyOf(
Lists.newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
- definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -256,68 +254,78 @@ public static class Builder
.setMaxRpcTimeout(Duration.ofMillis(120000L))
.setTotalTimeout(Duration.ofMillis(120000L))
.build();
- definitions.put("retry_policy_1_params", settings);
- settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
- definitions.put("no_retry_params", settings);
+ definitions.put("retry_policy_0_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}
protected Builder() {
- this((ClientContext) null);
+ this(((ClientContext) null));
}
protected Builder(ClientContext clientContext) {
super(clientContext);
processDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
-
batchProcessDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
-
batchProcessDocumentsOperationSettings = OperationCallSettings.newBuilder();
-
reviewDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
-
reviewDocumentOperationSettings = OperationCallSettings.newBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
processDocumentSettings, batchProcessDocumentsSettings, reviewDocumentSettings);
-
initDefaults(this);
}
+ protected Builder(DocumentProcessorServiceStubSettings settings) {
+ super(settings);
+
+ processDocumentSettings = settings.processDocumentSettings.toBuilder();
+ batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder();
+ batchProcessDocumentsOperationSettings =
+ settings.batchProcessDocumentsOperationSettings.toBuilder();
+ reviewDocumentSettings = settings.reviewDocumentSettings.toBuilder();
+ reviewDocumentOperationSettings = settings.reviewDocumentOperationSettings.toBuilder();
+
+ unaryMethodSettingsBuilders =
+ ImmutableList.>of(
+ processDocumentSettings, batchProcessDocumentsSettings, reviewDocumentSettings);
+ }
+
private static Builder createDefault() {
- Builder builder = new Builder((ClientContext) null);
+ Builder builder = new Builder(((ClientContext) null));
+
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
+
return initDefaults(builder);
}
private static Builder initDefaults(Builder builder) {
-
builder
.processDocumentSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.batchProcessDocumentsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.reviewDocumentSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
builder
.batchProcessDocumentsOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(BatchProcessResponse.class))
@@ -326,21 +334,22 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
- .setInitialRetryDelay(Duration.ofMillis(500L))
+ .setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
- .setMaxRetryDelay(Duration.ofMillis(5000L))
- .setInitialRpcTimeout(Duration.ZERO) // ignored
- .setRpcTimeoutMultiplier(1.0) // ignored
- .setMaxRpcTimeout(Duration.ZERO) // ignored
+ .setMaxRetryDelay(Duration.ofMillis(45000L))
+ .setInitialRpcTimeout(Duration.ZERO)
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
+
builder
.reviewDocumentOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(ReviewDocumentResponse.class))
@@ -350,34 +359,19 @@ private static Builder initDefaults(Builder builder) {
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
- .setInitialRetryDelay(Duration.ofMillis(500L))
+ .setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
- .setMaxRetryDelay(Duration.ofMillis(5000L))
- .setInitialRpcTimeout(Duration.ZERO) // ignored
- .setRpcTimeoutMultiplier(1.0) // ignored
- .setMaxRpcTimeout(Duration.ZERO) // ignored
+ .setMaxRetryDelay(Duration.ofMillis(45000L))
+ .setInitialRpcTimeout(Duration.ZERO)
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
return builder;
}
- protected Builder(DocumentProcessorServiceStubSettings settings) {
- super(settings);
-
- processDocumentSettings = settings.processDocumentSettings.toBuilder();
- batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder();
- batchProcessDocumentsOperationSettings =
- settings.batchProcessDocumentsOperationSettings.toBuilder();
- reviewDocumentSettings = settings.reviewDocumentSettings.toBuilder();
- reviewDocumentOperationSettings = settings.reviewDocumentOperationSettings.toBuilder();
-
- unaryMethodSettingsBuilders =
- ImmutableList.>of(
- processDocumentSettings, batchProcessDocumentsSettings, reviewDocumentSettings);
- }
-
- // NEXT_MAJOR_VER: remove 'throws Exception'
+ // NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceCallableFactory.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceCallableFactory.java
index 17df0bd9..4ad757da 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceCallableFactory.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceCallableFactory.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta3.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcCallableFactory;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
@@ -31,18 +31,19 @@
import com.google.api.gax.rpc.StreamingCallSettings;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * gRPC callable factory implementation for Cloud Document AI API.
+ * gRPC callable factory implementation for the DocumentProcessorService service API.
*
*
This class is for advanced usage.
*/
@Generated("by gapic-generator")
-@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public class GrpcDocumentProcessorServiceCallableFactory implements GrpcStubCallableFactory {
+
@Override
public UnaryCallable createUnaryCallable(
GrpcCallSettings grpcCallSettings,
@@ -55,61 +56,58 @@ public UnaryCallable createUnaryCalla
public
UnaryCallable createPagedCallable(
GrpcCallSettings grpcCallSettings,
- PagedCallSettings pagedCallSettings,
+ PagedCallSettings callSettings,
ClientContext clientContext) {
- return GrpcCallableFactory.createPagedCallable(
- grpcCallSettings, pagedCallSettings, clientContext);
+ return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext);
}
@Override
public UnaryCallable createBatchingCallable(
GrpcCallSettings grpcCallSettings,
- BatchingCallSettings batchingCallSettings,
+ BatchingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createBatchingCallable(
- grpcCallSettings, batchingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
@Override
public
OperationCallable createOperationCallable(
- GrpcCallSettings grpcCallSettings,
- OperationCallSettings operationCallSettings,
+ GrpcCallSettings grpcCallSettings,
+ OperationCallSettings callSettings,
ClientContext clientContext,
OperationsStub operationsStub) {
return GrpcCallableFactory.createOperationCallable(
- grpcCallSettings, operationCallSettings, clientContext, operationsStub);
+ grpcCallSettings, callSettings, clientContext, operationsStub);
}
@Override
public
BidiStreamingCallable createBidiStreamingCallable(
GrpcCallSettings grpcCallSettings,
- StreamingCallSettings streamingCallSettings,
+ StreamingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createBidiStreamingCallable(
- grpcCallSettings, streamingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
@Override
public
ServerStreamingCallable createServerStreamingCallable(
GrpcCallSettings grpcCallSettings,
- ServerStreamingCallSettings streamingCallSettings,
+ ServerStreamingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createServerStreamingCallable(
- grpcCallSettings, streamingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
@Override
public
ClientStreamingCallable createClientStreamingCallable(
GrpcCallSettings grpcCallSettings,
- StreamingCallSettings streamingCallSettings,
+ StreamingCallSettings callSettings,
ClientContext clientContext) {
return GrpcCallableFactory.createClientStreamingCallable(
- grpcCallSettings, streamingCallSettings, clientContext);
+ grpcCallSettings, callSettings, clientContext);
}
}
diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java
index e73f292b..fc5760c7 100644
--- a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java
+++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta3.stub;
-import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
@@ -42,16 +42,14 @@
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
-// AUTO-GENERATED DOCUMENTATION AND CLASS
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * gRPC stub implementation for Cloud Document AI API.
+ * gRPC stub implementation for the DocumentProcessorService service API.
*
*
This class is for advanced usage and reflects the underlying API directly.
*/
-@Generated("by gapic-generator")
-@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+@Generated("by gapic-generator-java")
public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceStub {
-
private static final MethodDescriptor
processDocumentMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -61,6 +59,7 @@ public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceSt
.setRequestMarshaller(ProtoUtils.marshaller(ProcessRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(ProcessResponse.getDefaultInstance()))
.build();
+
private static final MethodDescriptor
batchProcessDocumentsMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -70,6 +69,7 @@ public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceSt
.setRequestMarshaller(ProtoUtils.marshaller(BatchProcessRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
+
private static final MethodDescriptor
reviewDocumentMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -81,9 +81,6 @@ public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceSt
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
- private final BackgroundResource backgroundResources;
- private final GrpcOperationsStub operationsStub;
-
private final UnaryCallable processDocumentCallable;
private final UnaryCallable batchProcessDocumentsCallable;
private final OperationCallable
@@ -93,6 +90,8 @@ public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceSt
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationCallable;
+ private final BackgroundResource backgroundResources;
+ private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcDocumentProcessorServiceStub create(
@@ -190,7 +189,7 @@ public Map extract(ReviewDocumentRequest request) {
batchProcessDocumentsTransportSettings,
settings.batchProcessDocumentsOperationSettings(),
clientContext,
- this.operationsStub);
+ operationsStub);
this.reviewDocumentCallable =
callableFactory.createUnaryCallable(
reviewDocumentTransportSettings, settings.reviewDocumentSettings(), clientContext);
@@ -199,12 +198,12 @@ public Map extract(ReviewDocumentRequest request) {
reviewDocumentTransportSettings,
settings.reviewDocumentOperationSettings(),
clientContext,
- this.operationsStub);
+ operationsStub);
- backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
@@ -213,27 +212,25 @@ public UnaryCallable processDocumentCallable()
return processDocumentCallable;
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public UnaryCallable batchProcessDocumentsCallable() {
+ return batchProcessDocumentsCallable;
+ }
+
public OperationCallable
batchProcessDocumentsOperationCallable() {
return batchProcessDocumentsOperationCallable;
}
- public UnaryCallable batchProcessDocumentsCallable() {
- return batchProcessDocumentsCallable;
+ public UnaryCallable reviewDocumentCallable() {
+ return reviewDocumentCallable;
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallable<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationCallable() {
return reviewDocumentOperationCallable;
}
- public UnaryCallable reviewDocumentCallable() {
- return reviewDocumentCallable;
- }
-
@Override
public final void close() {
shutdown();
diff --git a/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java
index 0ff114e1..dfbcf46f 100644
--- a/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java
+++ b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta1;
import com.google.api.gax.core.NoCredentialsProvider;
@@ -26,7 +27,6 @@
import com.google.longrunning.Operation;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Any;
-import io.grpc.Status;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.ArrayList;
@@ -34,6 +34,7 @@
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
+import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -41,32 +42,32 @@
import org.junit.BeforeClass;
import org.junit.Test;
-@javax.annotation.Generated("by GAPIC")
+@Generated("by gapic-generator-java")
public class DocumentUnderstandingServiceClientTest {
private static MockDocumentUnderstandingService mockDocumentUnderstandingService;
- private static MockServiceHelper serviceHelper;
+ private static MockServiceHelper mockServiceHelper;
private DocumentUnderstandingServiceClient client;
private LocalChannelProvider channelProvider;
@BeforeClass
public static void startStaticServer() {
mockDocumentUnderstandingService = new MockDocumentUnderstandingService();
- serviceHelper =
+ mockServiceHelper =
new MockServiceHelper(
UUID.randomUUID().toString(),
Arrays.asList(mockDocumentUnderstandingService));
- serviceHelper.start();
+ mockServiceHelper.start();
}
@AfterClass
public static void stopServer() {
- serviceHelper.stop();
+ mockServiceHelper.stop();
}
@Before
public void setUp() throws IOException {
- serviceHelper.reset();
- channelProvider = serviceHelper.createChannelProvider();
+ mockServiceHelper.reset();
+ channelProvider = mockServiceHelper.createChannelProvider();
DocumentUnderstandingServiceSettings settings =
DocumentUnderstandingServiceSettings.newBuilder()
.setTransportChannelProvider(channelProvider)
@@ -81,10 +82,11 @@ public void tearDown() throws Exception {
}
@Test
- @SuppressWarnings("all")
public void batchProcessDocumentsTest() throws Exception {
BatchProcessDocumentsResponse expectedResponse =
- BatchProcessDocumentsResponse.newBuilder().build();
+ BatchProcessDocumentsResponse.newBuilder()
+ .addAllResponses(new ArrayList())
+ .build();
Operation resultOperation =
Operation.newBuilder()
.setName("batchProcessDocumentsTest")
@@ -102,7 +104,7 @@ public void batchProcessDocumentsTest() throws Exception {
List actualRequests = mockDocumentUnderstandingService.getRequests();
Assert.assertEquals(1, actualRequests.size());
BatchProcessDocumentsRequest actualRequest =
- (BatchProcessDocumentsRequest) actualRequests.get(0);
+ ((BatchProcessDocumentsRequest) actualRequests.get(0));
Assert.assertEquals(requests, actualRequest.getRequestsList());
Assert.assertTrue(
@@ -112,19 +114,17 @@ public void batchProcessDocumentsTest() throws Exception {
}
@Test
- @SuppressWarnings("all")
public void batchProcessDocumentsExceptionTest() throws Exception {
- StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDocumentUnderstandingService.addException(exception);
try {
List requests = new ArrayList<>();
-
client.batchProcessDocumentsAsync(requests).get();
Assert.fail("No exception raised");
} catch (ExecutionException e) {
Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
- InvalidArgumentException apiException = (InvalidArgumentException) e.getCause();
+ InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
}
}
diff --git a/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java
index e9856c7d..7fc82f09 100644
--- a/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java
+++ b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta1;
import com.google.api.core.BetaApi;
@@ -20,9 +21,10 @@
import com.google.protobuf.AbstractMessage;
import io.grpc.ServerServiceDefinition;
import java.util.List;
+import javax.annotation.Generated;
-@javax.annotation.Generated("by GAPIC")
@BetaApi
+@Generated("by gapic-generator-java")
public class MockDocumentUnderstandingService implements MockGrpcService {
private final MockDocumentUnderstandingServiceImpl serviceImpl;
diff --git a/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java
index a41b118b..47c62133 100644
--- a/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java
+++ b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * https://www.apache.org/licenses/LICENSE-2.0
+ * https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.documentai.v1beta1;
import com.google.api.core.BetaApi;
@@ -24,9 +25,10 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
+import javax.annotation.Generated;
-@javax.annotation.Generated("by GAPIC")
@BetaApi
+@Generated("by gapic-generator-java")
public class MockDocumentUnderstandingServiceImpl extends DocumentUnderstandingServiceImplBase {
private List requests;
private Queue