batchProcessDocuments
* }
* }
*
- * @param parent Required. The project of processor type to list. The available processor types
- * may depend on the allow-listing on projects. Format:
- * `projects/{project}/locations/{location}`
+ * @param parent Required. The location of processor types to list. Format:
+ * `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final FetchProcessorTypesResponse fetchProcessorTypes(LocationName parent) {
@@ -559,8 +559,9 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(LocationName parent
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
- * paginated.
+ * Fetches processor types. Note that we don't use
+ * [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
+ * here, because it isn't paginated.
*
* Sample code:
*
@@ -578,9 +579,8 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(LocationName parent
* }
* }
*
- * @param parent Required. The project of processor type to list. The available processor types
- * may depend on the allow-listing on projects. Format:
- * `projects/{project}/locations/{location}`
+ * @param parent Required. The location of processor types to list. Format:
+ * `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final FetchProcessorTypesResponse fetchProcessorTypes(String parent) {
@@ -591,8 +591,9 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(String parent) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
- * paginated.
+ * Fetches processor types. Note that we don't use
+ * [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
+ * here, because it isn't paginated.
*
*
Sample code:
*
@@ -622,8 +623,9 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(FetchProcessorTypes
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
- * paginated.
+ * Fetches processor types. Note that we don't use
+ * [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
+ * here, because it isn't paginated.
*
*
Sample code:
*
@@ -673,9 +675,8 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(FetchProcessorTypes
* }
* }
*
- * @param parent Required. The location of processor type to list. The available processor types
- * may depend on the allow-listing on projects. Format:
- * `projects/{project}/locations/{location}`
+ * @param parent Required. The location of processor types to list. Format:
+ * `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListProcessorTypesPagedResponse listProcessorTypes(LocationName parent) {
@@ -708,9 +709,8 @@ public final ListProcessorTypesPagedResponse listProcessorTypes(LocationName par
* }
* }
*
- * @param parent Required. The location of processor type to list. The available processor types
- * may depend on the allow-listing on projects. Format:
- * `projects/{project}/locations/{location}`
+ * @param parent Required. The location of processor types to list. Format:
+ * `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListProcessorTypesPagedResponse listProcessorTypes(String parent) {
@@ -1232,7 +1232,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -1269,7 +1269,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -1306,7 +1306,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -1342,7 +1342,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -1382,7 +1382,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -2223,8 +2223,8 @@ public final OperationFuture deleteProces
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Creates a processor from the type processor that the user chose. The processor will be at
- * "ENABLED" state by default after its creation.
+ * Creates a processor from the [ProcessorType][google.cloud.documentai.v1.ProcessorType]
+ * provided. The processor will be at `ENABLED` state by default after its creation.
*
* Sample code:
*
@@ -2244,8 +2244,11 @@ public final OperationFuture deleteProces
*
* @param parent Required. The parent (project and location) under which to create the processor.
* Format: `projects/{project}/locations/{location}`
- * @param processor Required. The processor to be created, requires [processor_type] and
- * [display_name] to be set. Also, the processor is under CMEK if CMEK fields are set.
+ * @param processor Required. The processor to be created, requires
+ * [Processor.type][google.cloud.documentai.v1.Processor.type] and [Processor.display_name]][]
+ * to be set. Also, the
+ * [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] field must be
+ * set if the processor is under CMEK.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Processor createProcessor(LocationName parent, Processor processor) {
@@ -2259,8 +2262,8 @@ public final Processor createProcessor(LocationName parent, Processor processor)
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Creates a processor from the type processor that the user chose. The processor will be at
- * "ENABLED" state by default after its creation.
+ * Creates a processor from the [ProcessorType][google.cloud.documentai.v1.ProcessorType]
+ * provided. The processor will be at `ENABLED` state by default after its creation.
*
* Sample code:
*
@@ -2280,8 +2283,11 @@ public final Processor createProcessor(LocationName parent, Processor processor)
*
* @param parent Required. The parent (project and location) under which to create the processor.
* Format: `projects/{project}/locations/{location}`
- * @param processor Required. The processor to be created, requires [processor_type] and
- * [display_name] to be set. Also, the processor is under CMEK if CMEK fields are set.
+ * @param processor Required. The processor to be created, requires
+ * [Processor.type][google.cloud.documentai.v1.Processor.type] and [Processor.display_name]][]
+ * to be set. Also, the
+ * [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] field must be
+ * set if the processor is under CMEK.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Processor createProcessor(String parent, Processor processor) {
@@ -2292,8 +2298,8 @@ public final Processor createProcessor(String parent, Processor processor) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Creates a processor from the type processor that the user chose. The processor will be at
- * "ENABLED" state by default after its creation.
+ * Creates a processor from the [ProcessorType][google.cloud.documentai.v1.ProcessorType]
+ * provided. The processor will be at `ENABLED` state by default after its creation.
*
*
Sample code:
*
@@ -2323,8 +2329,8 @@ public final Processor createProcessor(CreateProcessorRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Creates a processor from the type processor that the user chose. The processor will be at
- * "ENABLED" state by default after its creation.
+ * Creates a processor from the [ProcessorType][google.cloud.documentai.v1.ProcessorType]
+ * provided. The processor will be at `ENABLED` state by default after its creation.
*
*
Sample code:
*
@@ -2825,8 +2831,9 @@ public final UnaryCallable disableProcessorC
* }
* }
*
- * @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document
- * will be reviewed with.
+ * @param humanReviewConfig Required. The resource name of the
+ * [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the document will be
+ * reviewed with.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture
@@ -2860,8 +2867,9 @@ public final UnaryCallable disableProcessorC
* }
* }
*
- * @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document
- * will be reviewed with.
+ * @param humanReviewConfig Required. The resource name of the
+ * [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the document will be
+ * reviewed with.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1/package-info.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1/package-info.java
index e4724fc41c7a..7656b669c7fd 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1/package-info.java
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1/package-info.java
@@ -21,7 +21,7 @@
*
* ======================= DocumentProcessorServiceClient =======================
*
- *
Service Description: Service to call Cloud DocumentAI to process documents according to the
+ *
Service Description: Service to call Document AI to process documents according to the
* processor's definition. Processors are built using state-of-the-art Google AI such as natural
* language, computer vision, and translation to extract structured information from unstructured or
* semi-structured documents.
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1/stub/DocumentProcessorServiceStubSettings.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1/stub/DocumentProcessorServiceStubSettings.java
index 6a7e5f0a0df9..347955b08128 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1/stub/DocumentProcessorServiceStubSettings.java
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1/stub/DocumentProcessorServiceStubSettings.java
@@ -1023,6 +1023,11 @@ public static class Builder
ImmutableSet.copyOf(
Lists.newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
+ definitions.put(
+ "retry_policy_1_codes",
+ ImmutableSet.copyOf(
+ Lists.newArrayList(
+ StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -1032,6 +1037,17 @@ public static class Builder
static {
ImmutableMap.Builder definitions = ImmutableMap.builder();
RetrySettings settings = null;
+ settings =
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(100L))
+ .setRetryDelayMultiplier(1.3)
+ .setMaxRetryDelay(Duration.ofMillis(60000L))
+ .setInitialRpcTimeout(Duration.ofMillis(300000L))
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ofMillis(300000L))
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build();
+ definitions.put("retry_policy_0_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
@@ -1042,7 +1058,7 @@ public static class Builder
.setMaxRpcTimeout(Duration.ofMillis(120000L))
.setTotalTimeout(Duration.ofMillis(120000L))
.build();
- definitions.put("retry_policy_0_params", settings);
+ definitions.put("retry_policy_1_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
@@ -1229,8 +1245,8 @@ private static Builder initDefaults(Builder builder) {
builder
.batchProcessDocumentsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.fetchProcessorTypesSettings()
@@ -1314,8 +1330,8 @@ private static Builder initDefaults(Builder builder) {
builder
.reviewDocumentSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.evaluateProcessorVersionSettings()
@@ -1347,8 +1363,8 @@ private static Builder initDefaults(Builder builder) {
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(BatchProcessResponse.class))
@@ -1573,8 +1589,8 @@ private static Builder initDefaults(Builder builder) {
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(ReviewDocumentResponse.class))
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java
index 7b798fd59deb..1e43f32f072b 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java
@@ -45,7 +45,7 @@
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * Service Description: Service to call Cloud DocumentAI to process documents according to the
+ * Service Description: Service to call Document AI to process documents according to the
* processor's definition. Processors are built using state-of-the-art Google AI such as natural
* language, computer vision, and translation to extract structured information from unstructured or
* semi-structured documents.
@@ -267,10 +267,7 @@ public final ProcessResponse processDocument(ResourceName name) {
* // 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();
+ * String name = DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString();
* ProcessResponse response = documentProcessorServiceClient.processDocument(name);
* }
* }
@@ -406,10 +403,7 @@ public final UnaryCallable processDocumentCalla
* // 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();
+ * String name = DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString();
* BatchProcessResponse response =
* documentProcessorServiceClient.batchProcessDocumentsAsync(name).get();
* }
@@ -543,8 +537,9 @@ public final UnaryCallable batchProcessDocuments
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
- * paginated.
+ * Fetches processor types. Note that we don't use
+ * [ListProcessorTypes][google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorTypes]
+ * here, because it isn't paginated.
*
* Sample code:
*
@@ -562,9 +557,8 @@ public final UnaryCallable batchProcessDocuments
* }
* }
*
- * @param parent Required. The project of processor type to list. The available processor types
- * may depend on the allow-listing on projects. Format:
- * `projects/{project}/locations/{location}`
+ * @param parent Required. The location of processor types to list. Format:
+ * `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final FetchProcessorTypesResponse fetchProcessorTypes(LocationName parent) {
@@ -577,8 +571,9 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(LocationName parent
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
- * paginated.
+ * Fetches processor types. Note that we don't use
+ * [ListProcessorTypes][google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorTypes]
+ * here, because it isn't paginated.
*
* Sample code:
*
@@ -596,9 +591,8 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(LocationName parent
* }
* }
*
- * @param parent Required. The project of processor type to list. The available processor types
- * may depend on the allow-listing on projects. Format:
- * `projects/{project}/locations/{location}`
+ * @param parent Required. The location of processor types to list. Format:
+ * `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final FetchProcessorTypesResponse fetchProcessorTypes(String parent) {
@@ -609,8 +603,9 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(String parent) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
- * paginated.
+ * Fetches processor types. Note that we don't use
+ * [ListProcessorTypes][google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorTypes]
+ * here, because it isn't paginated.
*
*
Sample code:
*
@@ -640,8 +635,9 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(FetchProcessorTypes
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
- * paginated.
+ * Fetches processor types. Note that we don't use
+ * [ListProcessorTypes][google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessorTypes]
+ * here, because it isn't paginated.
*
*
Sample code:
*
@@ -691,9 +687,8 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(FetchProcessorTypes
* }
* }
*
- * @param parent Required. The location of processor type to list. The available processor types
- * may depend on the allow-listing on projects. Format:
- * `projects/{project}/locations/{location}`
+ * @param parent Required. The location of processor types to list. Format:
+ * `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListProcessorTypesPagedResponse listProcessorTypes(LocationName parent) {
@@ -726,9 +721,8 @@ public final ListProcessorTypesPagedResponse listProcessorTypes(LocationName par
* }
* }
*
- * @param parent Required. The location of processor type to list. The available processor types
- * may depend on the allow-listing on projects. Format:
- * `projects/{project}/locations/{location}`
+ * @param parent Required. The location of processor types to list. Format:
+ * `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListProcessorTypesPagedResponse listProcessorTypes(String parent) {
@@ -1250,7 +1244,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -1287,7 +1281,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -1324,7 +1318,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -1360,7 +1354,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -1400,7 +1394,7 @@ public final UnaryCallable getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
- * cloud_documentai_core.TrainProcessorVersionMetadata.
+ * [TrainProcessorVersionMetadata][google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata].
*
* Sample code:
*
@@ -2241,8 +2235,8 @@ public final OperationFuture deleteProces
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Creates a processor from the type processor that the user chose. The processor will be at
- * "ENABLED" state by default after its creation.
+ * Creates a processor from the [ProcessorType][google.cloud.documentai.v1beta3.ProcessorType]
+ * provided. The processor will be at `ENABLED` state by default after its creation.
*
* Sample code:
*
@@ -2262,8 +2256,11 @@ public final OperationFuture deleteProces
*
* @param parent Required. The parent (project and location) under which to create the processor.
* Format: `projects/{project}/locations/{location}`
- * @param processor Required. The processor to be created, requires [processor_type] and
- * [display_name] to be set. Also, the processor is under CMEK if CMEK fields are set.
+ * @param processor Required. The processor to be created, requires
+ * [Processor.type][google.cloud.documentai.v1beta3.Processor.type] and
+ * [Processor.display_name]][] to be set. Also, the
+ * [Processor.kms_key_name][google.cloud.documentai.v1beta3.Processor.kms_key_name] field must
+ * be set if the processor is under CMEK.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Processor createProcessor(LocationName parent, Processor processor) {
@@ -2277,8 +2274,8 @@ public final Processor createProcessor(LocationName parent, Processor processor)
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Creates a processor from the type processor that the user chose. The processor will be at
- * "ENABLED" state by default after its creation.
+ * Creates a processor from the [ProcessorType][google.cloud.documentai.v1beta3.ProcessorType]
+ * provided. The processor will be at `ENABLED` state by default after its creation.
*
* Sample code:
*
@@ -2298,8 +2295,11 @@ public final Processor createProcessor(LocationName parent, Processor processor)
*
* @param parent Required. The parent (project and location) under which to create the processor.
* Format: `projects/{project}/locations/{location}`
- * @param processor Required. The processor to be created, requires [processor_type] and
- * [display_name] to be set. Also, the processor is under CMEK if CMEK fields are set.
+ * @param processor Required. The processor to be created, requires
+ * [Processor.type][google.cloud.documentai.v1beta3.Processor.type] and
+ * [Processor.display_name]][] to be set. Also, the
+ * [Processor.kms_key_name][google.cloud.documentai.v1beta3.Processor.kms_key_name] field must
+ * be set if the processor is under CMEK.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Processor createProcessor(String parent, Processor processor) {
@@ -2310,8 +2310,8 @@ public final Processor createProcessor(String parent, Processor processor) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Creates a processor from the type processor that the user chose. The processor will be at
- * "ENABLED" state by default after its creation.
+ * Creates a processor from the [ProcessorType][google.cloud.documentai.v1beta3.ProcessorType]
+ * provided. The processor will be at `ENABLED` state by default after its creation.
*
*
Sample code:
*
@@ -2341,8 +2341,8 @@ public final Processor createProcessor(CreateProcessorRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Creates a processor from the type processor that the user chose. The processor will be at
- * "ENABLED" state by default after its creation.
+ * Creates a processor from the [ProcessorType][google.cloud.documentai.v1beta3.ProcessorType]
+ * provided. The processor will be at `ENABLED` state by default after its creation.
*
*
Sample code:
*
@@ -2843,7 +2843,8 @@ public final UnaryCallable disableProcessorC
* }
* }
*
- * @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document
+ * @param humanReviewConfig Required. The resource name of the
+ * [HumanReviewConfig][google.cloud.documentai.v1beta3.HumanReviewConfig] that the document
* will be reviewed with.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -2878,7 +2879,8 @@ public final UnaryCallable disableProcessorC
* }
* }
*
- * @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document
+ * @param humanReviewConfig Required. The resource name of the
+ * [HumanReviewConfig][google.cloud.documentai.v1beta3.HumanReviewConfig] that the document
* will be reviewed with.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentServiceClient.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentServiceClient.java
new file mode 100644
index 000000000000..639e94ee0733
--- /dev/null
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentServiceClient.java
@@ -0,0 +1,801 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.documentai.v1beta3;
+
+import com.google.api.core.ApiFuture;
+import com.google.api.core.ApiFutures;
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.httpjson.longrunning.OperationsClient;
+import com.google.api.gax.longrunning.OperationFuture;
+import com.google.api.gax.paging.AbstractFixedSizeCollection;
+import com.google.api.gax.paging.AbstractPage;
+import com.google.api.gax.paging.AbstractPagedListResponse;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PageContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.documentai.v1beta3.stub.DocumentServiceStub;
+import com.google.cloud.documentai.v1beta3.stub.DocumentServiceStubSettings;
+import com.google.cloud.location.GetLocationRequest;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.longrunning.Operation;
+import com.google.protobuf.FieldMask;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Service Description: Service to call Cloud DocumentAI to manage document collection (dataset).
+ *
+ * This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ *
{@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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * DatasetSchemaName name = DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+ * DatasetSchema response = documentServiceClient.getDatasetSchema(name);
+ * }
+ * }
+ *
+ * Note: close() needs to be called on the DocumentServiceClient object to clean up resources
+ * such as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's
+ * methods:
+ *
+ *
+ * - A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available as
+ * parameters, and not every API method will have a flattened method entry point.
+ *
- A "request object" method. This type of method only takes one parameter, a request object,
+ * which must be constructed before the call. Not every API method will have a request object
+ * method.
+ *
- A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
+ *
+ *
+ * See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist with
+ * these names, this class includes a format method for each type of name, and additionally a parse
+ * method to extract the individual identifiers contained within names that are returned.
+ *
+ *
This class can be customized by passing in a custom instance of DocumentServiceSettings to
+ * create(). For example:
+ *
+ *
To customize credentials:
+ *
+ *
{@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
+ * DocumentServiceSettings documentServiceSettings =
+ * DocumentServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * DocumentServiceClient documentServiceClient =
+ * DocumentServiceClient.create(documentServiceSettings);
+ * }
+ *
+ * To customize the endpoint:
+ *
+ *
{@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
+ * DocumentServiceSettings documentServiceSettings =
+ * DocumentServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * DocumentServiceClient documentServiceClient =
+ * DocumentServiceClient.create(documentServiceSettings);
+ * }
+ *
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@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
+ * DocumentServiceSettings documentServiceSettings =
+ * DocumentServiceSettings.newHttpJsonBuilder().build();
+ * DocumentServiceClient documentServiceClient =
+ * DocumentServiceClient.create(documentServiceSettings);
+ * }
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class DocumentServiceClient implements BackgroundResource {
+ private final DocumentServiceSettings settings;
+ private final DocumentServiceStub stub;
+ private final OperationsClient httpJsonOperationsClient;
+ private final com.google.longrunning.OperationsClient operationsClient;
+
+ /** Constructs an instance of DocumentServiceClient with default settings. */
+ public static final DocumentServiceClient create() throws IOException {
+ return create(DocumentServiceSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of DocumentServiceClient, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final DocumentServiceClient create(DocumentServiceSettings settings)
+ throws IOException {
+ return new DocumentServiceClient(settings);
+ }
+
+ /**
+ * Constructs an instance of DocumentServiceClient, using the given stub for making calls. This is
+ * for advanced usage - prefer using create(DocumentServiceSettings).
+ */
+ public static final DocumentServiceClient create(DocumentServiceStub stub) {
+ return new DocumentServiceClient(stub);
+ }
+
+ /**
+ * Constructs an instance of DocumentServiceClient, using the given settings. This is protected so
+ * that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected DocumentServiceClient(DocumentServiceSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((DocumentServiceStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
+ }
+
+ protected DocumentServiceClient(DocumentServiceStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
+ }
+
+ public final DocumentServiceSettings getSettings() {
+ return settings;
+ }
+
+ public DocumentServiceStub getStub() {
+ return stub;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ public final com.google.longrunning.OperationsClient getOperationsClient() {
+ return operationsClient;
+ }
+
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ @BetaApi
+ public final OperationsClient getHttpJsonOperationsClient() {
+ return httpJsonOperationsClient;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates metadata associated with a dataset.
+ *
+ *
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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * Dataset dataset = Dataset.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * Dataset response = documentServiceClient.updateDatasetAsync(dataset, updateMask).get();
+ * }
+ * }
+ *
+ * @param dataset Required. The `name` field of the `Dataset` is used to identify the resource to
+ * be updated.
+ * @param updateMask The update mask applies to the resource.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture updateDatasetAsync(
+ Dataset dataset, FieldMask updateMask) {
+ UpdateDatasetRequest request =
+ UpdateDatasetRequest.newBuilder().setDataset(dataset).setUpdateMask(updateMask).build();
+ return updateDatasetAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates metadata associated with a dataset.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * UpdateDatasetRequest request =
+ * UpdateDatasetRequest.newBuilder()
+ * .setDataset(Dataset.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * Dataset response = documentServiceClient.updateDatasetAsync(request).get();
+ * }
+ * }
+ *
+ * @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 OperationFuture updateDatasetAsync(
+ UpdateDatasetRequest request) {
+ return updateDatasetOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates metadata associated with a dataset.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * UpdateDatasetRequest request =
+ * UpdateDatasetRequest.newBuilder()
+ * .setDataset(Dataset.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * OperationFuture future =
+ * documentServiceClient.updateDatasetOperationCallable().futureCall(request);
+ * // Do something.
+ * Dataset response = future.get();
+ * }
+ * }
+ */
+ public final OperationCallable
+ updateDatasetOperationCallable() {
+ return stub.updateDatasetOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates metadata associated with a dataset.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * UpdateDatasetRequest request =
+ * UpdateDatasetRequest.newBuilder()
+ * .setDataset(Dataset.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * documentServiceClient.updateDatasetCallable().futureCall(request);
+ * // Do something.
+ * Operation response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable updateDatasetCallable() {
+ return stub.updateDatasetCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the `DatasetSchema` of a `Dataset`.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * DatasetSchemaName name = DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+ * DatasetSchema response = documentServiceClient.getDatasetSchema(name);
+ * }
+ * }
+ *
+ * @param name Required. The dataset schema resource name. Format:
+ * projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final DatasetSchema getDatasetSchema(DatasetSchemaName name) {
+ GetDatasetSchemaRequest request =
+ GetDatasetSchemaRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getDatasetSchema(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the `DatasetSchema` of a `Dataset`.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * String name = DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString();
+ * DatasetSchema response = documentServiceClient.getDatasetSchema(name);
+ * }
+ * }
+ *
+ * @param name Required. The dataset schema resource name. Format:
+ * projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final DatasetSchema getDatasetSchema(String name) {
+ GetDatasetSchemaRequest request = GetDatasetSchemaRequest.newBuilder().setName(name).build();
+ return getDatasetSchema(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the `DatasetSchema` of a `Dataset`.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * GetDatasetSchemaRequest request =
+ * GetDatasetSchemaRequest.newBuilder()
+ * .setName(DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
+ * .setVisibleFieldsOnly(true)
+ * .build();
+ * DatasetSchema response = documentServiceClient.getDatasetSchema(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 DatasetSchema getDatasetSchema(GetDatasetSchemaRequest request) {
+ return getDatasetSchemaCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the `DatasetSchema` of a `Dataset`.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * GetDatasetSchemaRequest request =
+ * GetDatasetSchemaRequest.newBuilder()
+ * .setName(DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]").toString())
+ * .setVisibleFieldsOnly(true)
+ * .build();
+ * ApiFuture future =
+ * documentServiceClient.getDatasetSchemaCallable().futureCall(request);
+ * // Do something.
+ * DatasetSchema response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getDatasetSchemaCallable() {
+ return stub.getDatasetSchemaCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates a `DatasetSchema`.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * DatasetSchema datasetSchema = DatasetSchema.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * DatasetSchema response = documentServiceClient.updateDatasetSchema(datasetSchema, updateMask);
+ * }
+ * }
+ *
+ * @param datasetSchema Required. The name field of the `DatasetSchema` is used to identify the
+ * resource to be updated.
+ * @param updateMask The update mask applies to the resource.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final DatasetSchema updateDatasetSchema(
+ DatasetSchema datasetSchema, FieldMask updateMask) {
+ UpdateDatasetSchemaRequest request =
+ UpdateDatasetSchemaRequest.newBuilder()
+ .setDatasetSchema(datasetSchema)
+ .setUpdateMask(updateMask)
+ .build();
+ return updateDatasetSchema(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates a `DatasetSchema`.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * UpdateDatasetSchemaRequest request =
+ * UpdateDatasetSchemaRequest.newBuilder()
+ * .setDatasetSchema(DatasetSchema.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * DatasetSchema response = documentServiceClient.updateDatasetSchema(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 DatasetSchema updateDatasetSchema(UpdateDatasetSchemaRequest request) {
+ return updateDatasetSchemaCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates a `DatasetSchema`.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * UpdateDatasetSchemaRequest request =
+ * UpdateDatasetSchemaRequest.newBuilder()
+ * .setDatasetSchema(DatasetSchema.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * documentServiceClient.updateDatasetSchemaCallable().futureCall(request);
+ * // Do something.
+ * DatasetSchema response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ updateDatasetSchemaCallable() {
+ return stub.updateDatasetSchemaCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (Location element : documentServiceClient.listLocations(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 ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
+ return listLocationsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future =
+ * documentServiceClient.listLocationsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Location element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listLocationsPagedCallable() {
+ return stub.listLocationsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListLocationsResponse response =
+ * documentServiceClient.listLocationsCallable().call(request);
+ * for (Location element : response.getLocationsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable listLocationsCallable() {
+ return stub.listLocationsCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets information about a location.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+ * Location response = documentServiceClient.getLocation(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 Location getLocation(GetLocationRequest request) {
+ return getLocationCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets information about a location.
+ *
+ * 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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+ * ApiFuture future = documentServiceClient.getLocationCallable().futureCall(request);
+ * // Do something.
+ * Location response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getLocationCallable() {
+ return stub.getLocationCallable();
+ }
+
+ @Override
+ public final void close() {
+ stub.close();
+ }
+
+ @Override
+ public void shutdown() {
+ stub.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return stub.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return stub.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ stub.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return stub.awaitTermination(duration, unit);
+ }
+
+ public static class ListLocationsPagedResponse
+ extends AbstractPagedListResponse<
+ ListLocationsRequest,
+ ListLocationsResponse,
+ Location,
+ ListLocationsPage,
+ ListLocationsFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ input -> new ListLocationsPagedResponse(input),
+ MoreExecutors.directExecutor());
+ }
+
+ private ListLocationsPagedResponse(ListLocationsPage page) {
+ super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListLocationsPage
+ extends AbstractPage<
+ ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
+
+ private ListLocationsPage(
+ PageContext context,
+ ListLocationsResponse response) {
+ super(context, response);
+ }
+
+ private static ListLocationsPage createEmptyPage() {
+ return new ListLocationsPage(null, null);
+ }
+
+ @Override
+ protected ListLocationsPage createPage(
+ PageContext context,
+ ListLocationsResponse response) {
+ return new ListLocationsPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListLocationsFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListLocationsRequest,
+ ListLocationsResponse,
+ Location,
+ ListLocationsPage,
+ ListLocationsFixedSizeCollection> {
+
+ private ListLocationsFixedSizeCollection(List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListLocationsFixedSizeCollection createEmptyCollection() {
+ return new ListLocationsFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListLocationsFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListLocationsFixedSizeCollection(pages, collectionSize);
+ }
+ }
+}
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentServiceSettings.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentServiceSettings.java
new file mode 100644
index 000000000000..fcbd2828a62d
--- /dev/null
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentServiceSettings.java
@@ -0,0 +1,274 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.documentai.v1beta3;
+
+import static com.google.cloud.documentai.v1beta3.DocumentServiceClient.ListLocationsPagedResponse;
+
+import com.google.api.core.ApiFunction;
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.GoogleCredentialsProvider;
+import com.google.api.gax.core.InstantiatingExecutorProvider;
+import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientSettings;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.TransportChannelProvider;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.cloud.documentai.v1beta3.stub.DocumentServiceStubSettings;
+import com.google.cloud.location.GetLocationRequest;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.longrunning.Operation;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Settings class to configure an instance of {@link DocumentServiceClient}.
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ *
+ * - The default service address (documentai.googleapis.com) and default port (443) are used.
+ *
- Credentials are acquired automatically through Application Default Credentials.
+ *
- Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ *
For example, to set the total timeout of getDatasetSchema to 30 seconds:
+ *
+ *
{@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
+ * DocumentServiceSettings.Builder documentServiceSettingsBuilder =
+ * DocumentServiceSettings.newBuilder();
+ * documentServiceSettingsBuilder
+ * .getDatasetSchemaSettings()
+ * .setRetrySettings(
+ * documentServiceSettingsBuilder
+ * .getDatasetSchemaSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * DocumentServiceSettings documentServiceSettings = documentServiceSettingsBuilder.build();
+ * }
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class DocumentServiceSettings extends ClientSettings {
+
+ /** Returns the object with the settings used for calls to updateDataset. */
+ public UnaryCallSettings updateDatasetSettings() {
+ return ((DocumentServiceStubSettings) getStubSettings()).updateDatasetSettings();
+ }
+
+ /** Returns the object with the settings used for calls to updateDataset. */
+ public OperationCallSettings
+ updateDatasetOperationSettings() {
+ return ((DocumentServiceStubSettings) getStubSettings()).updateDatasetOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to getDatasetSchema. */
+ public UnaryCallSettings getDatasetSchemaSettings() {
+ return ((DocumentServiceStubSettings) getStubSettings()).getDatasetSchemaSettings();
+ }
+
+ /** Returns the object with the settings used for calls to updateDatasetSchema. */
+ public UnaryCallSettings
+ updateDatasetSchemaSettings() {
+ return ((DocumentServiceStubSettings) getStubSettings()).updateDatasetSchemaSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listLocations. */
+ public PagedCallSettings
+ listLocationsSettings() {
+ return ((DocumentServiceStubSettings) getStubSettings()).listLocationsSettings();
+ }
+
+ /** Returns the object with the settings used for calls to getLocation. */
+ public UnaryCallSettings getLocationSettings() {
+ return ((DocumentServiceStubSettings) getStubSettings()).getLocationSettings();
+ }
+
+ public static final DocumentServiceSettings create(DocumentServiceStubSettings stub)
+ throws IOException {
+ return new DocumentServiceSettings.Builder(stub.toBuilder()).build();
+ }
+
+ /** Returns a builder for the default ExecutorProvider for this service. */
+ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
+ return DocumentServiceStubSettings.defaultExecutorProviderBuilder();
+ }
+
+ /** Returns the default service endpoint. */
+ public static String getDefaultEndpoint() {
+ return DocumentServiceStubSettings.getDefaultEndpoint();
+ }
+
+ /** Returns the default service scopes. */
+ public static List getDefaultServiceScopes() {
+ return DocumentServiceStubSettings.getDefaultServiceScopes();
+ }
+
+ /** Returns a builder for the default credentials for this service. */
+ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
+ return DocumentServiceStubSettings.defaultCredentialsProviderBuilder();
+ }
+
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
+ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
+ return DocumentServiceStubSettings.defaultGrpcTransportProviderBuilder();
+ }
+
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return DocumentServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
+ public static TransportChannelProvider defaultTransportChannelProvider() {
+ return DocumentServiceStubSettings.defaultTransportChannelProvider();
+ }
+
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return DocumentServiceStubSettings.defaultApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
+ public static Builder newBuilder() {
+ return Builder.createDefault();
+ }
+
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder(ClientContext clientContext) {
+ return new Builder(clientContext);
+ }
+
+ /** Returns a builder containing all the values of this settings class. */
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ protected DocumentServiceSettings(Builder settingsBuilder) throws IOException {
+ super(settingsBuilder);
+ }
+
+ /** Builder for DocumentServiceSettings. */
+ public static class Builder extends ClientSettings.Builder {
+
+ protected Builder() throws IOException {
+ this(((ClientContext) null));
+ }
+
+ protected Builder(ClientContext clientContext) {
+ super(DocumentServiceStubSettings.newBuilder(clientContext));
+ }
+
+ protected Builder(DocumentServiceSettings settings) {
+ super(settings.getStubSettings().toBuilder());
+ }
+
+ protected Builder(DocumentServiceStubSettings.Builder stubSettings) {
+ super(stubSettings);
+ }
+
+ private static Builder createDefault() {
+ return new Builder(DocumentServiceStubSettings.newBuilder());
+ }
+
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(DocumentServiceStubSettings.newHttpJsonBuilder());
+ }
+
+ public DocumentServiceStubSettings.Builder getStubSettingsBuilder() {
+ return ((DocumentServiceStubSettings.Builder) getStubSettings());
+ }
+
+ /**
+ * Applies the given settings updater function to all of the unary API methods in this service.
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction, Void> settingsUpdater) {
+ super.applyToAllUnaryMethods(
+ getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
+ return this;
+ }
+
+ /** Returns the builder for the settings used for calls to updateDataset. */
+ public UnaryCallSettings.Builder updateDatasetSettings() {
+ return getStubSettingsBuilder().updateDatasetSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to updateDataset. */
+ public OperationCallSettings.Builder<
+ UpdateDatasetRequest, Dataset, UpdateDatasetOperationMetadata>
+ updateDatasetOperationSettings() {
+ return getStubSettingsBuilder().updateDatasetOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to getDatasetSchema. */
+ public UnaryCallSettings.Builder
+ getDatasetSchemaSettings() {
+ return getStubSettingsBuilder().getDatasetSchemaSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to updateDatasetSchema. */
+ public UnaryCallSettings.Builder
+ updateDatasetSchemaSettings() {
+ return getStubSettingsBuilder().updateDatasetSchemaSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listLocations. */
+ public PagedCallSettings.Builder<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ listLocationsSettings() {
+ return getStubSettingsBuilder().listLocationsSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to getLocation. */
+ public UnaryCallSettings.Builder getLocationSettings() {
+ return getStubSettingsBuilder().getLocationSettings();
+ }
+
+ @Override
+ public DocumentServiceSettings build() throws IOException {
+ return new DocumentServiceSettings(this);
+ }
+ }
+}
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 301f4cbec589..f3dad60bf858 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
@@ -88,6 +88,30 @@
}
}
}
+ },
+ "DocumentService": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "DocumentServiceClient",
+ "rpcs": {
+ "GetDatasetSchema": {
+ "methods": ["getDatasetSchema", "getDatasetSchema", "getDatasetSchema", "getDatasetSchemaCallable"]
+ },
+ "GetLocation": {
+ "methods": ["getLocation", "getLocationCallable"]
+ },
+ "ListLocations": {
+ "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
+ },
+ "UpdateDataset": {
+ "methods": ["updateDatasetAsync", "updateDatasetAsync", "updateDatasetOperationCallable", "updateDatasetCallable"]
+ },
+ "UpdateDatasetSchema": {
+ "methods": ["updateDatasetSchema", "updateDatasetSchema", "updateDatasetSchemaCallable"]
+ }
+ }
+ }
+ }
}
}
}
\ No newline at end of file
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java
index 1bb9490d0f7e..d40b13c216a0 100644
--- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java
@@ -21,7 +21,7 @@
*
* ======================= DocumentProcessorServiceClient =======================
*
- *
Service Description: Service to call Cloud DocumentAI to process documents according to the
+ *
Service Description: Service to call Document AI to process documents according to the
* processor's definition. Processors are built using state-of-the-art Google AI such as natural
* language, computer vision, and translation to extract structured information from unstructured or
* semi-structured documents.
@@ -40,6 +40,24 @@
* ProcessResponse response = documentProcessorServiceClient.processDocument(name);
* }
* }
+ *
+ *
======================= DocumentServiceClient =======================
+ *
+ *
Service Description: Service to call Cloud DocumentAI to manage document collection (dataset).
+ *
+ *
Sample for DocumentServiceClient:
+ *
+ *
{@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 (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
+ * DatasetSchemaName name = DatasetSchemaName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+ * DatasetSchema response = documentServiceClient.getDatasetSchema(name);
+ * }
+ * }
*/
@Generated("by gapic-generator-java")
package com.google.cloud.documentai.v1beta3;
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 66b47eaf722e..120210c288ca 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
@@ -1059,6 +1059,11 @@ public static class Builder
ImmutableSet.copyOf(
Lists.newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
+ definitions.put(
+ "retry_policy_1_codes",
+ ImmutableSet.copyOf(
+ Lists.newArrayList(
+ StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -1068,6 +1073,17 @@ public static class Builder
static {
ImmutableMap.Builder definitions = ImmutableMap.builder();
RetrySettings settings = null;
+ settings =
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(100L))
+ .setRetryDelayMultiplier(1.3)
+ .setMaxRetryDelay(Duration.ofMillis(60000L))
+ .setInitialRpcTimeout(Duration.ofMillis(300000L))
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ofMillis(300000L))
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build();
+ definitions.put("retry_policy_0_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
@@ -1078,7 +1094,7 @@ public static class Builder
.setMaxRpcTimeout(Duration.ofMillis(120000L))
.setTotalTimeout(Duration.ofMillis(120000L))
.build();
- definitions.put("retry_policy_0_params", settings);
+ definitions.put("retry_policy_1_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
@@ -1272,8 +1288,8 @@ private static Builder initDefaults(Builder builder) {
builder
.batchProcessDocumentsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.fetchProcessorTypesSettings()
@@ -1357,8 +1373,8 @@ private static Builder initDefaults(Builder builder) {
builder
.reviewDocumentSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.evaluateProcessorVersionSettings()
@@ -1395,8 +1411,8 @@ private static Builder initDefaults(Builder builder) {
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(BatchProcessResponse.class))
@@ -1621,8 +1637,8 @@ private static Builder initDefaults(Builder builder) {
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(ReviewDocumentResponse.class))
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentServiceStub.java
new file mode 100644
index 000000000000..2d1755e20c7d
--- /dev/null
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentServiceStub.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.documentai.v1beta3.stub;
+
+import static com.google.cloud.documentai.v1beta3.DocumentServiceClient.ListLocationsPagedResponse;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.documentai.v1beta3.Dataset;
+import com.google.cloud.documentai.v1beta3.DatasetSchema;
+import com.google.cloud.documentai.v1beta3.GetDatasetSchemaRequest;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetOperationMetadata;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetRequest;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetSchemaRequest;
+import com.google.cloud.location.GetLocationRequest;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the DocumentService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public abstract class DocumentServiceStub implements BackgroundResource {
+
+ public OperationsStub getOperationsStub() {
+ return null;
+ }
+
+ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
+ return null;
+ }
+
+ public OperationCallable
+ updateDatasetOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: updateDatasetOperationCallable()");
+ }
+
+ public UnaryCallable updateDatasetCallable() {
+ throw new UnsupportedOperationException("Not implemented: updateDatasetCallable()");
+ }
+
+ public UnaryCallable getDatasetSchemaCallable() {
+ throw new UnsupportedOperationException("Not implemented: getDatasetSchemaCallable()");
+ }
+
+ public UnaryCallable updateDatasetSchemaCallable() {
+ throw new UnsupportedOperationException("Not implemented: updateDatasetSchemaCallable()");
+ }
+
+ public UnaryCallable
+ listLocationsPagedCallable() {
+ throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
+ }
+
+ public UnaryCallable listLocationsCallable() {
+ throw new UnsupportedOperationException("Not implemented: listLocationsCallable()");
+ }
+
+ public UnaryCallable getLocationCallable() {
+ throw new UnsupportedOperationException("Not implemented: getLocationCallable()");
+ }
+
+ @Override
+ public abstract void close();
+}
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentServiceStubSettings.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentServiceStubSettings.java
new file mode 100644
index 000000000000..10f3ef710be1
--- /dev/null
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentServiceStubSettings.java
@@ -0,0 +1,541 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.documentai.v1beta3.stub;
+
+import static com.google.cloud.documentai.v1beta3.DocumentServiceClient.ListLocationsPagedResponse;
+
+import com.google.api.core.ApiFunction;
+import com.google.api.core.ApiFuture;
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.GaxProperties;
+import com.google.api.gax.core.GoogleCredentialsProvider;
+import com.google.api.gax.core.InstantiatingExecutorProvider;
+import com.google.api.gax.grpc.GaxGrpcProperties;
+import com.google.api.gax.grpc.GrpcTransportChannel;
+import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.grpc.ProtoOperationTransformers;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
+import com.google.api.gax.longrunning.OperationSnapshot;
+import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
+import com.google.api.gax.retrying.RetrySettings;
+import com.google.api.gax.rpc.ApiCallContext;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.PageContext;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.PagedListDescriptor;
+import com.google.api.gax.rpc.PagedListResponseFactory;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.StubSettings;
+import com.google.api.gax.rpc.TransportChannelProvider;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.documentai.v1beta3.Dataset;
+import com.google.cloud.documentai.v1beta3.DatasetSchema;
+import com.google.cloud.documentai.v1beta3.GetDatasetSchemaRequest;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetOperationMetadata;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetRequest;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetSchemaRequest;
+import com.google.cloud.location.GetLocationRequest;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.longrunning.Operation;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+import org.threeten.bp.Duration;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Settings class to configure an instance of {@link DocumentServiceStub}.
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ *
+ * - The default service address (documentai.googleapis.com) and default port (443) are used.
+ *
- Credentials are acquired automatically through Application Default Credentials.
+ *
- Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ *
For example, to set the total timeout of getDatasetSchema to 30 seconds:
+ *
+ *
{@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
+ * DocumentServiceStubSettings.Builder documentServiceSettingsBuilder =
+ * DocumentServiceStubSettings.newBuilder();
+ * documentServiceSettingsBuilder
+ * .getDatasetSchemaSettings()
+ * .setRetrySettings(
+ * documentServiceSettingsBuilder
+ * .getDatasetSchemaSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * DocumentServiceStubSettings documentServiceSettings = documentServiceSettingsBuilder.build();
+ * }
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class DocumentServiceStubSettings extends StubSettings {
+ /** The default scopes of the service. */
+ private static final ImmutableList DEFAULT_SERVICE_SCOPES =
+ ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build();
+
+ private final UnaryCallSettings updateDatasetSettings;
+ private final OperationCallSettings
+ updateDatasetOperationSettings;
+ private final UnaryCallSettings getDatasetSchemaSettings;
+ private final UnaryCallSettings
+ updateDatasetSchemaSettings;
+ private final PagedCallSettings<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ listLocationsSettings;
+ private final UnaryCallSettings getLocationSettings;
+
+ private static final PagedListDescriptor
+ LIST_LOCATIONS_PAGE_STR_DESC =
+ new PagedListDescriptor() {
+ @Override
+ public String emptyToken() {
+ return "";
+ }
+
+ @Override
+ public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) {
+ return ListLocationsRequest.newBuilder(payload).setPageToken(token).build();
+ }
+
+ @Override
+ public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) {
+ return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build();
+ }
+
+ @Override
+ public Integer extractPageSize(ListLocationsRequest payload) {
+ return payload.getPageSize();
+ }
+
+ @Override
+ public String extractNextToken(ListLocationsResponse payload) {
+ return payload.getNextPageToken();
+ }
+
+ @Override
+ public Iterable extractResources(ListLocationsResponse payload) {
+ return payload.getLocationsList() == null
+ ? ImmutableList.of()
+ : payload.getLocationsList();
+ }
+ };
+
+ private static final PagedListResponseFactory<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ LIST_LOCATIONS_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() {
+ @Override
+ public ApiFuture getFuturePagedResponse(
+ UnaryCallable callable,
+ ListLocationsRequest request,
+ ApiCallContext context,
+ ApiFuture futureResponse) {
+ PageContext pageContext =
+ PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context);
+ return ListLocationsPagedResponse.createAsync(pageContext, futureResponse);
+ }
+ };
+
+ /** Returns the object with the settings used for calls to updateDataset. */
+ public UnaryCallSettings updateDatasetSettings() {
+ return updateDatasetSettings;
+ }
+
+ /** Returns the object with the settings used for calls to updateDataset. */
+ public OperationCallSettings
+ updateDatasetOperationSettings() {
+ return updateDatasetOperationSettings;
+ }
+
+ /** Returns the object with the settings used for calls to getDatasetSchema. */
+ public UnaryCallSettings getDatasetSchemaSettings() {
+ return getDatasetSchemaSettings;
+ }
+
+ /** Returns the object with the settings used for calls to updateDatasetSchema. */
+ public UnaryCallSettings
+ updateDatasetSchemaSettings() {
+ return updateDatasetSchemaSettings;
+ }
+
+ /** Returns the object with the settings used for calls to listLocations. */
+ public PagedCallSettings
+ listLocationsSettings() {
+ return listLocationsSettings;
+ }
+
+ /** Returns the object with the settings used for calls to getLocation. */
+ public UnaryCallSettings getLocationSettings() {
+ return getLocationSettings;
+ }
+
+ public DocumentServiceStub createStub() throws IOException {
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(GrpcTransportChannel.getGrpcTransportName())) {
+ return GrpcDocumentServiceStub.create(this);
+ }
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonDocumentServiceStub.create(this);
+ }
+ throw new UnsupportedOperationException(
+ String.format(
+ "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
+ }
+
+ /** Returns a builder for the default ExecutorProvider for this service. */
+ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
+ return InstantiatingExecutorProvider.newBuilder();
+ }
+
+ /** Returns the default service endpoint. */
+ public static String getDefaultEndpoint() {
+ return "documentai.googleapis.com:443";
+ }
+
+ /** Returns the default mTLS service endpoint. */
+ public static String getDefaultMtlsEndpoint() {
+ return "documentai.mtls.googleapis.com:443";
+ }
+
+ /** Returns the default service scopes. */
+ public static List getDefaultServiceScopes() {
+ return DEFAULT_SERVICE_SCOPES;
+ }
+
+ /** Returns a builder for the default credentials for this service. */
+ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
+ return GoogleCredentialsProvider.newBuilder()
+ .setScopesToApply(DEFAULT_SERVICE_SCOPES)
+ .setUseJwtAccessWithScope(true);
+ }
+
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
+ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
+ return InstantiatingGrpcChannelProvider.newBuilder()
+ .setMaxInboundMessageSize(Integer.MAX_VALUE);
+ }
+
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
+ public static TransportChannelProvider defaultTransportChannelProvider() {
+ return defaultGrpcTransportProviderBuilder().build();
+ }
+
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(DocumentServiceStubSettings.class))
+ .setTransportToken(
+ GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
+ }
+
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(DocumentServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return DocumentServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
+ public static Builder newBuilder() {
+ return Builder.createDefault();
+ }
+
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder(ClientContext clientContext) {
+ return new Builder(clientContext);
+ }
+
+ /** Returns a builder containing all the values of this settings class. */
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ protected DocumentServiceStubSettings(Builder settingsBuilder) throws IOException {
+ super(settingsBuilder);
+
+ updateDatasetSettings = settingsBuilder.updateDatasetSettings().build();
+ updateDatasetOperationSettings = settingsBuilder.updateDatasetOperationSettings().build();
+ getDatasetSchemaSettings = settingsBuilder.getDatasetSchemaSettings().build();
+ updateDatasetSchemaSettings = settingsBuilder.updateDatasetSchemaSettings().build();
+ listLocationsSettings = settingsBuilder.listLocationsSettings().build();
+ getLocationSettings = settingsBuilder.getLocationSettings().build();
+ }
+
+ /** Builder for DocumentServiceStubSettings. */
+ public static class Builder extends StubSettings.Builder {
+ private final ImmutableList> unaryMethodSettingsBuilders;
+ private final UnaryCallSettings.Builder updateDatasetSettings;
+ private final OperationCallSettings.Builder<
+ UpdateDatasetRequest, Dataset, UpdateDatasetOperationMetadata>
+ updateDatasetOperationSettings;
+ private final UnaryCallSettings.Builder
+ getDatasetSchemaSettings;
+ private final UnaryCallSettings.Builder
+ updateDatasetSchemaSettings;
+ private final PagedCallSettings.Builder<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ listLocationsSettings;
+ private final UnaryCallSettings.Builder getLocationSettings;
+ private static final ImmutableMap>
+ RETRYABLE_CODE_DEFINITIONS;
+
+ static {
+ ImmutableMap.Builder> definitions =
+ ImmutableMap.builder();
+ definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
+ RETRYABLE_CODE_DEFINITIONS = definitions.build();
+ }
+
+ private static final ImmutableMap RETRY_PARAM_DEFINITIONS;
+
+ static {
+ ImmutableMap.Builder definitions = ImmutableMap.builder();
+ RetrySettings settings = null;
+ settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
+ definitions.put("no_retry_params", settings);
+ RETRY_PARAM_DEFINITIONS = definitions.build();
+ }
+
+ protected Builder() {
+ this(((ClientContext) null));
+ }
+
+ protected Builder(ClientContext clientContext) {
+ super(clientContext);
+
+ updateDatasetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ updateDatasetOperationSettings = OperationCallSettings.newBuilder();
+ getDatasetSchemaSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ updateDatasetSchemaSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
+ getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+
+ unaryMethodSettingsBuilders =
+ ImmutableList.>of(
+ updateDatasetSettings,
+ getDatasetSchemaSettings,
+ updateDatasetSchemaSettings,
+ listLocationsSettings,
+ getLocationSettings);
+ initDefaults(this);
+ }
+
+ protected Builder(DocumentServiceStubSettings settings) {
+ super(settings);
+
+ updateDatasetSettings = settings.updateDatasetSettings.toBuilder();
+ updateDatasetOperationSettings = settings.updateDatasetOperationSettings.toBuilder();
+ getDatasetSchemaSettings = settings.getDatasetSchemaSettings.toBuilder();
+ updateDatasetSchemaSettings = settings.updateDatasetSchemaSettings.toBuilder();
+ listLocationsSettings = settings.listLocationsSettings.toBuilder();
+ getLocationSettings = settings.getLocationSettings.toBuilder();
+
+ unaryMethodSettingsBuilders =
+ ImmutableList.>of(
+ updateDatasetSettings,
+ getDatasetSchemaSettings,
+ updateDatasetSchemaSettings,
+ listLocationsSettings,
+ getLocationSettings);
+ }
+
+ private static Builder createDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultTransportChannelProvider());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
+ private static Builder initDefaults(Builder builder) {
+ builder
+ .updateDatasetSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
+ builder
+ .getDatasetSchemaSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
+ builder
+ .updateDatasetSchemaSettings()
+ .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"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
+ builder
+ .getLocationSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
+
+ builder
+ .updateDatasetOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings
+ .newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(Dataset.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(
+ UpdateDatasetOperationMetadata.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;
+ }
+
+ /**
+ * Applies the given settings updater function to all of the unary API methods in this service.
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction, Void> settingsUpdater) {
+ super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
+ return this;
+ }
+
+ public ImmutableList> unaryMethodSettingsBuilders() {
+ return unaryMethodSettingsBuilders;
+ }
+
+ /** Returns the builder for the settings used for calls to updateDataset. */
+ public UnaryCallSettings.Builder updateDatasetSettings() {
+ return updateDatasetSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to updateDataset. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder<
+ UpdateDatasetRequest, Dataset, UpdateDatasetOperationMetadata>
+ updateDatasetOperationSettings() {
+ return updateDatasetOperationSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to getDatasetSchema. */
+ public UnaryCallSettings.Builder
+ getDatasetSchemaSettings() {
+ return getDatasetSchemaSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to updateDatasetSchema. */
+ public UnaryCallSettings.Builder
+ updateDatasetSchemaSettings() {
+ return updateDatasetSchemaSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to listLocations. */
+ public PagedCallSettings.Builder<
+ ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
+ listLocationsSettings() {
+ return listLocationsSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to getLocation. */
+ public UnaryCallSettings.Builder getLocationSettings() {
+ return getLocationSettings;
+ }
+
+ @Override
+ public DocumentServiceStubSettings build() throws IOException {
+ return new DocumentServiceStubSettings(this);
+ }
+ }
+}
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentServiceCallableFactory.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentServiceCallableFactory.java
new file mode 100644
index 000000000000..7626498004c5
--- /dev/null
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentServiceCallableFactory.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.documentai.v1beta3.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the DocumentService service API.
+ *
+ * This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcDocumentServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ GrpcCallSettings grpcCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ GrpcCallSettings grpcCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ GrpcCallSettings grpcCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createBatchingCallable(
+ grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ GrpcCallSettings grpcCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ return GrpcCallableFactory.createOperationCallable(
+ grpcCallSettings, callSettings, clientContext, operationsStub);
+ }
+
+ @Override
+ public
+ BidiStreamingCallable createBidiStreamingCallable(
+ GrpcCallSettings grpcCallSettings,
+ StreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createBidiStreamingCallable(
+ grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ GrpcCallSettings grpcCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createServerStreamingCallable(
+ grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ ClientStreamingCallable createClientStreamingCallable(
+ GrpcCallSettings grpcCallSettings,
+ StreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createClientStreamingCallable(
+ grpcCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentServiceStub.java
new file mode 100644
index 000000000000..af8922df392b
--- /dev/null
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentServiceStub.java
@@ -0,0 +1,323 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.documentai.v1beta3.stub;
+
+import static com.google.cloud.documentai.v1beta3.DocumentServiceClient.ListLocationsPagedResponse;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.RequestParamsBuilder;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.documentai.v1beta3.Dataset;
+import com.google.cloud.documentai.v1beta3.DatasetSchema;
+import com.google.cloud.documentai.v1beta3.GetDatasetSchemaRequest;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetOperationMetadata;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetRequest;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetSchemaRequest;
+import com.google.cloud.location.GetLocationRequest;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.GrpcOperationsStub;
+import io.grpc.MethodDescriptor;
+import io.grpc.protobuf.ProtoUtils;
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC stub implementation for the DocumentService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcDocumentServiceStub extends DocumentServiceStub {
+ private static final MethodDescriptor
+ updateDatasetMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.documentai.v1beta3.DocumentService/UpdateDataset")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(UpdateDatasetRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ getDatasetSchemaMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.documentai.v1beta3.DocumentService/GetDatasetSchema")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(GetDatasetSchemaRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(DatasetSchema.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ updateDatasetSchemaMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentService/UpdateDatasetSchema")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(UpdateDatasetSchemaRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(DatasetSchema.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ listLocationsMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.location.Locations/ListLocations")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor getLocationMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.location.Locations/GetLocation")
+ .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance()))
+ .build();
+
+ private final UnaryCallable updateDatasetCallable;
+ private final OperationCallable
+ updateDatasetOperationCallable;
+ private final UnaryCallable getDatasetSchemaCallable;
+ private final UnaryCallable
+ updateDatasetSchemaCallable;
+ private final UnaryCallable listLocationsCallable;
+ private final UnaryCallable
+ listLocationsPagedCallable;
+ private final UnaryCallable getLocationCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final GrpcOperationsStub operationsStub;
+ private final GrpcStubCallableFactory callableFactory;
+
+ public static final GrpcDocumentServiceStub create(DocumentServiceStubSettings settings)
+ throws IOException {
+ return new GrpcDocumentServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final GrpcDocumentServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new GrpcDocumentServiceStub(
+ DocumentServiceStubSettings.newBuilder().build(), clientContext);
+ }
+
+ public static final GrpcDocumentServiceStub create(
+ ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
+ return new GrpcDocumentServiceStub(
+ DocumentServiceStubSettings.newBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of GrpcDocumentServiceStub, using the given settings. This is protected
+ * so that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected GrpcDocumentServiceStub(
+ DocumentServiceStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new GrpcDocumentServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of GrpcDocumentServiceStub, using the given settings. This is protected
+ * so that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected GrpcDocumentServiceStub(
+ DocumentServiceStubSettings settings,
+ ClientContext clientContext,
+ GrpcStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+ this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
+
+ GrpcCallSettings updateDatasetTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(updateDatasetMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("dataset.name", String.valueOf(request.getDataset().getName()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings getDatasetSchemaTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(getDatasetSchemaMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings
+ updateDatasetSchemaTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(updateDatasetSchemaMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add(
+ "dataset_schema.name",
+ String.valueOf(request.getDatasetSchema().getName()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings listLocationsTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(listLocationsMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings getLocationTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(getLocationMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+
+ this.updateDatasetCallable =
+ callableFactory.createUnaryCallable(
+ updateDatasetTransportSettings, settings.updateDatasetSettings(), clientContext);
+ this.updateDatasetOperationCallable =
+ callableFactory.createOperationCallable(
+ updateDatasetTransportSettings,
+ settings.updateDatasetOperationSettings(),
+ clientContext,
+ operationsStub);
+ this.getDatasetSchemaCallable =
+ callableFactory.createUnaryCallable(
+ getDatasetSchemaTransportSettings, settings.getDatasetSchemaSettings(), clientContext);
+ this.updateDatasetSchemaCallable =
+ callableFactory.createUnaryCallable(
+ updateDatasetSchemaTransportSettings,
+ settings.updateDatasetSchemaSettings(),
+ clientContext);
+ this.listLocationsCallable =
+ callableFactory.createUnaryCallable(
+ listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
+ this.listLocationsPagedCallable =
+ callableFactory.createPagedCallable(
+ listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
+ this.getLocationCallable =
+ callableFactory.createUnaryCallable(
+ getLocationTransportSettings, settings.getLocationSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ public GrpcOperationsStub getOperationsStub() {
+ return operationsStub;
+ }
+
+ @Override
+ public UnaryCallable updateDatasetCallable() {
+ return updateDatasetCallable;
+ }
+
+ @Override
+ public OperationCallable
+ updateDatasetOperationCallable() {
+ return updateDatasetOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable getDatasetSchemaCallable() {
+ return getDatasetSchemaCallable;
+ }
+
+ @Override
+ public UnaryCallable updateDatasetSchemaCallable() {
+ return updateDatasetSchemaCallable;
+ }
+
+ @Override
+ public UnaryCallable listLocationsCallable() {
+ return listLocationsCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listLocationsPagedCallable() {
+ return listLocationsPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable getLocationCallable() {
+ return getLocationCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentServiceCallableFactory.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentServiceCallableFactory.java
new file mode 100644
index 000000000000..21034ed56f29
--- /dev/null
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentServiceCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.documentai.v1beta3.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the DocumentService service API.
+ *
+ * This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonDocumentServiceCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentServiceStub.java
new file mode 100644
index 000000000000..f0ce8f9e63bf
--- /dev/null
+++ b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/HttpJsonDocumentServiceStub.java
@@ -0,0 +1,529 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.documentai.v1beta3.stub;
+
+import static com.google.cloud.documentai.v1beta3.DocumentServiceClient.ListLocationsPagedResponse;
+
+import com.google.api.HttpRule;
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshot;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.RequestParamsBuilder;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.documentai.v1beta3.Dataset;
+import com.google.cloud.documentai.v1beta3.DatasetSchema;
+import com.google.cloud.documentai.v1beta3.GetDatasetSchemaRequest;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetOperationMetadata;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetRequest;
+import com.google.cloud.documentai.v1beta3.UpdateDatasetSchemaRequest;
+import com.google.cloud.location.GetLocationRequest;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.common.collect.ImmutableMap;
+import com.google.longrunning.Operation;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the DocumentService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonDocumentServiceStub extends DocumentServiceStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(Dataset.getDescriptor())
+ .add(UpdateDatasetOperationMetadata.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateDatasetMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.documentai.v1beta3.DocumentService/UpdateDataset")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta3/{dataset.name=projects/*/locations/*/processors/*/dataset}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "dataset.name", request.getDataset().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("dataset", request.getDataset(), true))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (UpdateDatasetRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ getDatasetSchemaMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.documentai.v1beta3.DocumentService/GetDatasetSchema")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta3/{name=projects/*/locations/*/processors/*/dataset/datasetSchema}",
+ 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();
+ serializer.putQueryParam(
+ fields, "visibleFieldsOnly", request.getVisibleFieldsOnly());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(DatasetSchema.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateDatasetSchemaMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.documentai.v1beta3.DocumentService/UpdateDatasetSchema")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1beta3/{datasetSchema.name=projects/*/locations/*/processors/*/dataset/datasetSchema}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields, "datasetSchema.name", request.getDatasetSchema().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map