+ evaluateProcessorVersionCallable() {
+ return stub.evaluateProcessorVersionCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves a specific evaluation.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient =
+ * DocumentProcessorServiceClient.create()) {
+ * EvaluationName name =
+ * EvaluationName.of(
+ * "[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]", "[EVALUATION]");
+ * Evaluation response = documentProcessorServiceClient.getEvaluation(name);
+ * }
+ * }
+ *
+ * @param name Required. The resource name of the
+ * [Evaluation][google.cloud.documentai.v1beta3.Evaluation] to get.
+ * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Evaluation getEvaluation(EvaluationName name) {
+ GetEvaluationRequest request =
+ GetEvaluationRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getEvaluation(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves a specific evaluation.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient =
+ * DocumentProcessorServiceClient.create()) {
+ * String name =
+ * EvaluationName.of(
+ * "[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]", "[EVALUATION]")
+ * .toString();
+ * Evaluation response = documentProcessorServiceClient.getEvaluation(name);
+ * }
+ * }
+ *
+ * @param name Required. The resource name of the
+ * [Evaluation][google.cloud.documentai.v1beta3.Evaluation] to get.
+ * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Evaluation getEvaluation(String name) {
+ GetEvaluationRequest request = GetEvaluationRequest.newBuilder().setName(name).build();
+ return getEvaluation(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves a specific evaluation.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient =
+ * DocumentProcessorServiceClient.create()) {
+ * GetEvaluationRequest request =
+ * GetEvaluationRequest.newBuilder()
+ * .setName(
+ * EvaluationName.of(
+ * "[PROJECT]",
+ * "[LOCATION]",
+ * "[PROCESSOR]",
+ * "[PROCESSOR_VERSION]",
+ * "[EVALUATION]")
+ * .toString())
+ * .build();
+ * Evaluation response = documentProcessorServiceClient.getEvaluation(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Evaluation getEvaluation(GetEvaluationRequest request) {
+ return getEvaluationCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves a specific evaluation.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient =
+ * DocumentProcessorServiceClient.create()) {
+ * GetEvaluationRequest request =
+ * GetEvaluationRequest.newBuilder()
+ * .setName(
+ * EvaluationName.of(
+ * "[PROJECT]",
+ * "[LOCATION]",
+ * "[PROCESSOR]",
+ * "[PROCESSOR_VERSION]",
+ * "[EVALUATION]")
+ * .toString())
+ * .build();
+ * ApiFuture future =
+ * documentProcessorServiceClient.getEvaluationCallable().futureCall(request);
+ * // Do something.
+ * Evaluation response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getEvaluationCallable() {
+ return stub.getEvaluationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves a set of evaluations for a given processor version.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient =
+ * DocumentProcessorServiceClient.create()) {
+ * ProcessorVersionName parent =
+ * ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]");
+ * for (Evaluation element :
+ * documentProcessorServiceClient.listEvaluations(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the
+ * [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion] to list evaluations
+ * for.
+ * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEvaluationsPagedResponse listEvaluations(ProcessorVersionName parent) {
+ ListEvaluationsRequest request =
+ ListEvaluationsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listEvaluations(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves a set of evaluations for a given processor version.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient =
+ * DocumentProcessorServiceClient.create()) {
+ * String parent =
+ * ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]")
+ * .toString();
+ * for (Evaluation element :
+ * documentProcessorServiceClient.listEvaluations(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The resource name of the
+ * [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion] to list evaluations
+ * for.
+ * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEvaluationsPagedResponse listEvaluations(String parent) {
+ ListEvaluationsRequest request = ListEvaluationsRequest.newBuilder().setParent(parent).build();
+ return listEvaluations(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves a set of evaluations for a given processor version.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient =
+ * DocumentProcessorServiceClient.create()) {
+ * ListEvaluationsRequest request =
+ * ListEvaluationsRequest.newBuilder()
+ * .setParent(
+ * ProcessorVersionName.of(
+ * "[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]")
+ * .toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (Evaluation element :
+ * documentProcessorServiceClient.listEvaluations(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListEvaluationsPagedResponse listEvaluations(ListEvaluationsRequest request) {
+ return listEvaluationsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves a set of evaluations for a given processor version.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient =
+ * DocumentProcessorServiceClient.create()) {
+ * ListEvaluationsRequest request =
+ * ListEvaluationsRequest.newBuilder()
+ * .setParent(
+ * ProcessorVersionName.of(
+ * "[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]")
+ * .toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future =
+ * documentProcessorServiceClient.listEvaluationsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Evaluation element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listEvaluationsPagedCallable() {
+ return stub.listEvaluationsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves a set of evaluations for a given processor version.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient =
+ * DocumentProcessorServiceClient.create()) {
+ * ListEvaluationsRequest request =
+ * ListEvaluationsRequest.newBuilder()
+ * .setParent(
+ * ProcessorVersionName.of(
+ * "[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]")
+ * .toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListEvaluationsResponse response =
+ * documentProcessorServiceClient.listEvaluationsCallable().call(request);
+ * for (Evaluation element : response.getEvaluationsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listEvaluationsCallable() {
+ return stub.listEvaluationsCallable();
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
@@ -3116,6 +3810,83 @@ protected ListProcessorVersionsFixedSizeCollection createCollection(
}
}
+ public static class ListEvaluationsPagedResponse
+ extends AbstractPagedListResponse<
+ ListEvaluationsRequest,
+ ListEvaluationsResponse,
+ Evaluation,
+ ListEvaluationsPage,
+ ListEvaluationsFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListEvaluationsPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ input -> new ListEvaluationsPagedResponse(input),
+ MoreExecutors.directExecutor());
+ }
+
+ private ListEvaluationsPagedResponse(ListEvaluationsPage page) {
+ super(page, ListEvaluationsFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListEvaluationsPage
+ extends AbstractPage<
+ ListEvaluationsRequest, ListEvaluationsResponse, Evaluation, ListEvaluationsPage> {
+
+ private ListEvaluationsPage(
+ PageContext context,
+ ListEvaluationsResponse response) {
+ super(context, response);
+ }
+
+ private static ListEvaluationsPage createEmptyPage() {
+ return new ListEvaluationsPage(null, null);
+ }
+
+ @Override
+ protected ListEvaluationsPage createPage(
+ PageContext context,
+ ListEvaluationsResponse response) {
+ return new ListEvaluationsPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListEvaluationsFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListEvaluationsRequest,
+ ListEvaluationsResponse,
+ Evaluation,
+ ListEvaluationsPage,
+ ListEvaluationsFixedSizeCollection> {
+
+ private ListEvaluationsFixedSizeCollection(
+ List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListEvaluationsFixedSizeCollection createEmptyCollection() {
+ return new ListEvaluationsFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListEvaluationsFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListEvaluationsFixedSizeCollection(pages, collectionSize);
+ }
+ }
+
public static class ListLocationsPagedResponse
extends AbstractPagedListResponse<
ListLocationsRequest,
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java
index 02d5311a19d1..ff65daeb83a0 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java
@@ -16,6 +16,7 @@
package com.google.cloud.documentai.v1beta3;
+import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListEvaluationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorTypesPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorVersionsPagedResponse;
@@ -131,6 +132,23 @@ public UnaryCallSettings getProcessorSettings()
return ((DocumentProcessorServiceStubSettings) getStubSettings()).getProcessorSettings();
}
+ /** Returns the object with the settings used for calls to trainProcessorVersion. */
+ public UnaryCallSettings
+ trainProcessorVersionSettings() {
+ return ((DocumentProcessorServiceStubSettings) getStubSettings())
+ .trainProcessorVersionSettings();
+ }
+
+ /** Returns the object with the settings used for calls to trainProcessorVersion. */
+ public OperationCallSettings<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationSettings() {
+ return ((DocumentProcessorServiceStubSettings) getStubSettings())
+ .trainProcessorVersionOperationSettings();
+ }
+
/** Returns the object with the settings used for calls to getProcessorVersion. */
public UnaryCallSettings
getProcessorVersionSettings() {
@@ -268,6 +286,35 @@ public UnaryCallSettings reviewDocumentSetting
.reviewDocumentOperationSettings();
}
+ /** Returns the object with the settings used for calls to evaluateProcessorVersion. */
+ public UnaryCallSettings
+ evaluateProcessorVersionSettings() {
+ return ((DocumentProcessorServiceStubSettings) getStubSettings())
+ .evaluateProcessorVersionSettings();
+ }
+
+ /** Returns the object with the settings used for calls to evaluateProcessorVersion. */
+ public OperationCallSettings<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationSettings() {
+ return ((DocumentProcessorServiceStubSettings) getStubSettings())
+ .evaluateProcessorVersionOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to getEvaluation. */
+ public UnaryCallSettings getEvaluationSettings() {
+ return ((DocumentProcessorServiceStubSettings) getStubSettings()).getEvaluationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listEvaluations. */
+ public PagedCallSettings<
+ ListEvaluationsRequest, ListEvaluationsResponse, ListEvaluationsPagedResponse>
+ listEvaluationsSettings() {
+ return ((DocumentProcessorServiceStubSettings) getStubSettings()).listEvaluationsSettings();
+ }
+
/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings
listLocationsSettings() {
@@ -438,6 +485,21 @@ public UnaryCallSettings.Builder getProcessorSet
return getStubSettingsBuilder().getProcessorSettings();
}
+ /** Returns the builder for the settings used for calls to trainProcessorVersion. */
+ public UnaryCallSettings.Builder
+ trainProcessorVersionSettings() {
+ return getStubSettingsBuilder().trainProcessorVersionSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to trainProcessorVersion. */
+ public OperationCallSettings.Builder<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationSettings() {
+ return getStubSettingsBuilder().trainProcessorVersionOperationSettings();
+ }
+
/** Returns the builder for the settings used for calls to getProcessorVersion. */
public UnaryCallSettings.Builder
getProcessorVersionSettings() {
@@ -564,6 +626,33 @@ public UnaryCallSettings.Builder reviewDocumen
return getStubSettingsBuilder().reviewDocumentOperationSettings();
}
+ /** Returns the builder for the settings used for calls to evaluateProcessorVersion. */
+ public UnaryCallSettings.Builder
+ evaluateProcessorVersionSettings() {
+ return getStubSettingsBuilder().evaluateProcessorVersionSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to evaluateProcessorVersion. */
+ public OperationCallSettings.Builder<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationSettings() {
+ return getStubSettingsBuilder().evaluateProcessorVersionOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to getEvaluation. */
+ public UnaryCallSettings.Builder getEvaluationSettings() {
+ return getStubSettingsBuilder().getEvaluationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listEvaluations. */
+ public PagedCallSettings.Builder<
+ ListEvaluationsRequest, ListEvaluationsResponse, ListEvaluationsPagedResponse>
+ listEvaluationsSettings() {
+ return getStubSettingsBuilder().listEvaluationsSettings();
+ }
+
/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/gapic_metadata.json b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/gapic_metadata.json
index 1fb9b4c89758..a40984a91cc2 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/gapic_metadata.json
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/gapic_metadata.json
@@ -31,9 +31,15 @@
"EnableProcessor": {
"methods": ["enableProcessorAsync", "enableProcessorOperationCallable", "enableProcessorCallable"]
},
+ "EvaluateProcessorVersion": {
+ "methods": ["evaluateProcessorVersionAsync", "evaluateProcessorVersionAsync", "evaluateProcessorVersionAsync", "evaluateProcessorVersionOperationCallable", "evaluateProcessorVersionCallable"]
+ },
"FetchProcessorTypes": {
"methods": ["fetchProcessorTypes", "fetchProcessorTypes", "fetchProcessorTypes", "fetchProcessorTypesCallable"]
},
+ "GetEvaluation": {
+ "methods": ["getEvaluation", "getEvaluation", "getEvaluation", "getEvaluationCallable"]
+ },
"GetLocation": {
"methods": ["getLocation", "getLocationCallable"]
},
@@ -43,6 +49,9 @@
"GetProcessorVersion": {
"methods": ["getProcessorVersion", "getProcessorVersion", "getProcessorVersion", "getProcessorVersionCallable"]
},
+ "ListEvaluations": {
+ "methods": ["listEvaluations", "listEvaluations", "listEvaluations", "listEvaluationsPagedCallable", "listEvaluationsCallable"]
+ },
"ListLocations": {
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
},
@@ -64,6 +73,9 @@
"SetDefaultProcessorVersion": {
"methods": ["setDefaultProcessorVersionAsync", "setDefaultProcessorVersionOperationCallable", "setDefaultProcessorVersionCallable"]
},
+ "TrainProcessorVersion": {
+ "methods": ["trainProcessorVersionAsync", "trainProcessorVersionAsync", "trainProcessorVersionAsync", "trainProcessorVersionOperationCallable", "trainProcessorVersionCallable"]
+ },
"UndeployProcessorVersion": {
"methods": ["undeployProcessorVersionAsync", "undeployProcessorVersionAsync", "undeployProcessorVersionAsync", "undeployProcessorVersionOperationCallable", "undeployProcessorVersionCallable"]
}
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java
index bed484470b6e..b1c2e67cd9f3 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java
@@ -16,6 +16,7 @@
package com.google.cloud.documentai.v1beta3.stub;
+import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListEvaluationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorTypesPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorVersionsPagedResponse;
@@ -42,10 +43,17 @@
import com.google.cloud.documentai.v1beta3.EnableProcessorMetadata;
import com.google.cloud.documentai.v1beta3.EnableProcessorRequest;
import com.google.cloud.documentai.v1beta3.EnableProcessorResponse;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse;
+import com.google.cloud.documentai.v1beta3.Evaluation;
import com.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest;
import com.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse;
+import com.google.cloud.documentai.v1beta3.GetEvaluationRequest;
import com.google.cloud.documentai.v1beta3.GetProcessorRequest;
import com.google.cloud.documentai.v1beta3.GetProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.ListEvaluationsRequest;
+import com.google.cloud.documentai.v1beta3.ListEvaluationsResponse;
import com.google.cloud.documentai.v1beta3.ListProcessorTypesRequest;
import com.google.cloud.documentai.v1beta3.ListProcessorTypesResponse;
import com.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest;
@@ -62,6 +70,9 @@
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata;
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest;
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse;
@@ -134,6 +145,19 @@ public UnaryCallable getProcessorCallable() {
throw new UnsupportedOperationException("Not implemented: getProcessorCallable()");
}
+ public OperationCallable<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationCallable() {
+ throw new UnsupportedOperationException(
+ "Not implemented: trainProcessorVersionOperationCallable()");
+ }
+
+ public UnaryCallable trainProcessorVersionCallable() {
+ throw new UnsupportedOperationException("Not implemented: trainProcessorVersionCallable()");
+ }
+
public UnaryCallable getProcessorVersionCallable() {
throw new UnsupportedOperationException("Not implemented: getProcessorVersionCallable()");
}
@@ -243,6 +267,33 @@ public UnaryCallable reviewDocumentCallable()
throw new UnsupportedOperationException("Not implemented: reviewDocumentCallable()");
}
+ public OperationCallable<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationCallable() {
+ throw new UnsupportedOperationException(
+ "Not implemented: evaluateProcessorVersionOperationCallable()");
+ }
+
+ public UnaryCallable
+ evaluateProcessorVersionCallable() {
+ throw new UnsupportedOperationException("Not implemented: evaluateProcessorVersionCallable()");
+ }
+
+ public UnaryCallable getEvaluationCallable() {
+ throw new UnsupportedOperationException("Not implemented: getEvaluationCallable()");
+ }
+
+ public UnaryCallable
+ listEvaluationsPagedCallable() {
+ throw new UnsupportedOperationException("Not implemented: listEvaluationsPagedCallable()");
+ }
+
+ public UnaryCallable listEvaluationsCallable() {
+ throw new UnsupportedOperationException("Not implemented: listEvaluationsCallable()");
+ }
+
public UnaryCallable
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java
index 7b16e6f3400d..7a57bde05454 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java
@@ -16,6 +16,7 @@
package com.google.cloud.documentai.v1beta3.stub;
+import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListEvaluationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorTypesPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorVersionsPagedResponse;
@@ -67,10 +68,17 @@
import com.google.cloud.documentai.v1beta3.EnableProcessorMetadata;
import com.google.cloud.documentai.v1beta3.EnableProcessorRequest;
import com.google.cloud.documentai.v1beta3.EnableProcessorResponse;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse;
+import com.google.cloud.documentai.v1beta3.Evaluation;
import com.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest;
import com.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse;
+import com.google.cloud.documentai.v1beta3.GetEvaluationRequest;
import com.google.cloud.documentai.v1beta3.GetProcessorRequest;
import com.google.cloud.documentai.v1beta3.GetProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.ListEvaluationsRequest;
+import com.google.cloud.documentai.v1beta3.ListEvaluationsResponse;
import com.google.cloud.documentai.v1beta3.ListProcessorTypesRequest;
import com.google.cloud.documentai.v1beta3.ListProcessorTypesResponse;
import com.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest;
@@ -88,6 +96,9 @@
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata;
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest;
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse;
@@ -166,6 +177,13 @@ public class DocumentProcessorServiceStubSettings
ListProcessorsRequest, ListProcessorsResponse, ListProcessorsPagedResponse>
listProcessorsSettings;
private final UnaryCallSettings getProcessorSettings;
+ private final UnaryCallSettings
+ trainProcessorVersionSettings;
+ private final OperationCallSettings<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationSettings;
private final UnaryCallSettings
getProcessorVersionSettings;
private final PagedCallSettings<
@@ -215,6 +233,17 @@ public class DocumentProcessorServiceStubSettings
private final OperationCallSettings<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationSettings;
+ private final UnaryCallSettings
+ evaluateProcessorVersionSettings;
+ private final OperationCallSettings<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationSettings;
+ private final UnaryCallSettings getEvaluationSettings;
+ private final PagedCallSettings<
+ ListEvaluationsRequest, ListEvaluationsResponse, ListEvaluationsPagedResponse>
+ listEvaluationsSettings;
private final PagedCallSettings<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
@@ -338,6 +367,45 @@ public Iterable extractResources(
}
};
+ private static final PagedListDescriptor<
+ ListEvaluationsRequest, ListEvaluationsResponse, Evaluation>
+ LIST_EVALUATIONS_PAGE_STR_DESC =
+ new PagedListDescriptor() {
+ @Override
+ public String emptyToken() {
+ return "";
+ }
+
+ @Override
+ public ListEvaluationsRequest injectToken(
+ ListEvaluationsRequest payload, String token) {
+ return ListEvaluationsRequest.newBuilder(payload).setPageToken(token).build();
+ }
+
+ @Override
+ public ListEvaluationsRequest injectPageSize(
+ ListEvaluationsRequest payload, int pageSize) {
+ return ListEvaluationsRequest.newBuilder(payload).setPageSize(pageSize).build();
+ }
+
+ @Override
+ public Integer extractPageSize(ListEvaluationsRequest payload) {
+ return payload.getPageSize();
+ }
+
+ @Override
+ public String extractNextToken(ListEvaluationsResponse payload) {
+ return payload.getNextPageToken();
+ }
+
+ @Override
+ public Iterable extractResources(ListEvaluationsResponse payload) {
+ return payload.getEvaluationsList() == null
+ ? ImmutableList.of()
+ : payload.getEvaluationsList();
+ }
+ };
+
private static final PagedListDescriptor
LIST_LOCATIONS_PAGE_STR_DESC =
new PagedListDescriptor() {
@@ -436,6 +504,23 @@ public ApiFuture getFuturePagedResponse(
}
};
+ private static final PagedListResponseFactory<
+ ListEvaluationsRequest, ListEvaluationsResponse, ListEvaluationsPagedResponse>
+ LIST_EVALUATIONS_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListEvaluationsRequest, ListEvaluationsResponse, ListEvaluationsPagedResponse>() {
+ @Override
+ public ApiFuture getFuturePagedResponse(
+ UnaryCallable callable,
+ ListEvaluationsRequest request,
+ ApiCallContext context,
+ ApiFuture futureResponse) {
+ PageContext pageContext =
+ PageContext.create(callable, LIST_EVALUATIONS_PAGE_STR_DESC, request, context);
+ return ListEvaluationsPagedResponse.createAsync(pageContext, futureResponse);
+ }
+ };
+
private static final PagedListResponseFactory<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
LIST_LOCATIONS_PAGE_STR_FACT =
@@ -494,6 +579,21 @@ public UnaryCallSettings getProcessorSettings()
return getProcessorSettings;
}
+ /** Returns the object with the settings used for calls to trainProcessorVersion. */
+ public UnaryCallSettings
+ trainProcessorVersionSettings() {
+ return trainProcessorVersionSettings;
+ }
+
+ /** Returns the object with the settings used for calls to trainProcessorVersion. */
+ public OperationCallSettings<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationSettings() {
+ return trainProcessorVersionOperationSettings;
+ }
+
/** Returns the object with the settings used for calls to getProcessorVersion. */
public UnaryCallSettings
getProcessorVersionSettings() {
@@ -618,6 +718,33 @@ public UnaryCallSettings reviewDocumentSetting
return reviewDocumentOperationSettings;
}
+ /** Returns the object with the settings used for calls to evaluateProcessorVersion. */
+ public UnaryCallSettings
+ evaluateProcessorVersionSettings() {
+ return evaluateProcessorVersionSettings;
+ }
+
+ /** Returns the object with the settings used for calls to evaluateProcessorVersion. */
+ public OperationCallSettings<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationSettings() {
+ return evaluateProcessorVersionOperationSettings;
+ }
+
+ /** Returns the object with the settings used for calls to getEvaluation. */
+ public UnaryCallSettings getEvaluationSettings() {
+ return getEvaluationSettings;
+ }
+
+ /** Returns the object with the settings used for calls to listEvaluations. */
+ public PagedCallSettings<
+ ListEvaluationsRequest, ListEvaluationsResponse, ListEvaluationsPagedResponse>
+ listEvaluationsSettings() {
+ return listEvaluationsSettings;
+ }
+
/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings
listLocationsSettings() {
@@ -743,6 +870,9 @@ protected DocumentProcessorServiceStubSettings(Builder settingsBuilder) throws I
listProcessorTypesSettings = settingsBuilder.listProcessorTypesSettings().build();
listProcessorsSettings = settingsBuilder.listProcessorsSettings().build();
getProcessorSettings = settingsBuilder.getProcessorSettings().build();
+ trainProcessorVersionSettings = settingsBuilder.trainProcessorVersionSettings().build();
+ trainProcessorVersionOperationSettings =
+ settingsBuilder.trainProcessorVersionOperationSettings().build();
getProcessorVersionSettings = settingsBuilder.getProcessorVersionSettings().build();
listProcessorVersionsSettings = settingsBuilder.listProcessorVersionsSettings().build();
deleteProcessorVersionSettings = settingsBuilder.deleteProcessorVersionSettings().build();
@@ -767,6 +897,11 @@ protected DocumentProcessorServiceStubSettings(Builder settingsBuilder) throws I
settingsBuilder.setDefaultProcessorVersionOperationSettings().build();
reviewDocumentSettings = settingsBuilder.reviewDocumentSettings().build();
reviewDocumentOperationSettings = settingsBuilder.reviewDocumentOperationSettings().build();
+ evaluateProcessorVersionSettings = settingsBuilder.evaluateProcessorVersionSettings().build();
+ evaluateProcessorVersionOperationSettings =
+ settingsBuilder.evaluateProcessorVersionOperationSettings().build();
+ getEvaluationSettings = settingsBuilder.getEvaluationSettings().build();
+ listEvaluationsSettings = settingsBuilder.listEvaluationsSettings().build();
listLocationsSettings = settingsBuilder.listLocationsSettings().build();
getLocationSettings = settingsBuilder.getLocationSettings().build();
}
@@ -791,6 +926,13 @@ public static class Builder
ListProcessorsRequest, ListProcessorsResponse, ListProcessorsPagedResponse>
listProcessorsSettings;
private final UnaryCallSettings.Builder getProcessorSettings;
+ private final UnaryCallSettings.Builder
+ trainProcessorVersionSettings;
+ private final OperationCallSettings.Builder<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationSettings;
private final UnaryCallSettings.Builder
getProcessorVersionSettings;
private final PagedCallSettings.Builder<
@@ -846,6 +988,17 @@ public static class Builder
private final OperationCallSettings.Builder<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationSettings;
+ private final UnaryCallSettings.Builder
+ evaluateProcessorVersionSettings;
+ private final OperationCallSettings.Builder<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationSettings;
+ private final UnaryCallSettings.Builder getEvaluationSettings;
+ private final PagedCallSettings.Builder<
+ ListEvaluationsRequest, ListEvaluationsResponse, ListEvaluationsPagedResponse>
+ listEvaluationsSettings;
private final PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
@@ -900,6 +1053,8 @@ protected Builder(ClientContext clientContext) {
listProcessorTypesSettings = PagedCallSettings.newBuilder(LIST_PROCESSOR_TYPES_PAGE_STR_FACT);
listProcessorsSettings = PagedCallSettings.newBuilder(LIST_PROCESSORS_PAGE_STR_FACT);
getProcessorSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ trainProcessorVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ trainProcessorVersionOperationSettings = OperationCallSettings.newBuilder();
getProcessorVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listProcessorVersionsSettings =
PagedCallSettings.newBuilder(LIST_PROCESSOR_VERSIONS_PAGE_STR_FACT);
@@ -920,6 +1075,10 @@ protected Builder(ClientContext clientContext) {
setDefaultProcessorVersionOperationSettings = OperationCallSettings.newBuilder();
reviewDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
reviewDocumentOperationSettings = OperationCallSettings.newBuilder();
+ evaluateProcessorVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ evaluateProcessorVersionOperationSettings = OperationCallSettings.newBuilder();
+ getEvaluationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ listEvaluationsSettings = PagedCallSettings.newBuilder(LIST_EVALUATIONS_PAGE_STR_FACT);
listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
@@ -931,6 +1090,7 @@ protected Builder(ClientContext clientContext) {
listProcessorTypesSettings,
listProcessorsSettings,
getProcessorSettings,
+ trainProcessorVersionSettings,
getProcessorVersionSettings,
listProcessorVersionsSettings,
deleteProcessorVersionSettings,
@@ -942,6 +1102,9 @@ protected Builder(ClientContext clientContext) {
disableProcessorSettings,
setDefaultProcessorVersionSettings,
reviewDocumentSettings,
+ evaluateProcessorVersionSettings,
+ getEvaluationSettings,
+ listEvaluationsSettings,
listLocationsSettings,
getLocationSettings);
initDefaults(this);
@@ -958,6 +1121,9 @@ protected Builder(DocumentProcessorServiceStubSettings settings) {
listProcessorTypesSettings = settings.listProcessorTypesSettings.toBuilder();
listProcessorsSettings = settings.listProcessorsSettings.toBuilder();
getProcessorSettings = settings.getProcessorSettings.toBuilder();
+ trainProcessorVersionSettings = settings.trainProcessorVersionSettings.toBuilder();
+ trainProcessorVersionOperationSettings =
+ settings.trainProcessorVersionOperationSettings.toBuilder();
getProcessorVersionSettings = settings.getProcessorVersionSettings.toBuilder();
listProcessorVersionsSettings = settings.listProcessorVersionsSettings.toBuilder();
deleteProcessorVersionSettings = settings.deleteProcessorVersionSettings.toBuilder();
@@ -981,6 +1147,11 @@ protected Builder(DocumentProcessorServiceStubSettings settings) {
settings.setDefaultProcessorVersionOperationSettings.toBuilder();
reviewDocumentSettings = settings.reviewDocumentSettings.toBuilder();
reviewDocumentOperationSettings = settings.reviewDocumentOperationSettings.toBuilder();
+ evaluateProcessorVersionSettings = settings.evaluateProcessorVersionSettings.toBuilder();
+ evaluateProcessorVersionOperationSettings =
+ settings.evaluateProcessorVersionOperationSettings.toBuilder();
+ getEvaluationSettings = settings.getEvaluationSettings.toBuilder();
+ listEvaluationsSettings = settings.listEvaluationsSettings.toBuilder();
listLocationsSettings = settings.listLocationsSettings.toBuilder();
getLocationSettings = settings.getLocationSettings.toBuilder();
@@ -992,6 +1163,7 @@ protected Builder(DocumentProcessorServiceStubSettings settings) {
listProcessorTypesSettings,
listProcessorsSettings,
getProcessorSettings,
+ trainProcessorVersionSettings,
getProcessorVersionSettings,
listProcessorVersionsSettings,
deleteProcessorVersionSettings,
@@ -1003,6 +1175,9 @@ protected Builder(DocumentProcessorServiceStubSettings settings) {
disableProcessorSettings,
setDefaultProcessorVersionSettings,
reviewDocumentSettings,
+ evaluateProcessorVersionSettings,
+ getEvaluationSettings,
+ listEvaluationsSettings,
listLocationsSettings,
getLocationSettings);
}
@@ -1064,6 +1239,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+ builder
+ .trainProcessorVersionSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
builder
.getProcessorVersionSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
@@ -1119,6 +1299,21 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+ builder
+ .evaluateProcessorVersionSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
+ builder
+ .getEvaluationSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
+ builder
+ .listEvaluationsSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
builder
.listLocationsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
@@ -1153,6 +1348,32 @@ private static Builder initDefaults(Builder builder) {
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
+ builder
+ .trainProcessorVersionOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings
+ .newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(
+ TrainProcessorVersionResponse.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(
+ TrainProcessorVersionMetadata.class))
+ .setPollingAlgorithm(
+ OperationTimedPollAlgorithm.create(
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(5000L))
+ .setRetryDelayMultiplier(1.5)
+ .setMaxRetryDelay(Duration.ofMillis(45000L))
+ .setInitialRpcTimeout(Duration.ZERO)
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ZERO)
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build()));
+
builder
.deleteProcessorVersionOperationSettings()
.setInitialCallSettings(
@@ -1354,6 +1575,32 @@ private static Builder initDefaults(Builder builder) {
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
+ builder
+ .evaluateProcessorVersionOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings
+ .newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(
+ EvaluateProcessorVersionResponse.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(
+ EvaluateProcessorVersionMetadata.class))
+ .setPollingAlgorithm(
+ OperationTimedPollAlgorithm.create(
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(5000L))
+ .setRetryDelayMultiplier(1.5)
+ .setMaxRetryDelay(Duration.ofMillis(45000L))
+ .setInitialRpcTimeout(Duration.ZERO)
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ZERO)
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build()));
+
return builder;
}
@@ -1417,6 +1664,23 @@ public UnaryCallSettings.Builder getProcessorSet
return getProcessorSettings;
}
+ /** Returns the builder for the settings used for calls to trainProcessorVersion. */
+ public UnaryCallSettings.Builder
+ trainProcessorVersionSettings() {
+ return trainProcessorVersionSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to trainProcessorVersion. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationSettings() {
+ return trainProcessorVersionOperationSettings;
+ }
+
/** Returns the builder for the settings used for calls to getProcessorVersion. */
public UnaryCallSettings.Builder
getProcessorVersionSettings() {
@@ -1559,6 +1823,35 @@ public UnaryCallSettings.Builder reviewDocumen
return reviewDocumentOperationSettings;
}
+ /** Returns the builder for the settings used for calls to evaluateProcessorVersion. */
+ public UnaryCallSettings.Builder
+ evaluateProcessorVersionSettings() {
+ return evaluateProcessorVersionSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to evaluateProcessorVersion. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationSettings() {
+ return evaluateProcessorVersionOperationSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to getEvaluation. */
+ public UnaryCallSettings.Builder getEvaluationSettings() {
+ return getEvaluationSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to listEvaluations. */
+ public PagedCallSettings.Builder<
+ ListEvaluationsRequest, ListEvaluationsResponse, ListEvaluationsPagedResponse>
+ listEvaluationsSettings() {
+ return listEvaluationsSettings;
+ }
+
/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java
index 8ff51cc980fa..81867eda9194 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java
@@ -16,6 +16,7 @@
package com.google.cloud.documentai.v1beta3.stub;
+import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListEvaluationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorTypesPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorVersionsPagedResponse;
@@ -46,10 +47,17 @@
import com.google.cloud.documentai.v1beta3.EnableProcessorMetadata;
import com.google.cloud.documentai.v1beta3.EnableProcessorRequest;
import com.google.cloud.documentai.v1beta3.EnableProcessorResponse;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse;
+import com.google.cloud.documentai.v1beta3.Evaluation;
import com.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest;
import com.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse;
+import com.google.cloud.documentai.v1beta3.GetEvaluationRequest;
import com.google.cloud.documentai.v1beta3.GetProcessorRequest;
import com.google.cloud.documentai.v1beta3.GetProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.ListEvaluationsRequest;
+import com.google.cloud.documentai.v1beta3.ListEvaluationsResponse;
import com.google.cloud.documentai.v1beta3.ListProcessorTypesRequest;
import com.google.cloud.documentai.v1beta3.ListProcessorTypesResponse;
import com.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest;
@@ -66,6 +74,9 @@
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata;
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest;
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse;
@@ -158,6 +169,17 @@ public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceSt
.setResponseMarshaller(ProtoUtils.marshaller(Processor.getDefaultInstance()))
.build();
+ private static final MethodDescriptor
+ trainProcessorVersionMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentProcessorService/TrainProcessorVersion")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(TrainProcessorVersionRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
+ .build();
+
private static final MethodDescriptor
getProcessorVersionMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -280,6 +302,40 @@ public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceSt
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
+ private static final MethodDescriptor
+ evaluateProcessorVersionMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentProcessorService/EvaluateProcessorVersion")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(EvaluateProcessorVersionRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ getEvaluationMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentProcessorService/GetEvaluation")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(GetEvaluationRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Evaluation.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ listEvaluationsMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentProcessorService/ListEvaluations")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(ListEvaluationsRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(ListEvaluationsResponse.getDefaultInstance()))
+ .build();
+
private static final MethodDescriptor
listLocationsMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -313,6 +369,13 @@ public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceSt
private final UnaryCallable
listProcessorsPagedCallable;
private final UnaryCallable getProcessorCallable;
+ private final UnaryCallable
+ trainProcessorVersionCallable;
+ private final OperationCallable<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationCallable;
private final UnaryCallable
getProcessorVersionCallable;
private final UnaryCallable
@@ -361,6 +424,18 @@ public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceSt
private final OperationCallable<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationCallable;
+ private final UnaryCallable
+ evaluateProcessorVersionCallable;
+ private final OperationCallable<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationCallable;
+ private final UnaryCallable getEvaluationCallable;
+ private final UnaryCallable
+ listEvaluationsCallable;
+ private final UnaryCallable
+ listEvaluationsPagedCallable;
private final UnaryCallable listLocationsCallable;
private final UnaryCallable
listLocationsPagedCallable;
@@ -474,6 +549,17 @@ protected GrpcDocumentProcessorServiceStub(
return params.build();
})
.build();
+ GrpcCallSettings
+ trainProcessorVersionTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(trainProcessorVersionMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("parent", String.valueOf(request.getParent()));
+ return params.build();
+ })
+ .build();
GrpcCallSettings
getProcessorVersionTransportSettings =
GrpcCallSettings.newBuilder()
@@ -591,6 +677,39 @@ protected GrpcDocumentProcessorServiceStub(
return params.build();
})
.build();
+ GrpcCallSettings
+ evaluateProcessorVersionTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(evaluateProcessorVersionMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put(
+ "processor_version", String.valueOf(request.getProcessorVersion()));
+ return params.build();
+ })
+ .build();
+ GrpcCallSettings getEvaluationTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(getEvaluationMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("name", String.valueOf(request.getName()));
+ return params.build();
+ })
+ .build();
+ GrpcCallSettings
+ listEvaluationsTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(listEvaluationsMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ ImmutableMap.Builder params = ImmutableMap.builder();
+ params.put("parent", String.valueOf(request.getParent()));
+ return params.build();
+ })
+ .build();
GrpcCallSettings listLocationsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listLocationsMethodDescriptor)
@@ -650,6 +769,17 @@ protected GrpcDocumentProcessorServiceStub(
this.getProcessorCallable =
callableFactory.createUnaryCallable(
getProcessorTransportSettings, settings.getProcessorSettings(), clientContext);
+ this.trainProcessorVersionCallable =
+ callableFactory.createUnaryCallable(
+ trainProcessorVersionTransportSettings,
+ settings.trainProcessorVersionSettings(),
+ clientContext);
+ this.trainProcessorVersionOperationCallable =
+ callableFactory.createOperationCallable(
+ trainProcessorVersionTransportSettings,
+ settings.trainProcessorVersionOperationSettings(),
+ clientContext,
+ operationsStub);
this.getProcessorVersionCallable =
callableFactory.createUnaryCallable(
getProcessorVersionTransportSettings,
@@ -748,6 +878,26 @@ protected GrpcDocumentProcessorServiceStub(
settings.reviewDocumentOperationSettings(),
clientContext,
operationsStub);
+ this.evaluateProcessorVersionCallable =
+ callableFactory.createUnaryCallable(
+ evaluateProcessorVersionTransportSettings,
+ settings.evaluateProcessorVersionSettings(),
+ clientContext);
+ this.evaluateProcessorVersionOperationCallable =
+ callableFactory.createOperationCallable(
+ evaluateProcessorVersionTransportSettings,
+ settings.evaluateProcessorVersionOperationSettings(),
+ clientContext,
+ operationsStub);
+ this.getEvaluationCallable =
+ callableFactory.createUnaryCallable(
+ getEvaluationTransportSettings, settings.getEvaluationSettings(), clientContext);
+ this.listEvaluationsCallable =
+ callableFactory.createUnaryCallable(
+ listEvaluationsTransportSettings, settings.listEvaluationsSettings(), clientContext);
+ this.listEvaluationsPagedCallable =
+ callableFactory.createPagedCallable(
+ listEvaluationsTransportSettings, settings.listEvaluationsSettings(), clientContext);
this.listLocationsCallable =
callableFactory.createUnaryCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
@@ -816,6 +966,20 @@ public UnaryCallable getProcessorCallable() {
return getProcessorCallable;
}
+ @Override
+ public UnaryCallable trainProcessorVersionCallable() {
+ return trainProcessorVersionCallable;
+ }
+
+ @Override
+ public OperationCallable<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationCallable() {
+ return trainProcessorVersionOperationCallable;
+ }
+
@Override
public UnaryCallable getProcessorVersionCallable() {
return getProcessorVersionCallable;
@@ -939,6 +1103,37 @@ public UnaryCallable reviewDocumentCallable()
return reviewDocumentOperationCallable;
}
+ @Override
+ public UnaryCallable
+ evaluateProcessorVersionCallable() {
+ return evaluateProcessorVersionCallable;
+ }
+
+ @Override
+ public OperationCallable<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationCallable() {
+ return evaluateProcessorVersionOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable getEvaluationCallable() {
+ return getEvaluationCallable;
+ }
+
+ @Override
+ public UnaryCallable listEvaluationsCallable() {
+ return listEvaluationsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listEvaluationsPagedCallable() {
+ return listEvaluationsPagedCallable;
+ }
+
@Override
public UnaryCallable listLocationsCallable() {
return listLocationsCallable;
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentProcessorServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentProcessorServiceStub.java
index 0e2527fcd1be..5c2172f8d6d6 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentProcessorServiceStub.java
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentProcessorServiceStub.java
@@ -16,6 +16,7 @@
package com.google.cloud.documentai.v1beta3.stub;
+import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListEvaluationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorTypesPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorVersionsPagedResponse;
@@ -53,10 +54,17 @@
import com.google.cloud.documentai.v1beta3.EnableProcessorMetadata;
import com.google.cloud.documentai.v1beta3.EnableProcessorRequest;
import com.google.cloud.documentai.v1beta3.EnableProcessorResponse;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse;
+import com.google.cloud.documentai.v1beta3.Evaluation;
import com.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest;
import com.google.cloud.documentai.v1beta3.FetchProcessorTypesResponse;
+import com.google.cloud.documentai.v1beta3.GetEvaluationRequest;
import com.google.cloud.documentai.v1beta3.GetProcessorRequest;
import com.google.cloud.documentai.v1beta3.GetProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.ListEvaluationsRequest;
+import com.google.cloud.documentai.v1beta3.ListEvaluationsResponse;
import com.google.cloud.documentai.v1beta3.ListProcessorTypesRequest;
import com.google.cloud.documentai.v1beta3.ListProcessorTypesResponse;
import com.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest;
@@ -73,6 +81,9 @@
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionMetadata;
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionRequest;
import com.google.cloud.documentai.v1beta3.SetDefaultProcessorVersionResponse;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest;
+import com.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionMetadata;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest;
import com.google.cloud.documentai.v1beta3.UndeployProcessorVersionResponse;
@@ -111,12 +122,16 @@ public class HttpJsonDocumentProcessorServiceStub extends DocumentProcessorServi
.add(UndeployProcessorVersionResponse.getDescriptor())
.add(DisableProcessorResponse.getDescriptor())
.add(ReviewDocumentOperationMetadata.getDescriptor())
+ .add(EvaluateProcessorVersionResponse.getDescriptor())
+ .add(EvaluateProcessorVersionMetadata.getDescriptor())
+ .add(TrainProcessorVersionMetadata.getDescriptor())
.add(BatchProcessMetadata.getDescriptor())
.add(Empty.getDescriptor())
.add(UndeployProcessorVersionMetadata.getDescriptor())
.add(DeleteProcessorMetadata.getDescriptor())
.add(ReviewDocumentResponse.getDescriptor())
.add(EnableProcessorResponse.getDescriptor())
+ .add(TrainProcessorVersionResponse.getDescriptor())
.add(DeleteProcessorVersionMetadata.getDescriptor())
.add(SetDefaultProcessorVersionResponse.getDescriptor())
.build();
@@ -342,6 +357,46 @@ public class HttpJsonDocumentProcessorServiceStub extends DocumentProcessorServi
.build())
.build();
+ private static final ApiMethodDescriptor
+ trainProcessorVersionMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentProcessorService/TrainProcessorVersion")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta3/{parent=projects/*/locations/*/processors/*}/processorVersions:train",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearParent().build(), false))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (TrainProcessorVersionRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
private static final ApiMethodDescriptor
getProcessorVersionMethodDescriptor =
ApiMethodDescriptor.newBuilder()
@@ -769,6 +824,120 @@ public class HttpJsonDocumentProcessorServiceStub extends DocumentProcessorServi
HttpJsonOperationSnapshot.create(response))
.build();
+ private static final ApiMethodDescriptor
+ evaluateProcessorVersionMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentProcessorService/EvaluateProcessorVersion")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta3/{processorVersion=projects/*/locations/*/processors/*/processorVersions/*}:evaluateProcessorVersion",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "processorVersion", request.getProcessorVersion());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody(
+ "*",
+ request.toBuilder().clearProcessorVersion().build(),
+ false))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (EvaluateProcessorVersionRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ getEvaluationMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentProcessorService/GetEvaluation")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*/evaluations/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Evaluation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listEvaluationsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentProcessorService/ListEvaluations")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta3/{parent=projects/*/locations/*/processors/*/processorVersions/*}/evaluations",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListEvaluationsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
private static final ApiMethodDescriptor
listLocationsMethodDescriptor =
ApiMethodDescriptor.newBuilder()
@@ -851,6 +1020,13 @@ public class HttpJsonDocumentProcessorServiceStub extends DocumentProcessorServi
private final UnaryCallable
listProcessorsPagedCallable;
private final UnaryCallable getProcessorCallable;
+ private final UnaryCallable
+ trainProcessorVersionCallable;
+ private final OperationCallable<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationCallable;
private final UnaryCallable
getProcessorVersionCallable;
private final UnaryCallable
@@ -899,6 +1075,18 @@ public class HttpJsonDocumentProcessorServiceStub extends DocumentProcessorServi
private final OperationCallable<
ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata>
reviewDocumentOperationCallable;
+ private final UnaryCallable
+ evaluateProcessorVersionCallable;
+ private final OperationCallable<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationCallable;
+ private final UnaryCallable getEvaluationCallable;
+ private final UnaryCallable
+ listEvaluationsCallable;
+ private final UnaryCallable
+ listEvaluationsPagedCallable;
private final UnaryCallable listLocationsCallable;
private final UnaryCallable
listLocationsPagedCallable;
@@ -986,6 +1174,12 @@ protected HttpJsonDocumentProcessorServiceStub(
.setMethodDescriptor(getProcessorMethodDescriptor)
.setTypeRegistry(typeRegistry)
.build();
+ HttpJsonCallSettings
+ trainProcessorVersionTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(trainProcessorVersionMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
HttpJsonCallSettings
getProcessorVersionTransportSettings =
HttpJsonCallSettings.newBuilder()
@@ -1048,6 +1242,23 @@ protected HttpJsonDocumentProcessorServiceStub(
.setMethodDescriptor(reviewDocumentMethodDescriptor)
.setTypeRegistry(typeRegistry)
.build();
+ HttpJsonCallSettings
+ evaluateProcessorVersionTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(evaluateProcessorVersionMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getEvaluationTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getEvaluationMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings
+ listEvaluationsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listEvaluationsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
HttpJsonCallSettings
listLocationsTransportSettings =
HttpJsonCallSettings.newBuilder()
@@ -1098,6 +1309,17 @@ protected HttpJsonDocumentProcessorServiceStub(
this.getProcessorCallable =
callableFactory.createUnaryCallable(
getProcessorTransportSettings, settings.getProcessorSettings(), clientContext);
+ this.trainProcessorVersionCallable =
+ callableFactory.createUnaryCallable(
+ trainProcessorVersionTransportSettings,
+ settings.trainProcessorVersionSettings(),
+ clientContext);
+ this.trainProcessorVersionOperationCallable =
+ callableFactory.createOperationCallable(
+ trainProcessorVersionTransportSettings,
+ settings.trainProcessorVersionOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
this.getProcessorVersionCallable =
callableFactory.createUnaryCallable(
getProcessorVersionTransportSettings,
@@ -1196,6 +1418,26 @@ protected HttpJsonDocumentProcessorServiceStub(
settings.reviewDocumentOperationSettings(),
clientContext,
httpJsonOperationsStub);
+ this.evaluateProcessorVersionCallable =
+ callableFactory.createUnaryCallable(
+ evaluateProcessorVersionTransportSettings,
+ settings.evaluateProcessorVersionSettings(),
+ clientContext);
+ this.evaluateProcessorVersionOperationCallable =
+ callableFactory.createOperationCallable(
+ evaluateProcessorVersionTransportSettings,
+ settings.evaluateProcessorVersionOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.getEvaluationCallable =
+ callableFactory.createUnaryCallable(
+ getEvaluationTransportSettings, settings.getEvaluationSettings(), clientContext);
+ this.listEvaluationsCallable =
+ callableFactory.createUnaryCallable(
+ listEvaluationsTransportSettings, settings.listEvaluationsSettings(), clientContext);
+ this.listEvaluationsPagedCallable =
+ callableFactory.createPagedCallable(
+ listEvaluationsTransportSettings, settings.listEvaluationsSettings(), clientContext);
this.listLocationsCallable =
callableFactory.createUnaryCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
@@ -1219,6 +1461,7 @@ public static List getMethodDescriptors() {
methodDescriptors.add(listProcessorTypesMethodDescriptor);
methodDescriptors.add(listProcessorsMethodDescriptor);
methodDescriptors.add(getProcessorMethodDescriptor);
+ methodDescriptors.add(trainProcessorVersionMethodDescriptor);
methodDescriptors.add(getProcessorVersionMethodDescriptor);
methodDescriptors.add(listProcessorVersionsMethodDescriptor);
methodDescriptors.add(deleteProcessorVersionMethodDescriptor);
@@ -1230,6 +1473,9 @@ public static List getMethodDescriptors() {
methodDescriptors.add(disableProcessorMethodDescriptor);
methodDescriptors.add(setDefaultProcessorVersionMethodDescriptor);
methodDescriptors.add(reviewDocumentMethodDescriptor);
+ methodDescriptors.add(evaluateProcessorVersionMethodDescriptor);
+ methodDescriptors.add(getEvaluationMethodDescriptor);
+ methodDescriptors.add(listEvaluationsMethodDescriptor);
methodDescriptors.add(listLocationsMethodDescriptor);
methodDescriptors.add(getLocationMethodDescriptor);
return methodDescriptors;
@@ -1289,6 +1535,20 @@ public UnaryCallable getProcessorCallable() {
return getProcessorCallable;
}
+ @Override
+ public UnaryCallable trainProcessorVersionCallable() {
+ return trainProcessorVersionCallable;
+ }
+
+ @Override
+ public OperationCallable<
+ TrainProcessorVersionRequest,
+ TrainProcessorVersionResponse,
+ TrainProcessorVersionMetadata>
+ trainProcessorVersionOperationCallable() {
+ return trainProcessorVersionOperationCallable;
+ }
+
@Override
public UnaryCallable getProcessorVersionCallable() {
return getProcessorVersionCallable;
@@ -1412,6 +1672,37 @@ public UnaryCallable reviewDocumentCallable()
return reviewDocumentOperationCallable;
}
+ @Override
+ public UnaryCallable
+ evaluateProcessorVersionCallable() {
+ return evaluateProcessorVersionCallable;
+ }
+
+ @Override
+ public OperationCallable<
+ EvaluateProcessorVersionRequest,
+ EvaluateProcessorVersionResponse,
+ EvaluateProcessorVersionMetadata>
+ evaluateProcessorVersionOperationCallable() {
+ return evaluateProcessorVersionOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable getEvaluationCallable() {
+ return getEvaluationCallable;
+ }
+
+ @Override
+ public UnaryCallable listEvaluationsCallable() {
+ return listEvaluationsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listEvaluationsPagedCallable() {
+ return listEvaluationsPagedCallable;
+ }
+
@Override
public UnaryCallable listLocationsCallable() {
return listLocationsCallable;
diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientHttpJsonTest.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientHttpJsonTest.java
index 617076b54a84..28db2daf2f41 100644
--- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientHttpJsonTest.java
+++ b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientHttpJsonTest.java
@@ -16,6 +16,7 @@
package com.google.cloud.documentai.v1beta3;
+import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListEvaluationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorTypesPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorVersionsPagedResponse;
@@ -668,6 +669,110 @@ public void getProcessorExceptionTest2() throws Exception {
}
}
+ @Test
+ public void trainProcessorVersionTest() throws Exception {
+ TrainProcessorVersionResponse expectedResponse =
+ TrainProcessorVersionResponse.newBuilder()
+ .setProcessorVersion("processorVersion-1941143578")
+ .build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("trainProcessorVersionTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockService.addResponse(resultOperation);
+
+ ProcessorName parent = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+ ProcessorVersion processorVersion = ProcessorVersion.newBuilder().build();
+
+ TrainProcessorVersionResponse actualResponse =
+ client.trainProcessorVersionAsync(parent, processorVersion).get();
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void trainProcessorVersionExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ProcessorName parent = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+ ProcessorVersion processorVersion = ProcessorVersion.newBuilder().build();
+ client.trainProcessorVersionAsync(parent, processorVersion).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ }
+ }
+
+ @Test
+ public void trainProcessorVersionTest2() throws Exception {
+ TrainProcessorVersionResponse expectedResponse =
+ TrainProcessorVersionResponse.newBuilder()
+ .setProcessorVersion("processorVersion-1941143578")
+ .build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("trainProcessorVersionTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockService.addResponse(resultOperation);
+
+ String parent = "projects/project-3198/locations/location-3198/processors/processor-3198";
+ ProcessorVersion processorVersion = ProcessorVersion.newBuilder().build();
+
+ TrainProcessorVersionResponse actualResponse =
+ client.trainProcessorVersionAsync(parent, processorVersion).get();
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void trainProcessorVersionExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent = "projects/project-3198/locations/location-3198/processors/processor-3198";
+ ProcessorVersion processorVersion = ProcessorVersion.newBuilder().build();
+ client.trainProcessorVersionAsync(parent, processorVersion).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ }
+ }
+
@Test
public void getProcessorVersionTest() throws Exception {
ProcessorVersion expectedResponse =
@@ -677,6 +782,7 @@ public void getProcessorVersionTest() throws Exception {
"[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]")
.toString())
.setDisplayName("displayName1714148973")
+ .setDocumentSchema(DocumentSchema.newBuilder().build())
.setCreateTime(Timestamp.newBuilder().build())
.setKmsKeyName("kmsKeyName412586233")
.setKmsKeyVersionName("kmsKeyVersionName-1798811307")
@@ -732,6 +838,7 @@ public void getProcessorVersionTest2() throws Exception {
"[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]")
.toString())
.setDisplayName("displayName1714148973")
+ .setDocumentSchema(DocumentSchema.newBuilder().build())
.setCreateTime(Timestamp.newBuilder().build())
.setKmsKeyName("kmsKeyName412586233")
.setKmsKeyVersionName("kmsKeyVersionName-1798811307")
@@ -1640,6 +1747,330 @@ public void reviewDocumentExceptionTest2() throws Exception {
}
}
+ @Test
+ public void evaluateProcessorVersionTest() throws Exception {
+ EvaluateProcessorVersionResponse expectedResponse =
+ EvaluateProcessorVersionResponse.newBuilder().setEvaluation("evaluation858523452").build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("evaluateProcessorVersionTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockService.addResponse(resultOperation);
+
+ ProcessorVersionName processorVersion =
+ ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]");
+
+ EvaluateProcessorVersionResponse actualResponse =
+ client.evaluateProcessorVersionAsync(processorVersion).get();
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void evaluateProcessorVersionExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ProcessorVersionName processorVersion =
+ ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]");
+ client.evaluateProcessorVersionAsync(processorVersion).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ }
+ }
+
+ @Test
+ public void evaluateProcessorVersionTest2() throws Exception {
+ EvaluateProcessorVersionResponse expectedResponse =
+ EvaluateProcessorVersionResponse.newBuilder().setEvaluation("evaluation858523452").build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("evaluateProcessorVersionTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockService.addResponse(resultOperation);
+
+ String processorVersion =
+ "projects/project-7729/locations/location-7729/processors/processor-7729/processorVersions/processorVersion-7729";
+
+ EvaluateProcessorVersionResponse actualResponse =
+ client.evaluateProcessorVersionAsync(processorVersion).get();
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void evaluateProcessorVersionExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String processorVersion =
+ "projects/project-7729/locations/location-7729/processors/processor-7729/processorVersions/processorVersion-7729";
+ client.evaluateProcessorVersionAsync(processorVersion).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ }
+ }
+
+ @Test
+ public void getEvaluationTest() throws Exception {
+ Evaluation expectedResponse =
+ Evaluation.newBuilder()
+ .setName(
+ EvaluationName.of(
+ "[PROJECT]",
+ "[LOCATION]",
+ "[PROCESSOR]",
+ "[PROCESSOR_VERSION]",
+ "[EVALUATION]")
+ .toString())
+ .setCreateTime(Timestamp.newBuilder().build())
+ .setDocumentCounters(Evaluation.Counters.newBuilder().build())
+ .setAllEntitiesMetrics(Evaluation.MultiConfidenceMetrics.newBuilder().build())
+ .putAllEntityMetrics(new HashMap())
+ .setKmsKeyName("kmsKeyName412586233")
+ .setKmsKeyVersionName("kmsKeyVersionName-1798811307")
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ EvaluationName name =
+ EvaluationName.of(
+ "[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]", "[EVALUATION]");
+
+ Evaluation actualResponse = client.getEvaluation(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getEvaluationExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ EvaluationName name =
+ EvaluationName.of(
+ "[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]", "[EVALUATION]");
+ client.getEvaluation(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getEvaluationTest2() throws Exception {
+ Evaluation expectedResponse =
+ Evaluation.newBuilder()
+ .setName(
+ EvaluationName.of(
+ "[PROJECT]",
+ "[LOCATION]",
+ "[PROCESSOR]",
+ "[PROCESSOR_VERSION]",
+ "[EVALUATION]")
+ .toString())
+ .setCreateTime(Timestamp.newBuilder().build())
+ .setDocumentCounters(Evaluation.Counters.newBuilder().build())
+ .setAllEntitiesMetrics(Evaluation.MultiConfidenceMetrics.newBuilder().build())
+ .putAllEntityMetrics(new HashMap())
+ .setKmsKeyName("kmsKeyName412586233")
+ .setKmsKeyVersionName("kmsKeyVersionName-1798811307")
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String name =
+ "projects/project-6701/locations/location-6701/processors/processor-6701/processorVersions/processorVersion-6701/evaluations/evaluation-6701";
+
+ Evaluation actualResponse = client.getEvaluation(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getEvaluationExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String name =
+ "projects/project-6701/locations/location-6701/processors/processor-6701/processorVersions/processorVersion-6701/evaluations/evaluation-6701";
+ client.getEvaluation(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listEvaluationsTest() throws Exception {
+ Evaluation responsesElement = Evaluation.newBuilder().build();
+ ListEvaluationsResponse expectedResponse =
+ ListEvaluationsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllEvaluations(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ProcessorVersionName parent =
+ ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]");
+
+ ListEvaluationsPagedResponse pagedListResponse = client.listEvaluations(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getEvaluationsList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listEvaluationsExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ProcessorVersionName parent =
+ ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]");
+ client.listEvaluations(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listEvaluationsTest2() throws Exception {
+ Evaluation responsesElement = Evaluation.newBuilder().build();
+ ListEvaluationsResponse expectedResponse =
+ ListEvaluationsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllEvaluations(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String parent =
+ "projects/project-1781/locations/location-1781/processors/processor-1781/processorVersions/processorVersion-1781";
+
+ ListEvaluationsPagedResponse pagedListResponse = client.listEvaluations(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getEvaluationsList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listEvaluationsExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent =
+ "projects/project-1781/locations/location-1781/processors/processor-1781/processorVersions/processorVersion-1781";
+ client.listEvaluations(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
@Test
public void listLocationsTest() throws Exception {
Location responsesElement = Location.newBuilder().build();
diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientTest.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientTest.java
index bc43a4243d0f..7e8f34c5e521 100644
--- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientTest.java
+++ b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientTest.java
@@ -16,6 +16,7 @@
package com.google.cloud.documentai.v1beta3;
+import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListEvaluationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorTypesPagedResponse;
import static com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClient.ListProcessorVersionsPagedResponse;
@@ -609,6 +610,108 @@ public void getProcessorExceptionTest2() throws Exception {
}
}
+ @Test
+ public void trainProcessorVersionTest() throws Exception {
+ TrainProcessorVersionResponse expectedResponse =
+ TrainProcessorVersionResponse.newBuilder()
+ .setProcessorVersion("processorVersion-1941143578")
+ .build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("trainProcessorVersionTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockDocumentProcessorService.addResponse(resultOperation);
+
+ ProcessorName parent = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+ ProcessorVersion processorVersion = ProcessorVersion.newBuilder().build();
+
+ TrainProcessorVersionResponse actualResponse =
+ client.trainProcessorVersionAsync(parent, processorVersion).get();
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDocumentProcessorService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ TrainProcessorVersionRequest actualRequest =
+ ((TrainProcessorVersionRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent.toString(), actualRequest.getParent());
+ Assert.assertEquals(processorVersion, actualRequest.getProcessorVersion());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void trainProcessorVersionExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDocumentProcessorService.addException(exception);
+
+ try {
+ ProcessorName parent = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+ ProcessorVersion processorVersion = ProcessorVersion.newBuilder().build();
+ client.trainProcessorVersionAsync(parent, processorVersion).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
+ InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
+ Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
+ }
+ }
+
+ @Test
+ public void trainProcessorVersionTest2() throws Exception {
+ TrainProcessorVersionResponse expectedResponse =
+ TrainProcessorVersionResponse.newBuilder()
+ .setProcessorVersion("processorVersion-1941143578")
+ .build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("trainProcessorVersionTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockDocumentProcessorService.addResponse(resultOperation);
+
+ String parent = "parent-995424086";
+ ProcessorVersion processorVersion = ProcessorVersion.newBuilder().build();
+
+ TrainProcessorVersionResponse actualResponse =
+ client.trainProcessorVersionAsync(parent, processorVersion).get();
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDocumentProcessorService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ TrainProcessorVersionRequest actualRequest =
+ ((TrainProcessorVersionRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent, actualRequest.getParent());
+ Assert.assertEquals(processorVersion, actualRequest.getProcessorVersion());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void trainProcessorVersionExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDocumentProcessorService.addException(exception);
+
+ try {
+ String parent = "parent-995424086";
+ ProcessorVersion processorVersion = ProcessorVersion.newBuilder().build();
+ client.trainProcessorVersionAsync(parent, processorVersion).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
+ InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
+ Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
+ }
+ }
+
@Test
public void getProcessorVersionTest() throws Exception {
ProcessorVersion expectedResponse =
@@ -618,6 +721,7 @@ public void getProcessorVersionTest() throws Exception {
"[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]")
.toString())
.setDisplayName("displayName1714148973")
+ .setDocumentSchema(DocumentSchema.newBuilder().build())
.setCreateTime(Timestamp.newBuilder().build())
.setKmsKeyName("kmsKeyName412586233")
.setKmsKeyVersionName("kmsKeyVersionName-1798811307")
@@ -667,6 +771,7 @@ public void getProcessorVersionTest2() throws Exception {
"[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]")
.toString())
.setDisplayName("displayName1714148973")
+ .setDocumentSchema(DocumentSchema.newBuilder().build())
.setCreateTime(Timestamp.newBuilder().build())
.setKmsKeyName("kmsKeyName412586233")
.setKmsKeyVersionName("kmsKeyVersionName-1798811307")
@@ -1509,6 +1614,296 @@ public void reviewDocumentExceptionTest2() throws Exception {
}
}
+ @Test
+ public void evaluateProcessorVersionTest() throws Exception {
+ EvaluateProcessorVersionResponse expectedResponse =
+ EvaluateProcessorVersionResponse.newBuilder().setEvaluation("evaluation858523452").build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("evaluateProcessorVersionTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockDocumentProcessorService.addResponse(resultOperation);
+
+ ProcessorVersionName processorVersion =
+ ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]");
+
+ EvaluateProcessorVersionResponse actualResponse =
+ client.evaluateProcessorVersionAsync(processorVersion).get();
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDocumentProcessorService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ EvaluateProcessorVersionRequest actualRequest =
+ ((EvaluateProcessorVersionRequest) actualRequests.get(0));
+
+ Assert.assertEquals(processorVersion.toString(), actualRequest.getProcessorVersion());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void evaluateProcessorVersionExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDocumentProcessorService.addException(exception);
+
+ try {
+ ProcessorVersionName processorVersion =
+ ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]");
+ client.evaluateProcessorVersionAsync(processorVersion).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
+ InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
+ Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
+ }
+ }
+
+ @Test
+ public void evaluateProcessorVersionTest2() throws Exception {
+ EvaluateProcessorVersionResponse expectedResponse =
+ EvaluateProcessorVersionResponse.newBuilder().setEvaluation("evaluation858523452").build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("evaluateProcessorVersionTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockDocumentProcessorService.addResponse(resultOperation);
+
+ String processorVersion = "processorVersion-1941143578";
+
+ EvaluateProcessorVersionResponse actualResponse =
+ client.evaluateProcessorVersionAsync(processorVersion).get();
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDocumentProcessorService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ EvaluateProcessorVersionRequest actualRequest =
+ ((EvaluateProcessorVersionRequest) actualRequests.get(0));
+
+ Assert.assertEquals(processorVersion, actualRequest.getProcessorVersion());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void evaluateProcessorVersionExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDocumentProcessorService.addException(exception);
+
+ try {
+ String processorVersion = "processorVersion-1941143578";
+ client.evaluateProcessorVersionAsync(processorVersion).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
+ InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
+ Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
+ }
+ }
+
+ @Test
+ public void getEvaluationTest() throws Exception {
+ Evaluation expectedResponse =
+ Evaluation.newBuilder()
+ .setName(
+ EvaluationName.of(
+ "[PROJECT]",
+ "[LOCATION]",
+ "[PROCESSOR]",
+ "[PROCESSOR_VERSION]",
+ "[EVALUATION]")
+ .toString())
+ .setCreateTime(Timestamp.newBuilder().build())
+ .setDocumentCounters(Evaluation.Counters.newBuilder().build())
+ .setAllEntitiesMetrics(Evaluation.MultiConfidenceMetrics.newBuilder().build())
+ .putAllEntityMetrics(new HashMap())
+ .setKmsKeyName("kmsKeyName412586233")
+ .setKmsKeyVersionName("kmsKeyVersionName-1798811307")
+ .build();
+ mockDocumentProcessorService.addResponse(expectedResponse);
+
+ EvaluationName name =
+ EvaluationName.of(
+ "[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]", "[EVALUATION]");
+
+ Evaluation actualResponse = client.getEvaluation(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDocumentProcessorService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ GetEvaluationRequest actualRequest = ((GetEvaluationRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name.toString(), actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void getEvaluationExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDocumentProcessorService.addException(exception);
+
+ try {
+ EvaluationName name =
+ EvaluationName.of(
+ "[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]", "[EVALUATION]");
+ client.getEvaluation(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getEvaluationTest2() throws Exception {
+ Evaluation expectedResponse =
+ Evaluation.newBuilder()
+ .setName(
+ EvaluationName.of(
+ "[PROJECT]",
+ "[LOCATION]",
+ "[PROCESSOR]",
+ "[PROCESSOR_VERSION]",
+ "[EVALUATION]")
+ .toString())
+ .setCreateTime(Timestamp.newBuilder().build())
+ .setDocumentCounters(Evaluation.Counters.newBuilder().build())
+ .setAllEntitiesMetrics(Evaluation.MultiConfidenceMetrics.newBuilder().build())
+ .putAllEntityMetrics(new HashMap())
+ .setKmsKeyName("kmsKeyName412586233")
+ .setKmsKeyVersionName("kmsKeyVersionName-1798811307")
+ .build();
+ mockDocumentProcessorService.addResponse(expectedResponse);
+
+ String name = "name3373707";
+
+ Evaluation actualResponse = client.getEvaluation(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockDocumentProcessorService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ GetEvaluationRequest actualRequest = ((GetEvaluationRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name, actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void getEvaluationExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDocumentProcessorService.addException(exception);
+
+ try {
+ String name = "name3373707";
+ client.getEvaluation(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listEvaluationsTest() throws Exception {
+ Evaluation responsesElement = Evaluation.newBuilder().build();
+ ListEvaluationsResponse expectedResponse =
+ ListEvaluationsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllEvaluations(Arrays.asList(responsesElement))
+ .build();
+ mockDocumentProcessorService.addResponse(expectedResponse);
+
+ ProcessorVersionName parent =
+ ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]");
+
+ ListEvaluationsPagedResponse pagedListResponse = client.listEvaluations(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getEvaluationsList().get(0), resources.get(0));
+
+ List actualRequests = mockDocumentProcessorService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ ListEvaluationsRequest actualRequest = ((ListEvaluationsRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent.toString(), actualRequest.getParent());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void listEvaluationsExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDocumentProcessorService.addException(exception);
+
+ try {
+ ProcessorVersionName parent =
+ ProcessorVersionName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]", "[PROCESSOR_VERSION]");
+ client.listEvaluations(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listEvaluationsTest2() throws Exception {
+ Evaluation responsesElement = Evaluation.newBuilder().build();
+ ListEvaluationsResponse expectedResponse =
+ ListEvaluationsResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllEvaluations(Arrays.asList(responsesElement))
+ .build();
+ mockDocumentProcessorService.addResponse(expectedResponse);
+
+ String parent = "parent-995424086";
+
+ ListEvaluationsPagedResponse pagedListResponse = client.listEvaluations(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getEvaluationsList().get(0), resources.get(0));
+
+ List actualRequests = mockDocumentProcessorService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ ListEvaluationsRequest actualRequest = ((ListEvaluationsRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent, actualRequest.getParent());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void listEvaluationsExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockDocumentProcessorService.addException(exception);
+
+ try {
+ String parent = "parent-995424086";
+ client.listEvaluations(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
@Test
public void listLocationsTest() throws Exception {
Location responsesElement = Location.newBuilder().build();
diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorServiceImpl.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorServiceImpl.java
index 2d348b26dd59..5085ce89f4ab 100644
--- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorServiceImpl.java
+++ b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorServiceImpl.java
@@ -187,6 +187,27 @@ public void getProcessor(
}
}
+ @Override
+ public void trainProcessorVersion(
+ TrainProcessorVersionRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof Operation) {
+ requests.add(request);
+ responseObserver.onNext(((Operation) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method TrainProcessorVersion, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ Operation.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
@Override
public void getProcessorVersion(
GetProcessorVersionRequest request, StreamObserver responseObserver) {
@@ -418,4 +439,67 @@ public void reviewDocument(
Exception.class.getName())));
}
}
+
+ @Override
+ public void evaluateProcessorVersion(
+ EvaluateProcessorVersionRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof Operation) {
+ requests.add(request);
+ responseObserver.onNext(((Operation) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method EvaluateProcessorVersion, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ Operation.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
+ @Override
+ public void getEvaluation(
+ GetEvaluationRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof Evaluation) {
+ requests.add(request);
+ responseObserver.onNext(((Evaluation) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method GetEvaluation, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ Evaluation.class.getName(),
+ Exception.class.getName())));
+ }
+ }
+
+ @Override
+ public void listEvaluations(
+ ListEvaluationsRequest request, StreamObserver responseObserver) {
+ Object response = responses.poll();
+ if (response instanceof ListEvaluationsResponse) {
+ requests.add(request);
+ responseObserver.onNext(((ListEvaluationsResponse) response));
+ responseObserver.onCompleted();
+ } else if (response instanceof Exception) {
+ responseObserver.onError(((Exception) response));
+ } else {
+ responseObserver.onError(
+ new IllegalArgumentException(
+ String.format(
+ "Unrecognized response type %s for method ListEvaluations, expected %s or %s",
+ response == null ? "null" : response.getClass().getName(),
+ ListEvaluationsResponse.class.getName(),
+ Exception.class.getName())));
+ }
+ }
}
diff --git a/java-document-ai/grpc-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceGrpc.java b/java-document-ai/grpc-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceGrpc.java
index 6cd9101920e6..01711f238624 100644
--- a/java-document-ai/grpc-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceGrpc.java
+++ b/java-document-ai/grpc-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceGrpc.java
@@ -334,6 +334,58 @@ private DocumentProcessorServiceGrpc() {}
return getGetProcessorMethod;
}
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest,
+ com.google.longrunning.Operation>
+ getTrainProcessorVersionMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "TrainProcessorVersion",
+ requestType = com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.class,
+ responseType = com.google.longrunning.Operation.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest,
+ com.google.longrunning.Operation>
+ getTrainProcessorVersionMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest,
+ com.google.longrunning.Operation>
+ getTrainProcessorVersionMethod;
+ if ((getTrainProcessorVersionMethod =
+ DocumentProcessorServiceGrpc.getTrainProcessorVersionMethod)
+ == null) {
+ synchronized (DocumentProcessorServiceGrpc.class) {
+ if ((getTrainProcessorVersionMethod =
+ DocumentProcessorServiceGrpc.getTrainProcessorVersionMethod)
+ == null) {
+ DocumentProcessorServiceGrpc.getTrainProcessorVersionMethod =
+ getTrainProcessorVersionMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ generateFullMethodName(SERVICE_NAME, "TrainProcessorVersion"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.longrunning.Operation.getDefaultInstance()))
+ .setSchemaDescriptor(
+ new DocumentProcessorServiceMethodDescriptorSupplier(
+ "TrainProcessorVersion"))
+ .build();
+ }
+ }
+ }
+ return getTrainProcessorVersionMethod;
+ }
+
private static volatile io.grpc.MethodDescriptor<
com.google.cloud.documentai.v1beta3.GetProcessorVersionRequest,
com.google.cloud.documentai.v1beta3.ProcessorVersion>
@@ -886,6 +938,154 @@ private DocumentProcessorServiceGrpc() {}
return getReviewDocumentMethod;
}
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest,
+ com.google.longrunning.Operation>
+ getEvaluateProcessorVersionMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "EvaluateProcessorVersion",
+ requestType = com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest.class,
+ responseType = com.google.longrunning.Operation.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest,
+ com.google.longrunning.Operation>
+ getEvaluateProcessorVersionMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest,
+ com.google.longrunning.Operation>
+ getEvaluateProcessorVersionMethod;
+ if ((getEvaluateProcessorVersionMethod =
+ DocumentProcessorServiceGrpc.getEvaluateProcessorVersionMethod)
+ == null) {
+ synchronized (DocumentProcessorServiceGrpc.class) {
+ if ((getEvaluateProcessorVersionMethod =
+ DocumentProcessorServiceGrpc.getEvaluateProcessorVersionMethod)
+ == null) {
+ DocumentProcessorServiceGrpc.getEvaluateProcessorVersionMethod =
+ getEvaluateProcessorVersionMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ generateFullMethodName(SERVICE_NAME, "EvaluateProcessorVersion"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.longrunning.Operation.getDefaultInstance()))
+ .setSchemaDescriptor(
+ new DocumentProcessorServiceMethodDescriptorSupplier(
+ "EvaluateProcessorVersion"))
+ .build();
+ }
+ }
+ }
+ return getEvaluateProcessorVersionMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.GetEvaluationRequest,
+ com.google.cloud.documentai.v1beta3.Evaluation>
+ getGetEvaluationMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "GetEvaluation",
+ requestType = com.google.cloud.documentai.v1beta3.GetEvaluationRequest.class,
+ responseType = com.google.cloud.documentai.v1beta3.Evaluation.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.GetEvaluationRequest,
+ com.google.cloud.documentai.v1beta3.Evaluation>
+ getGetEvaluationMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.GetEvaluationRequest,
+ com.google.cloud.documentai.v1beta3.Evaluation>
+ getGetEvaluationMethod;
+ if ((getGetEvaluationMethod = DocumentProcessorServiceGrpc.getGetEvaluationMethod) == null) {
+ synchronized (DocumentProcessorServiceGrpc.class) {
+ if ((getGetEvaluationMethod = DocumentProcessorServiceGrpc.getGetEvaluationMethod)
+ == null) {
+ DocumentProcessorServiceGrpc.getGetEvaluationMethod =
+ getGetEvaluationMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetEvaluation"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.cloud.documentai.v1beta3.GetEvaluationRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.cloud.documentai.v1beta3.Evaluation.getDefaultInstance()))
+ .setSchemaDescriptor(
+ new DocumentProcessorServiceMethodDescriptorSupplier("GetEvaluation"))
+ .build();
+ }
+ }
+ }
+ return getGetEvaluationMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.ListEvaluationsRequest,
+ com.google.cloud.documentai.v1beta3.ListEvaluationsResponse>
+ getListEvaluationsMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "ListEvaluations",
+ requestType = com.google.cloud.documentai.v1beta3.ListEvaluationsRequest.class,
+ responseType = com.google.cloud.documentai.v1beta3.ListEvaluationsResponse.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.ListEvaluationsRequest,
+ com.google.cloud.documentai.v1beta3.ListEvaluationsResponse>
+ getListEvaluationsMethod() {
+ io.grpc.MethodDescriptor<
+ com.google.cloud.documentai.v1beta3.ListEvaluationsRequest,
+ com.google.cloud.documentai.v1beta3.ListEvaluationsResponse>
+ getListEvaluationsMethod;
+ if ((getListEvaluationsMethod = DocumentProcessorServiceGrpc.getListEvaluationsMethod)
+ == null) {
+ synchronized (DocumentProcessorServiceGrpc.class) {
+ if ((getListEvaluationsMethod = DocumentProcessorServiceGrpc.getListEvaluationsMethod)
+ == null) {
+ DocumentProcessorServiceGrpc.getListEvaluationsMethod =
+ getListEvaluationsMethod =
+ io.grpc.MethodDescriptor
+ .
+ newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListEvaluations"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.cloud.documentai.v1beta3.ListEvaluationsRequest
+ .getDefaultInstance()))
+ .setResponseMarshaller(
+ io.grpc.protobuf.ProtoUtils.marshaller(
+ com.google.cloud.documentai.v1beta3.ListEvaluationsResponse
+ .getDefaultInstance()))
+ .setSchemaDescriptor(
+ new DocumentProcessorServiceMethodDescriptorSupplier("ListEvaluations"))
+ .build();
+ }
+ }
+ }
+ return getListEvaluationsMethod;
+ }
+
/** Creates a new async stub that supports all call types for the service */
public static DocumentProcessorServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
@@ -1030,6 +1230,22 @@ public void getProcessor(
getGetProcessorMethod(), responseObserver);
}
+ /**
+ *
+ *
+ *
+ * Trains a new processor version.
+ * Operation metadata is returned as
+ * cloud_documentai_core.TrainProcessorVersionMetadata.
+ *
+ */
+ public void trainProcessorVersion(
+ com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
+ getTrainProcessorVersionMethod(), responseObserver);
+ }
+
/**
*
*
@@ -1194,6 +1410,51 @@ public void reviewDocument(
getReviewDocumentMethod(), responseObserver);
}
+ /**
+ *
+ *
+ *
+ * Evaluates a ProcessorVersion against annotated documents, producing an
+ * Evaluation.
+ *
+ */
+ public void evaluateProcessorVersion(
+ com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
+ getEvaluateProcessorVersionMethod(), responseObserver);
+ }
+
+ /**
+ *
+ *
+ *
+ * Retrieves a specific evaluation.
+ *
+ */
+ public void getEvaluation(
+ com.google.cloud.documentai.v1beta3.GetEvaluationRequest request,
+ io.grpc.stub.StreamObserver
+ responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
+ getGetEvaluationMethod(), responseObserver);
+ }
+
+ /**
+ *
+ *
+ *
+ * Retrieves a set of evaluations for a given processor version.
+ *
+ */
+ public void listEvaluations(
+ com.google.cloud.documentai.v1beta3.ListEvaluationsRequest request,
+ io.grpc.stub.StreamObserver
+ responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
+ getListEvaluationsMethod(), responseObserver);
+ }
+
@java.lang.Override
public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
@@ -1237,6 +1498,12 @@ public final io.grpc.ServerServiceDefinition bindService() {
new MethodHandlers<
com.google.cloud.documentai.v1beta3.GetProcessorRequest,
com.google.cloud.documentai.v1beta3.Processor>(this, METHODID_GET_PROCESSOR)))
+ .addMethod(
+ getTrainProcessorVersionMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest,
+ com.google.longrunning.Operation>(this, METHODID_TRAIN_PROCESSOR_VERSION)))
.addMethod(
getGetProcessorVersionMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
@@ -1307,6 +1574,26 @@ public final io.grpc.ServerServiceDefinition bindService() {
new MethodHandlers<
com.google.cloud.documentai.v1beta3.ReviewDocumentRequest,
com.google.longrunning.Operation>(this, METHODID_REVIEW_DOCUMENT)))
+ .addMethod(
+ getEvaluateProcessorVersionMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest,
+ com.google.longrunning.Operation>(this, METHODID_EVALUATE_PROCESSOR_VERSION)))
+ .addMethod(
+ getGetEvaluationMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ com.google.cloud.documentai.v1beta3.GetEvaluationRequest,
+ com.google.cloud.documentai.v1beta3.Evaluation>(
+ this, METHODID_GET_EVALUATION)))
+ .addMethod(
+ getListEvaluationsMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ com.google.cloud.documentai.v1beta3.ListEvaluationsRequest,
+ com.google.cloud.documentai.v1beta3.ListEvaluationsResponse>(
+ this, METHODID_LIST_EVALUATIONS)))
.build();
}
}
@@ -1436,6 +1723,24 @@ public void getProcessor(
responseObserver);
}
+ /**
+ *
+ *
+ *
+ * Trains a new processor version.
+ * Operation metadata is returned as
+ * cloud_documentai_core.TrainProcessorVersionMetadata.
+ *
+ */
+ public void trainProcessorVersion(
+ com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getTrainProcessorVersionMethod(), getCallOptions()),
+ request,
+ responseObserver);
+ }
+
/**
*
*
@@ -1621,6 +1926,57 @@ public void reviewDocument(
request,
responseObserver);
}
+
+ /**
+ *
+ *
+ *
+ * Evaluates a ProcessorVersion against annotated documents, producing an
+ * Evaluation.
+ *
+ */
+ public void evaluateProcessorVersion(
+ com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getEvaluateProcessorVersionMethod(), getCallOptions()),
+ request,
+ responseObserver);
+ }
+
+ /**
+ *
+ *
+ *
+ * Retrieves a specific evaluation.
+ *
+ */
+ public void getEvaluation(
+ com.google.cloud.documentai.v1beta3.GetEvaluationRequest request,
+ io.grpc.stub.StreamObserver
+ responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getGetEvaluationMethod(), getCallOptions()),
+ request,
+ responseObserver);
+ }
+
+ /**
+ *
+ *
+ *
+ * Retrieves a set of evaluations for a given processor version.
+ *
+ */
+ public void listEvaluations(
+ com.google.cloud.documentai.v1beta3.ListEvaluationsRequest request,
+ io.grpc.stub.StreamObserver
+ responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getListEvaluationsMethod(), getCallOptions()),
+ request,
+ responseObserver);
+ }
}
/**
@@ -1726,6 +2082,21 @@ public com.google.cloud.documentai.v1beta3.Processor getProcessor(
getChannel(), getGetProcessorMethod(), getCallOptions(), request);
}
+ /**
+ *
+ *
+ *
+ * Trains a new processor version.
+ * Operation metadata is returned as
+ * cloud_documentai_core.TrainProcessorVersionMetadata.
+ *
+ */
+ public com.google.longrunning.Operation trainProcessorVersion(
+ com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getTrainProcessorVersionMethod(), getCallOptions(), request);
+ }
+
/**
*
*
@@ -1874,6 +2245,46 @@ public com.google.longrunning.Operation reviewDocument(
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getReviewDocumentMethod(), getCallOptions(), request);
}
+
+ /**
+ *
+ *
+ *
+ * Evaluates a ProcessorVersion against annotated documents, producing an
+ * Evaluation.
+ *
+ */
+ public com.google.longrunning.Operation evaluateProcessorVersion(
+ com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getEvaluateProcessorVersionMethod(), getCallOptions(), request);
+ }
+
+ /**
+ *
+ *
+ *
+ * Retrieves a specific evaluation.
+ *
+ */
+ public com.google.cloud.documentai.v1beta3.Evaluation getEvaluation(
+ com.google.cloud.documentai.v1beta3.GetEvaluationRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getGetEvaluationMethod(), getCallOptions(), request);
+ }
+
+ /**
+ *
+ *
+ *
+ * Retrieves a set of evaluations for a given processor version.
+ *
+ */
+ public com.google.cloud.documentai.v1beta3.ListEvaluationsResponse listEvaluations(
+ com.google.cloud.documentai.v1beta3.ListEvaluationsRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getListEvaluationsMethod(), getCallOptions(), request);
+ }
}
/**
@@ -1985,6 +2396,22 @@ protected DocumentProcessorServiceFutureStub build(
getChannel().newCall(getGetProcessorMethod(), getCallOptions()), request);
}
+ /**
+ *
+ *
+ *
+ * Trains a new processor version.
+ * Operation metadata is returned as
+ * cloud_documentai_core.TrainProcessorVersionMetadata.
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture
+ trainProcessorVersion(
+ com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getTrainProcessorVersionMethod(), getCallOptions()), request);
+ }
+
/**
*
*
@@ -2142,6 +2569,49 @@ protected DocumentProcessorServiceFutureStub build(
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getReviewDocumentMethod(), getCallOptions()), request);
}
+
+ /**
+ *
+ *
+ *
+ * Evaluates a ProcessorVersion against annotated documents, producing an
+ * Evaluation.
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture
+ evaluateProcessorVersion(
+ com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getEvaluateProcessorVersionMethod(), getCallOptions()), request);
+ }
+
+ /**
+ *
+ *
+ *
+ * Retrieves a specific evaluation.
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture<
+ com.google.cloud.documentai.v1beta3.Evaluation>
+ getEvaluation(com.google.cloud.documentai.v1beta3.GetEvaluationRequest request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getGetEvaluationMethod(), getCallOptions()), request);
+ }
+
+ /**
+ *
+ *
+ *
+ * Retrieves a set of evaluations for a given processor version.
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture<
+ com.google.cloud.documentai.v1beta3.ListEvaluationsResponse>
+ listEvaluations(com.google.cloud.documentai.v1beta3.ListEvaluationsRequest request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getListEvaluationsMethod(), getCallOptions()), request);
+ }
}
private static final int METHODID_PROCESS_DOCUMENT = 0;
@@ -2150,17 +2620,21 @@ protected DocumentProcessorServiceFutureStub build(
private static final int METHODID_LIST_PROCESSOR_TYPES = 3;
private static final int METHODID_LIST_PROCESSORS = 4;
private static final int METHODID_GET_PROCESSOR = 5;
- private static final int METHODID_GET_PROCESSOR_VERSION = 6;
- private static final int METHODID_LIST_PROCESSOR_VERSIONS = 7;
- private static final int METHODID_DELETE_PROCESSOR_VERSION = 8;
- private static final int METHODID_DEPLOY_PROCESSOR_VERSION = 9;
- private static final int METHODID_UNDEPLOY_PROCESSOR_VERSION = 10;
- private static final int METHODID_CREATE_PROCESSOR = 11;
- private static final int METHODID_DELETE_PROCESSOR = 12;
- private static final int METHODID_ENABLE_PROCESSOR = 13;
- private static final int METHODID_DISABLE_PROCESSOR = 14;
- private static final int METHODID_SET_DEFAULT_PROCESSOR_VERSION = 15;
- private static final int METHODID_REVIEW_DOCUMENT = 16;
+ private static final int METHODID_TRAIN_PROCESSOR_VERSION = 6;
+ private static final int METHODID_GET_PROCESSOR_VERSION = 7;
+ private static final int METHODID_LIST_PROCESSOR_VERSIONS = 8;
+ private static final int METHODID_DELETE_PROCESSOR_VERSION = 9;
+ private static final int METHODID_DEPLOY_PROCESSOR_VERSION = 10;
+ private static final int METHODID_UNDEPLOY_PROCESSOR_VERSION = 11;
+ private static final int METHODID_CREATE_PROCESSOR = 12;
+ private static final int METHODID_DELETE_PROCESSOR = 13;
+ private static final int METHODID_ENABLE_PROCESSOR = 14;
+ private static final int METHODID_DISABLE_PROCESSOR = 15;
+ private static final int METHODID_SET_DEFAULT_PROCESSOR_VERSION = 16;
+ private static final int METHODID_REVIEW_DOCUMENT = 17;
+ private static final int METHODID_EVALUATE_PROCESSOR_VERSION = 18;
+ private static final int METHODID_GET_EVALUATION = 19;
+ private static final int METHODID_LIST_EVALUATIONS = 20;
private static final class MethodHandlers
implements io.grpc.stub.ServerCalls.UnaryMethod,
@@ -2217,6 +2691,11 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv
(io.grpc.stub.StreamObserver)
responseObserver);
break;
+ case METHODID_TRAIN_PROCESSOR_VERSION:
+ serviceImpl.trainProcessorVersion(
+ (com.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest) request,
+ (io.grpc.stub.StreamObserver) responseObserver);
+ break;
case METHODID_GET_PROCESSOR_VERSION:
serviceImpl.getProcessorVersion(
(com.google.cloud.documentai.v1beta3.GetProcessorVersionRequest) request,
@@ -2276,6 +2755,24 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv
(com.google.cloud.documentai.v1beta3.ReviewDocumentRequest) request,
(io.grpc.stub.StreamObserver) responseObserver);
break;
+ case METHODID_EVALUATE_PROCESSOR_VERSION:
+ serviceImpl.evaluateProcessorVersion(
+ (com.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest) request,
+ (io.grpc.stub.StreamObserver) responseObserver);
+ break;
+ case METHODID_GET_EVALUATION:
+ serviceImpl.getEvaluation(
+ (com.google.cloud.documentai.v1beta3.GetEvaluationRequest) request,
+ (io.grpc.stub.StreamObserver)
+ responseObserver);
+ break;
+ case METHODID_LIST_EVALUATIONS:
+ serviceImpl.listEvaluations(
+ (com.google.cloud.documentai.v1beta3.ListEvaluationsRequest) request,
+ (io.grpc.stub.StreamObserver<
+ com.google.cloud.documentai.v1beta3.ListEvaluationsResponse>)
+ responseObserver);
+ break;
default:
throw new AssertionError();
}
@@ -2346,6 +2843,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
.addMethod(getListProcessorTypesMethod())
.addMethod(getListProcessorsMethod())
.addMethod(getGetProcessorMethod())
+ .addMethod(getTrainProcessorVersionMethod())
.addMethod(getGetProcessorVersionMethod())
.addMethod(getListProcessorVersionsMethod())
.addMethod(getDeleteProcessorVersionMethod())
@@ -2357,6 +2855,9 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
.addMethod(getDisableProcessorMethod())
.addMethod(getSetDefaultProcessorVersionMethod())
.addMethod(getReviewDocumentMethod())
+ .addMethod(getEvaluateProcessorVersionMethod())
+ .addMethod(getGetEvaluationMethod())
+ .addMethod(getListEvaluationsMethod())
.build();
}
}
diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/Barcode.java b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/Barcode.java
index 09971da4e65c..037dc46ad7a3 100644
--- a/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/Barcode.java
+++ b/java-document-ai/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/Barcode.java
@@ -77,20 +77,20 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
*