diff --git a/packages/google-cloud-documentai/linkinator.config.json b/packages/google-cloud-documentai/linkinator.config.json
index 29a223b6db6..0121dfa684f 100644
--- a/packages/google-cloud-documentai/linkinator.config.json
+++ b/packages/google-cloud-documentai/linkinator.config.json
@@ -6,5 +6,5 @@
"img.shields.io"
],
"silent": true,
- "concurrency": 10
+ "concurrency": 5
}
diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js
new file mode 100644
index 00000000000..cdf98d1b454
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js
@@ -0,0 +1,67 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(name) {
+ // [START documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The processor resource name.
+ */
+ // const name = 'abc123'
+ /**
+ * The input documents for batch process.
+ */
+ // const inputDocuments = {}
+ /**
+ * The overall output config for batch process.
+ */
+ // const documentOutputConfig = {}
+ /**
+ * Whether Human Review feature should be skipped for this request. Default to
+ * false.
+ */
+ // const skipHumanReview = true
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callBatchProcessDocuments() {
+ // Construct request
+ const request = {
+ name,
+ };
+
+ // Run request
+ const [operation] = await documentaiClient.batchProcessDocuments(request);
+ const [response] = await operation.promise();
+ console.log(response);
+ }
+
+ callBatchProcessDocuments();
+ // [END documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js
new file mode 100644
index 00000000000..9c22048acda
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js
@@ -0,0 +1,66 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(name) {
+ // [START documentai_v1_generated_DocumentProcessorService_ProcessDocument_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * An inline document proto.
+ */
+ // const inlineDocument = {}
+ /**
+ * A raw document content (bytes).
+ */
+ // const rawDocument = {}
+ /**
+ * Required. The processor resource name.
+ */
+ // const name = 'abc123'
+ /**
+ * Whether Human Review feature should be skipped for this request. Default to
+ * false.
+ */
+ // const skipHumanReview = true
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callProcessDocument() {
+ // Construct request
+ const request = {
+ name,
+ };
+
+ // Run request
+ const response = await documentaiClient.processDocument(request);
+ console.log(response);
+ }
+
+ callProcessDocument();
+ // [END documentai_v1_generated_DocumentProcessorService_ProcessDocument_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js
new file mode 100644
index 00000000000..2dc162fe458
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js
@@ -0,0 +1,67 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(humanReviewConfig) {
+ // [START documentai_v1_generated_DocumentProcessorService_ReviewDocument_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * An inline document proto.
+ */
+ // const inlineDocument = {}
+ /**
+ * Required. The resource name of the HumanReviewConfig that the document will be
+ * reviewed with.
+ */
+ // const humanReviewConfig = 'abc123'
+ /**
+ * Whether the validation should be performed on the ad-hoc review request.
+ */
+ // const enableSchemaValidation = true
+ /**
+ * The priority of the human review task.
+ */
+ // const priority = {}
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callReviewDocument() {
+ // Construct request
+ const request = {
+ humanReviewConfig,
+ };
+
+ // Run request
+ const [operation] = await documentaiClient.reviewDocument(request);
+ const [response] = await operation.promise();
+ console.log(response);
+ }
+
+ callReviewDocument();
+ // [END documentai_v1_generated_DocumentProcessorService_ReviewDocument_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js
new file mode 100644
index 00000000000..56d524f4ba6
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js
@@ -0,0 +1,60 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(requests) {
+ // [START documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. Individual requests for each document.
+ */
+ // const requests = 1234
+ /**
+ * Target project and location to make a call.
+ * Format: `projects/{project-id}/locations/{location-id}`.
+ * If no location is specified, a region will be chosen automatically.
+ */
+ // const parent = 'abc123'
+
+ // Imports the Documentai library
+ const {DocumentUnderstandingServiceClient} =
+ require('@google-cloud/documentai').v1beta1;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentUnderstandingServiceClient();
+
+ async function callBatchProcessDocuments() {
+ // Construct request
+ const request = {
+ requests,
+ };
+
+ // Run request
+ const [operation] = await documentaiClient.batchProcessDocuments(request);
+ const [response] = await operation.promise();
+ console.log(response);
+ }
+
+ callBatchProcessDocuments();
+ // [END documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js
new file mode 100644
index 00000000000..9f4e352679b
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js
@@ -0,0 +1,60 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(requests) {
+ // [START documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. Individual requests for each document.
+ */
+ // const requests = 1234
+ /**
+ * Target project and location to make a call.
+ * Format: `projects/{project-id}/locations/{location-id}`.
+ * If no location is specified, a region will be chosen automatically.
+ */
+ // const parent = 'abc123'
+
+ // Imports the Documentai library
+ const {DocumentUnderstandingServiceClient} =
+ require('@google-cloud/documentai').v1beta2;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentUnderstandingServiceClient();
+
+ async function callBatchProcessDocuments() {
+ // Construct request
+ const request = {
+ requests,
+ };
+
+ // Run request
+ const [operation] = await documentaiClient.batchProcessDocuments(request);
+ const [response] = await operation.promise();
+ console.log(response);
+ }
+
+ callBatchProcessDocuments();
+ // [END documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js
new file mode 100644
index 00000000000..679aad5de80
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta2/document_understanding_service.process_document.js
@@ -0,0 +1,96 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(inputConfig) {
+ // [START documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Target project and location to make a call.
+ * Format: `projects/{project-id}/locations/{location-id}`.
+ * If no location is specified, a region will be chosen automatically.
+ * This field is only populated when used in ProcessDocument method.
+ */
+ // const parent = 'abc123'
+ /**
+ * Required. Information about the input file.
+ */
+ // const inputConfig = {}
+ /**
+ * Optional. The desired output location. This field is only needed in
+ * BatchProcessDocumentsRequest.
+ */
+ // const outputConfig = {}
+ /**
+ * Specifies a known document type for deeper structure detection. Valid
+ * values are currently "general" and "invoice". If not provided, "general"\
+ * is used as default. If any other value is given, the request is rejected.
+ */
+ // const documentType = 'abc123'
+ /**
+ * Controls table extraction behavior. If not specified, the system will
+ * decide reasonable defaults.
+ */
+ // const tableExtractionParams = {}
+ /**
+ * Controls form extraction behavior. If not specified, the system will
+ * decide reasonable defaults.
+ */
+ // const formExtractionParams = {}
+ /**
+ * Controls entity extraction behavior. If not specified, the system will
+ * decide reasonable defaults.
+ */
+ // const entityExtractionParams = {}
+ /**
+ * Controls OCR behavior. If not specified, the system will decide reasonable
+ * defaults.
+ */
+ // const ocrParams = {}
+ /**
+ * Controls AutoML model prediction behavior. AutoMlParams cannot be used
+ * together with other Params.
+ */
+ // const automlParams = {}
+
+ // Imports the Documentai library
+ const {DocumentUnderstandingServiceClient} =
+ require('@google-cloud/documentai').v1beta2;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentUnderstandingServiceClient();
+
+ async function callProcessDocument() {
+ // Construct request
+ const request = {
+ inputConfig,
+ };
+
+ // Run request
+ const response = await documentaiClient.processDocument(request);
+ console.log(response);
+ }
+
+ callProcessDocument();
+ // [END documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js
new file mode 100644
index 00000000000..06105529398
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.batch_process_documents.js
@@ -0,0 +1,75 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(name) {
+ // [START documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The processor resource name.
+ */
+ // const name = 'abc123'
+ /**
+ * The input config for each single document in the batch process.
+ */
+ // const inputConfigs = 1234
+ /**
+ * The overall output config for batch process.
+ */
+ // const outputConfig = {}
+ /**
+ * The input documents for batch process.
+ */
+ // const inputDocuments = {}
+ /**
+ * The overall output config for batch process.
+ */
+ // const documentOutputConfig = {}
+ /**
+ * Whether Human Review feature should be skipped for this request. Default to
+ * false.
+ */
+ // const skipHumanReview = true
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1beta3;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callBatchProcessDocuments() {
+ // Construct request
+ const request = {
+ name,
+ };
+
+ // Run request
+ const [operation] = await documentaiClient.batchProcessDocuments(request);
+ const [response] = await operation.promise();
+ console.log(response);
+ }
+
+ callBatchProcessDocuments();
+ // [END documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js
new file mode 100644
index 00000000000..4ed3a3e8ad6
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.create_processor.js
@@ -0,0 +1,60 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(parent, processor) {
+ // [START documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The parent (project and location) under which to create the processor.
+ * Format: projects/{project}/locations/{location}
+ */
+ // const parent = 'abc123'
+ /**
+ * 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.
+ */
+ // const processor = {}
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1beta3;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callCreateProcessor() {
+ // Construct request
+ const request = {
+ parent,
+ processor,
+ };
+
+ // Run request
+ const response = await documentaiClient.createProcessor(request);
+ console.log(response);
+ }
+
+ callCreateProcessor();
+ // [END documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js
new file mode 100644
index 00000000000..5cbd9f196ee
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.delete_processor.js
@@ -0,0 +1,54 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(name) {
+ // [START documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The processor resource name to be deleted.
+ */
+ // const name = 'abc123'
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1beta3;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callDeleteProcessor() {
+ // Construct request
+ const request = {
+ name,
+ };
+
+ // Run request
+ const [operation] = await documentaiClient.deleteProcessor(request);
+ const [response] = await operation.promise();
+ console.log(response);
+ }
+
+ callDeleteProcessor();
+ // [END documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js
new file mode 100644
index 00000000000..f55d16d1916
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js
@@ -0,0 +1,54 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(name) {
+ // [START documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The processor resource name to be disabled.
+ */
+ // const name = 'abc123'
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1beta3;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callDisableProcessor() {
+ // Construct request
+ const request = {
+ name,
+ };
+
+ // Run request
+ const [operation] = await documentaiClient.disableProcessor(request);
+ const [response] = await operation.promise();
+ console.log(response);
+ }
+
+ callDisableProcessor();
+ // [END documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js
new file mode 100644
index 00000000000..9581b40ce87
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js
@@ -0,0 +1,54 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(name) {
+ // [START documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The processor resource name to be enabled.
+ */
+ // const name = 'abc123'
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1beta3;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callEnableProcessor() {
+ // Construct request
+ const request = {
+ name,
+ };
+
+ // Run request
+ const [operation] = await documentaiClient.enableProcessor(request);
+ const [response] = await operation.promise();
+ console.log(response);
+ }
+
+ callEnableProcessor();
+ // [END documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js
new file mode 100644
index 00000000000..95cf1157f7a
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js
@@ -0,0 +1,54 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(parent) {
+ // [START documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The project of processor type to list.
+ * Format: projects/{project}/locations/{location}
+ */
+ // const parent = 'abc123'
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1beta3;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callFetchProcessorTypes() {
+ // Construct request
+ const request = {
+ parent,
+ };
+
+ // Run request
+ const response = await documentaiClient.fetchProcessorTypes(request);
+ console.log(response);
+ }
+
+ callFetchProcessorTypes();
+ // [END documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js
new file mode 100644
index 00000000000..ec0e270b9b2
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js
@@ -0,0 +1,67 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(parent) {
+ // [START documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * Required. The parent (project and location) which owns this collection of Processors.
+ * Format: projects/{project}/locations/{location}
+ */
+ // const parent = 'abc123'
+ /**
+ * The maximum number of processors to return.
+ * If unspecified, at most 50 processors will be returned.
+ * The maximum value is 100; values above 100 will be coerced to 100.
+ */
+ // const pageSize = 1234
+ /**
+ * We will return the processors sorted by creation time. The page token
+ * will point to the next processor.
+ */
+ // const pageToken = 'abc123'
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1beta3;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callListProcessors() {
+ // Construct request
+ const request = {
+ parent,
+ };
+
+ // Run request
+ const iterable = await documentaiClient.listProcessorsAsync(request);
+ for await (const response of iterable) {
+ console.log(response);
+ }
+ }
+
+ callListProcessors();
+ // [END documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js
new file mode 100644
index 00000000000..37018bc1171
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js
@@ -0,0 +1,70 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(name) {
+ // [START documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * An inline document proto.
+ */
+ // const inlineDocument = {}
+ /**
+ * A raw document content (bytes).
+ */
+ // const rawDocument = {}
+ /**
+ * Required. The processor resource name.
+ */
+ // const name = 'abc123'
+ /**
+ * The document payload, the content and mime_type fields must be set.
+ */
+ // const document = {}
+ /**
+ * Whether Human Review feature should be skipped for this request. Default to
+ * false.
+ */
+ // const skipHumanReview = true
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1beta3;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callProcessDocument() {
+ // Construct request
+ const request = {
+ name,
+ };
+
+ // Run request
+ const response = await documentaiClient.processDocument(request);
+ console.log(response);
+ }
+
+ callProcessDocument();
+ // [END documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js
new file mode 100644
index 00000000000..3f952d125c2
--- /dev/null
+++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js
@@ -0,0 +1,71 @@
+// Copyright 2021 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
+//
+// http://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.
+
+'use strict';
+
+function main(humanReviewConfig) {
+ // [START documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async]
+ /**
+ * TODO(developer): Uncomment these variables before running the sample.
+ */
+ /**
+ * An inline document proto.
+ */
+ // const inlineDocument = {}
+ /**
+ * Required. The resource name of the HumanReviewConfig that the document will be
+ * reviewed with.
+ */
+ // const humanReviewConfig = 'abc123'
+ /**
+ * The document that needs human review.
+ */
+ // const document = {}
+ /**
+ * Whether the validation should be performed on the ad-hoc review request.
+ */
+ // const enableSchemaValidation = true
+ /**
+ * The priority of the human review task.
+ */
+ // const priority = {}
+
+ // Imports the Documentai library
+ const {DocumentProcessorServiceClient} =
+ require('@google-cloud/documentai').v1beta3;
+
+ // Instantiates a client
+ const documentaiClient = new DocumentProcessorServiceClient();
+
+ async function callReviewDocument() {
+ // Construct request
+ const request = {
+ humanReviewConfig,
+ };
+
+ // Run request
+ const [operation] = await documentaiClient.reviewDocument(request);
+ const [response] = await operation.promise();
+ console.log(response);
+ }
+
+ callReviewDocument();
+ // [END documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async]
+}
+
+process.on('unhandledRejection', err => {
+ console.error(err.message);
+ process.exitCode = 1;
+});
+main(...process.argv.slice(2));
diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts
index b58bd2cdd98..bf664e515c4 100644
--- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts
+++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts
@@ -345,6 +345,30 @@ export class DocumentProcessorServiceClient {
// -------------------
// -- Service calls --
// -------------------
+ /**
+ * Processes a single document.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {google.cloud.documentai.v1.Document} request.inlineDocument
+ * An inline document proto.
+ * @param {google.cloud.documentai.v1.RawDocument} request.rawDocument
+ * A raw document content (bytes).
+ * @param {string} request.name
+ * Required. The processor resource name.
+ * @param {boolean} request.skipHumanReview
+ * Whether Human Review feature should be skipped for this request. Default to
+ * false.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [ProcessResponse]{@link google.cloud.documentai.v1.ProcessResponse}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example
include:samples/generated/v1/document_processor_service.process_document.js
+ * region_tag:documentai_v1_generated_DocumentProcessorService_ProcessDocument_async
+ */
processDocument(
request?: protos.google.cloud.documentai.v1.IProcessRequest,
options?: CallOptions
@@ -372,30 +396,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * Processes a single document.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {google.cloud.documentai.v1.Document} request.inlineDocument
- * An inline document proto.
- * @param {google.cloud.documentai.v1.RawDocument} request.rawDocument
- * A raw document content (bytes).
- * @param {string} request.name
- * Required. The processor resource name.
- * @param {boolean} request.skipHumanReview
- * Whether Human Review feature should be skipped for this request. Default to
- * false.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [ProcessResponse]{@link google.cloud.documentai.v1.ProcessResponse}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.processDocument(request);
- */
processDocument(
request?: protos.google.cloud.documentai.v1.IProcessRequest,
optionsOrCallback?:
@@ -436,6 +436,33 @@ export class DocumentProcessorServiceClient {
return this.innerApiCalls.processDocument(request, options, callback);
}
+ /**
+ * LRO endpoint to batch process many documents. The output is written
+ * to Cloud Storage as JSON in the [Document] format.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.name
+ * Required. The processor resource name.
+ * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} request.inputDocuments
+ * The input documents for batch process.
+ * @param {google.cloud.documentai.v1.DocumentOutputConfig} request.documentOutputConfig
+ * The overall output config for batch process.
+ * @param {boolean} request.skipHumanReview
+ * Whether Human Review feature should be skipped for this request. Default to
+ * false.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing
+ * a long running operation. Its `promise()` method returns a promise
+ * you can `await` for.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
+ * for more details and examples.
+ * @example include:samples/generated/v1/document_processor_service.batch_process_documents.js
+ * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async
+ */
batchProcessDocuments(
request?: protos.google.cloud.documentai.v1.IBatchProcessRequest,
options?: CallOptions
@@ -472,34 +499,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * LRO endpoint to batch process many documents. The output is written
- * to Cloud Storage as JSON in the [Document] format.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.name
- * Required. The processor resource name.
- * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} request.inputDocuments
- * The input documents for batch process.
- * @param {google.cloud.documentai.v1.DocumentOutputConfig} request.documentOutputConfig
- * The overall output config for batch process.
- * @param {boolean} request.skipHumanReview
- * Whether Human Review feature should be skipped for this request. Default to
- * false.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing
- * a long running operation. Its `promise()` method returns a promise
- * you can `await` for.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
- * for more details and examples.
- * @example
- * const [operation] = await client.batchProcessDocuments(request);
- * const [response] = await operation.promise();
- */
batchProcessDocuments(
request?: protos.google.cloud.documentai.v1.IBatchProcessRequest,
optionsOrCallback?:
@@ -557,11 +556,8 @@ export class DocumentProcessorServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
- * @example
- * const decodedOperation = await checkBatchProcessDocumentsProgress(name);
- * console.log(decodedOperation.result);
- * console.log(decodedOperation.done);
- * console.log(decodedOperation.metadata);
+ * @example include:samples/generated/v1/document_processor_service.batch_process_documents.js
+ * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async
*/
async checkBatchProcessDocumentsProgress(
name: string
@@ -585,6 +581,33 @@ export class DocumentProcessorServiceClient {
protos.google.cloud.documentai.v1.BatchProcessMetadata
>;
}
+ /**
+ * Send a document for Human Review. The input document should be processed by
+ * the specified processor.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {google.cloud.documentai.v1.Document} request.inlineDocument
+ * An inline document proto.
+ * @param {string} request.humanReviewConfig
+ * Required. The resource name of the HumanReviewConfig that the document will be
+ * reviewed with.
+ * @param {boolean} request.enableSchemaValidation
+ * Whether the validation should be performed on the ad-hoc review request.
+ * @param {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} request.priority
+ * The priority of the human review task.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing
+ * a long running operation. Its `promise()` method returns a promise
+ * you can `await` for.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
+ * for more details and examples.
+ * @example include:samples/generated/v1/document_processor_service.review_document.js
+ * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async
+ */
reviewDocument(
request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest,
options?: CallOptions
@@ -621,34 +644,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * Send a document for Human Review. The input document should be processed by
- * the specified processor.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {google.cloud.documentai.v1.Document} request.inlineDocument
- * An inline document proto.
- * @param {string} request.humanReviewConfig
- * Required. The resource name of the HumanReviewConfig that the document will be
- * reviewed with.
- * @param {boolean} request.enableSchemaValidation
- * Whether the validation should be performed on the ad-hoc review request.
- * @param {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} request.priority
- * The priority of the human review task.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing
- * a long running operation. Its `promise()` method returns a promise
- * you can `await` for.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
- * for more details and examples.
- * @example
- * const [operation] = await client.reviewDocument(request);
- * const [response] = await operation.promise();
- */
reviewDocument(
request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest,
optionsOrCallback?:
@@ -706,11 +701,8 @@ export class DocumentProcessorServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
- * @example
- * const decodedOperation = await checkReviewDocumentProgress(name);
- * console.log(decodedOperation.result);
- * console.log(decodedOperation.done);
- * console.log(decodedOperation.metadata);
+ * @example include:samples/generated/v1/document_processor_service.review_document.js
+ * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async
*/
async checkReviewDocumentProgress(
name: string
diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts
index 2b8d70e5efc..d38d1c7999a 100644
--- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts
+++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts
@@ -317,6 +317,31 @@ export class DocumentUnderstandingServiceClient {
// -- Service calls --
// -------------------
+ /**
+ * LRO endpoint to batch process many documents.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {number[]} request.requests
+ * Required. Individual requests for each document.
+ * @param {string} request.parent
+ * Target project and location to make a call.
+ *
+ * Format: `projects/{project-id}/locations/{location-id}`.
+ *
+ * If no location is specified, a region will be chosen automatically.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing
+ * a long running operation. Its `promise()` method returns a promise
+ * you can `await` for.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta1/document_understanding_service.batch_process_documents.js
+ * region_tag:documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async
+ */
batchProcessDocuments(
request?: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest,
options?: CallOptions
@@ -353,32 +378,6 @@ export class DocumentUnderstandingServiceClient {
{} | null | undefined
>
): void;
- /**
- * LRO endpoint to batch process many documents.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {number[]} request.requests
- * Required. Individual requests for each document.
- * @param {string} request.parent
- * Target project and location to make a call.
- *
- * Format: `projects/{project-id}/locations/{location-id}`.
- *
- * If no location is specified, a region will be chosen automatically.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing
- * a long running operation. Its `promise()` method returns a promise
- * you can `await` for.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
- * for more details and examples.
- * @example
- * const [operation] = await client.batchProcessDocuments(request);
- * const [response] = await operation.promise();
- */
batchProcessDocuments(
request?: protos.google.cloud.documentai.v1beta1.IBatchProcessDocumentsRequest,
optionsOrCallback?:
@@ -436,11 +435,8 @@ export class DocumentUnderstandingServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
- * @example
- * const decodedOperation = await checkBatchProcessDocumentsProgress(name);
- * console.log(decodedOperation.result);
- * console.log(decodedOperation.done);
- * console.log(decodedOperation.metadata);
+ * @example include:samples/generated/v1beta1/document_understanding_service.batch_process_documents.js
+ * region_tag:documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async
*/
async checkBatchProcessDocumentsProgress(
name: string
diff --git a/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json b/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json
index ec68421d538..a283d1de127 100644
--- a/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json
+++ b/packages/google-cloud-documentai/src/v1beta1/gapic_metadata.json
@@ -3,7 +3,7 @@
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "typescript",
"protoPackage": "google.cloud.documentai.v1beta1",
- "libraryPackage": "documentai",
+ "libraryPackage": "@google-cloud/documentai",
"services": {
"DocumentUnderstandingService": {
"clients": {
diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts
index 1c0adfcca40..552b1045653 100644
--- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts
+++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts
@@ -319,40 +319,6 @@ export class DocumentUnderstandingServiceClient {
// -------------------
// -- Service calls --
// -------------------
- processDocument(
- request?: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest,
- options?: CallOptions
- ): Promise<
- [
- protos.google.cloud.documentai.v1beta2.IDocument,
- (
- | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest
- | undefined
- ),
- {} | undefined
- ]
- >;
- processDocument(
- request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest,
- options: CallOptions,
- callback: Callback<
- protos.google.cloud.documentai.v1beta2.IDocument,
- | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest
- | null
- | undefined,
- {} | null | undefined
- >
- ): void;
- processDocument(
- request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest,
- callback: Callback<
- protos.google.cloud.documentai.v1beta2.IDocument,
- | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest
- | null
- | undefined,
- {} | null | undefined
- >
- ): void;
/**
* Processes a single document.
*
@@ -396,9 +362,43 @@ export class DocumentUnderstandingServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
- * @example
- * const [response] = await client.processDocument(request);
+ * @example include:samples/generated/v1beta2/document_understanding_service.process_document.js
+ * region_tag:documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async
*/
+ processDocument(
+ request?: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest,
+ options?: CallOptions
+ ): Promise<
+ [
+ protos.google.cloud.documentai.v1beta2.IDocument,
+ (
+ | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest
+ | undefined
+ ),
+ {} | undefined
+ ]
+ >;
+ processDocument(
+ request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest,
+ options: CallOptions,
+ callback: Callback<
+ protos.google.cloud.documentai.v1beta2.IDocument,
+ | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest
+ | null
+ | undefined,
+ {} | null | undefined
+ >
+ ): void;
+ processDocument(
+ request: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest,
+ callback: Callback<
+ protos.google.cloud.documentai.v1beta2.IDocument,
+ | protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest
+ | null
+ | undefined,
+ {} | null | undefined
+ >
+ ): void;
processDocument(
request?: protos.google.cloud.documentai.v1beta2.IProcessDocumentRequest,
optionsOrCallback?:
@@ -446,6 +446,32 @@ export class DocumentUnderstandingServiceClient {
return this.innerApiCalls.processDocument(request, options, callback);
}
+ /**
+ * LRO endpoint to batch process many documents. The output is written
+ * to Cloud Storage as JSON in the [Document] format.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {number[]} request.requests
+ * Required. Individual requests for each document.
+ * @param {string} request.parent
+ * Target project and location to make a call.
+ *
+ * Format: `projects/{project-id}/locations/{location-id}`.
+ *
+ * If no location is specified, a region will be chosen automatically.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing
+ * a long running operation. Its `promise()` method returns a promise
+ * you can `await` for.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta2/document_understanding_service.batch_process_documents.js
+ * region_tag:documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async
+ */
batchProcessDocuments(
request?: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest,
options?: CallOptions
@@ -482,33 +508,6 @@ export class DocumentUnderstandingServiceClient {
{} | null | undefined
>
): void;
- /**
- * LRO endpoint to batch process many documents. The output is written
- * to Cloud Storage as JSON in the [Document] format.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {number[]} request.requests
- * Required. Individual requests for each document.
- * @param {string} request.parent
- * Target project and location to make a call.
- *
- * Format: `projects/{project-id}/locations/{location-id}`.
- *
- * If no location is specified, a region will be chosen automatically.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing
- * a long running operation. Its `promise()` method returns a promise
- * you can `await` for.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
- * for more details and examples.
- * @example
- * const [operation] = await client.batchProcessDocuments(request);
- * const [response] = await operation.promise();
- */
batchProcessDocuments(
request?: protos.google.cloud.documentai.v1beta2.IBatchProcessDocumentsRequest,
optionsOrCallback?:
@@ -566,11 +565,8 @@ export class DocumentUnderstandingServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
- * @example
- * const decodedOperation = await checkBatchProcessDocumentsProgress(name);
- * console.log(decodedOperation.result);
- * console.log(decodedOperation.done);
- * console.log(decodedOperation.metadata);
+ * @example include:samples/generated/v1beta2/document_understanding_service.batch_process_documents.js
+ * region_tag:documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async
*/
async checkBatchProcessDocumentsProgress(
name: string
diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts
index 581a008412b..827328391fa 100644
--- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts
+++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts
@@ -411,6 +411,32 @@ export class DocumentProcessorServiceClient {
// -------------------
// -- Service calls --
// -------------------
+ /**
+ * Processes a single document.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument
+ * An inline document proto.
+ * @param {google.cloud.documentai.v1beta3.RawDocument} request.rawDocument
+ * A raw document content (bytes).
+ * @param {string} request.name
+ * Required. The processor resource name.
+ * @param {google.cloud.documentai.v1beta3.Document} request.document
+ * The document payload, the [content] and [mime_type] fields must be set.
+ * @param {boolean} request.skipHumanReview
+ * Whether Human Review feature should be skipped for this request. Default to
+ * false.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [ProcessResponse]{@link google.cloud.documentai.v1beta3.ProcessResponse}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta3/document_processor_service.process_document.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async
+ */
processDocument(
request?: protos.google.cloud.documentai.v1beta3.IProcessRequest,
options?: CallOptions
@@ -438,32 +464,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * Processes a single document.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument
- * An inline document proto.
- * @param {google.cloud.documentai.v1beta3.RawDocument} request.rawDocument
- * A raw document content (bytes).
- * @param {string} request.name
- * Required. The processor resource name.
- * @param {google.cloud.documentai.v1beta3.Document} request.document
- * The document payload, the [content] and [mime_type] fields must be set.
- * @param {boolean} request.skipHumanReview
- * Whether Human Review feature should be skipped for this request. Default to
- * false.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [ProcessResponse]{@link google.cloud.documentai.v1beta3.ProcessResponse}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.processDocument(request);
- */
processDocument(
request?: protos.google.cloud.documentai.v1beta3.IProcessRequest,
optionsOrCallback?:
@@ -505,6 +505,24 @@ export class DocumentProcessorServiceClient {
this.initialize();
return this.innerApiCalls.processDocument(request, options, callback);
}
+ /**
+ * Fetches processor types.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.parent
+ * Required. The project of processor type to list.
+ * Format: projects/{project}/locations/{location}
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [FetchProcessorTypesResponse]{@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta3/document_processor_service.fetch_processor_types.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async
+ */
fetchProcessorTypes(
request?: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest,
options?: CallOptions
@@ -539,24 +557,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * Fetches processor types.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.parent
- * Required. The project of processor type to list.
- * Format: projects/{project}/locations/{location}
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [FetchProcessorTypesResponse]{@link google.cloud.documentai.v1beta3.FetchProcessorTypesResponse}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.fetchProcessorTypes(request);
- */
fetchProcessorTypes(
request?: protos.google.cloud.documentai.v1beta3.IFetchProcessorTypesRequest,
optionsOrCallback?:
@@ -603,6 +603,28 @@ export class DocumentProcessorServiceClient {
this.initialize();
return this.innerApiCalls.fetchProcessorTypes(request, options, callback);
}
+ /**
+ * Creates a processor from the type processor that the user chose.
+ * The processor will be at "ENABLED" state by default after its creation.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.parent
+ * Required. The parent (project and location) under which to create the processor.
+ * Format: projects/{project}/locations/{location}
+ * @param {google.cloud.documentai.v1beta3.Processor} request.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 {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing [Processor]{@link google.cloud.documentai.v1beta3.Processor}.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta3/document_processor_service.create_processor.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_CreateProcessor_async
+ */
createProcessor(
request?: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest,
options?: CallOptions
@@ -637,28 +659,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * Creates a processor from the type processor that the user chose.
- * The processor will be at "ENABLED" state by default after its creation.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.parent
- * Required. The parent (project and location) under which to create the processor.
- * Format: projects/{project}/locations/{location}
- * @param {google.cloud.documentai.v1beta3.Processor} request.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 {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing [Processor]{@link google.cloud.documentai.v1beta3.Processor}.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
- * for more details and examples.
- * @example
- * const [response] = await client.createProcessor(request);
- */
createProcessor(
request?: protos.google.cloud.documentai.v1beta3.ICreateProcessorRequest,
optionsOrCallback?:
@@ -706,6 +706,37 @@ export class DocumentProcessorServiceClient {
return this.innerApiCalls.createProcessor(request, options, callback);
}
+ /**
+ * LRO endpoint to batch process many documents. The output is written
+ * to Cloud Storage as JSON in the [Document] format.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.name
+ * Required. The processor resource name.
+ * @param {number[]} request.inputConfigs
+ * The input config for each single document in the batch process.
+ * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} request.outputConfig
+ * The overall output config for batch process.
+ * @param {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} request.inputDocuments
+ * The input documents for batch process.
+ * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig} request.documentOutputConfig
+ * The overall output config for batch process.
+ * @param {boolean} request.skipHumanReview
+ * Whether Human Review feature should be skipped for this request. Default to
+ * false.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing
+ * a long running operation. Its `promise()` method returns a promise
+ * you can `await` for.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta3/document_processor_service.batch_process_documents.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async
+ */
batchProcessDocuments(
request?: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest,
options?: CallOptions
@@ -742,38 +773,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * LRO endpoint to batch process many documents. The output is written
- * to Cloud Storage as JSON in the [Document] format.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.name
- * Required. The processor resource name.
- * @param {number[]} request.inputConfigs
- * The input config for each single document in the batch process.
- * @param {google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} request.outputConfig
- * The overall output config for batch process.
- * @param {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} request.inputDocuments
- * The input documents for batch process.
- * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig} request.documentOutputConfig
- * The overall output config for batch process.
- * @param {boolean} request.skipHumanReview
- * Whether Human Review feature should be skipped for this request. Default to
- * false.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing
- * a long running operation. Its `promise()` method returns a promise
- * you can `await` for.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
- * for more details and examples.
- * @example
- * const [operation] = await client.batchProcessDocuments(request);
- * const [response] = await operation.promise();
- */
batchProcessDocuments(
request?: protos.google.cloud.documentai.v1beta3.IBatchProcessRequest,
optionsOrCallback?:
@@ -831,11 +830,8 @@ export class DocumentProcessorServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
- * @example
- * const decodedOperation = await checkBatchProcessDocumentsProgress(name);
- * console.log(decodedOperation.result);
- * console.log(decodedOperation.done);
- * console.log(decodedOperation.metadata);
+ * @example include:samples/generated/v1beta3/document_processor_service.batch_process_documents.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async
*/
async checkBatchProcessDocumentsProgress(
name: string
@@ -859,6 +855,26 @@ export class DocumentProcessorServiceClient {
protos.google.cloud.documentai.v1beta3.BatchProcessMetadata
>;
}
+ /**
+ * Deletes the processor, unloads all deployed model artifacts if it was
+ * enabled and then deletes all artifacts associated with this processor.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.name
+ * Required. The processor resource name to be deleted.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing
+ * a long running operation. Its `promise()` method returns a promise
+ * you can `await` for.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta3/document_processor_service.delete_processor.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async
+ */
deleteProcessor(
request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest,
options?: CallOptions
@@ -895,27 +911,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * Deletes the processor, unloads all deployed model artifacts if it was
- * enabled and then deletes all artifacts associated with this processor.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.name
- * Required. The processor resource name to be deleted.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing
- * a long running operation. Its `promise()` method returns a promise
- * you can `await` for.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
- * for more details and examples.
- * @example
- * const [operation] = await client.deleteProcessor(request);
- * const [response] = await operation.promise();
- */
deleteProcessor(
request?: protos.google.cloud.documentai.v1beta3.IDeleteProcessorRequest,
optionsOrCallback?:
@@ -973,11 +968,8 @@ export class DocumentProcessorServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
- * @example
- * const decodedOperation = await checkDeleteProcessorProgress(name);
- * console.log(decodedOperation.result);
- * console.log(decodedOperation.done);
- * console.log(decodedOperation.metadata);
+ * @example include:samples/generated/v1beta3/document_processor_service.delete_processor.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DeleteProcessor_async
*/
async checkDeleteProcessorProgress(
name: string
@@ -1001,6 +993,25 @@ export class DocumentProcessorServiceClient {
protos.google.cloud.documentai.v1beta3.DeleteProcessorMetadata
>;
}
+ /**
+ * Enables a processor
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.name
+ * Required. The processor resource name to be enabled.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing
+ * a long running operation. Its `promise()` method returns a promise
+ * you can `await` for.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta3/document_processor_service.enable_processor.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async
+ */
enableProcessor(
request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest,
options?: CallOptions
@@ -1037,26 +1048,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * Enables a processor
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.name
- * Required. The processor resource name to be enabled.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing
- * a long running operation. Its `promise()` method returns a promise
- * you can `await` for.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
- * for more details and examples.
- * @example
- * const [operation] = await client.enableProcessor(request);
- * const [response] = await operation.promise();
- */
enableProcessor(
request?: protos.google.cloud.documentai.v1beta3.IEnableProcessorRequest,
optionsOrCallback?:
@@ -1114,11 +1105,8 @@ export class DocumentProcessorServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
- * @example
- * const decodedOperation = await checkEnableProcessorProgress(name);
- * console.log(decodedOperation.result);
- * console.log(decodedOperation.done);
- * console.log(decodedOperation.metadata);
+ * @example include:samples/generated/v1beta3/document_processor_service.enable_processor.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EnableProcessor_async
*/
async checkEnableProcessorProgress(
name: string
@@ -1142,6 +1130,25 @@ export class DocumentProcessorServiceClient {
protos.google.cloud.documentai.v1beta3.EnableProcessorMetadata
>;
}
+ /**
+ * Disables a processor
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.name
+ * Required. The processor resource name to be disabled.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing
+ * a long running operation. Its `promise()` method returns a promise
+ * you can `await` for.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta3/document_processor_service.disable_processor.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async
+ */
disableProcessor(
request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest,
options?: CallOptions
@@ -1178,26 +1185,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * Disables a processor
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.name
- * Required. The processor resource name to be disabled.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing
- * a long running operation. Its `promise()` method returns a promise
- * you can `await` for.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
- * for more details and examples.
- * @example
- * const [operation] = await client.disableProcessor(request);
- * const [response] = await operation.promise();
- */
disableProcessor(
request?: protos.google.cloud.documentai.v1beta3.IDisableProcessorRequest,
optionsOrCallback?:
@@ -1255,11 +1242,8 @@ export class DocumentProcessorServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
- * @example
- * const decodedOperation = await checkDisableProcessorProgress(name);
- * console.log(decodedOperation.result);
- * console.log(decodedOperation.done);
- * console.log(decodedOperation.metadata);
+ * @example include:samples/generated/v1beta3/document_processor_service.disable_processor.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_DisableProcessor_async
*/
async checkDisableProcessorProgress(
name: string
@@ -1283,6 +1267,35 @@ export class DocumentProcessorServiceClient {
protos.google.cloud.documentai.v1beta3.DisableProcessorMetadata
>;
}
+ /**
+ * Send a document for Human Review. The input document should be processed by
+ * the specified processor.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument
+ * An inline document proto.
+ * @param {string} request.humanReviewConfig
+ * Required. The resource name of the HumanReviewConfig that the document will be
+ * reviewed with.
+ * @param {google.cloud.documentai.v1beta3.Document} request.document
+ * The document that needs human review.
+ * @param {boolean} request.enableSchemaValidation
+ * Whether the validation should be performed on the ad-hoc review request.
+ * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} request.priority
+ * The priority of the human review task.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is an object representing
+ * a long running operation. Its `promise()` method returns a promise
+ * you can `await` for.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
+ * for more details and examples.
+ * @example include:samples/generated/v1beta3/document_processor_service.review_document.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async
+ */
reviewDocument(
request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest,
options?: CallOptions
@@ -1319,36 +1332,6 @@ export class DocumentProcessorServiceClient {
{} | null | undefined
>
): void;
- /**
- * Send a document for Human Review. The input document should be processed by
- * the specified processor.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {google.cloud.documentai.v1beta3.Document} request.inlineDocument
- * An inline document proto.
- * @param {string} request.humanReviewConfig
- * Required. The resource name of the HumanReviewConfig that the document will be
- * reviewed with.
- * @param {google.cloud.documentai.v1beta3.Document} request.document
- * The document that needs human review.
- * @param {boolean} request.enableSchemaValidation
- * Whether the validation should be performed on the ad-hoc review request.
- * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} request.priority
- * The priority of the human review task.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is an object representing
- * a long running operation. Its `promise()` method returns a promise
- * you can `await` for.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
- * for more details and examples.
- * @example
- * const [operation] = await client.reviewDocument(request);
- * const [response] = await operation.promise();
- */
reviewDocument(
request?: protos.google.cloud.documentai.v1beta3.IReviewDocumentRequest,
optionsOrCallback?:
@@ -1406,11 +1389,8 @@ export class DocumentProcessorServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
- * @example
- * const decodedOperation = await checkReviewDocumentProgress(name);
- * console.log(decodedOperation.result);
- * console.log(decodedOperation.done);
- * console.log(decodedOperation.metadata);
+ * @example include:samples/generated/v1beta3/document_processor_service.review_document.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async
*/
async checkReviewDocumentProgress(
name: string
@@ -1434,6 +1414,34 @@ export class DocumentProcessorServiceClient {
protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata
>;
}
+ /**
+ * Lists all processors which belong to this project.
+ *
+ * @param {Object} request
+ * The request object that will be sent.
+ * @param {string} request.parent
+ * Required. The parent (project and location) which owns this collection of Processors.
+ * Format: projects/{project}/locations/{location}
+ * @param {number} request.pageSize
+ * The maximum number of processors to return.
+ * If unspecified, at most 50 processors will be returned.
+ * The maximum value is 100; values above 100 will be coerced to 100.
+ * @param {string} request.pageToken
+ * We will return the processors sorted by creation time. The page token
+ * will point to the next processor.
+ * @param {object} [options]
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
+ * @returns {Promise} - The promise which resolves to an array.
+ * The first element of the array is Array of [Processor]{@link google.cloud.documentai.v1beta3.Processor}.
+ * The client library will perform auto-pagination by default: it will call the API as many
+ * times as needed and will merge results from all the pages into this array.
+ * Note that it can affect your quota.
+ * We recommend using `listProcessorsAsync()`
+ * method described below for async iteration which you can stop as needed.
+ * Please see the
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
+ * for more details and examples.
+ */
listProcessors(
request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest,
options?: CallOptions
@@ -1465,34 +1473,6 @@ export class DocumentProcessorServiceClient {
protos.google.cloud.documentai.v1beta3.IProcessor
>
): void;
- /**
- * Lists all processors which belong to this project.
- *
- * @param {Object} request
- * The request object that will be sent.
- * @param {string} request.parent
- * Required. The parent (project and location) which owns this collection of Processors.
- * Format: projects/{project}/locations/{location}
- * @param {number} request.pageSize
- * The maximum number of processors to return.
- * If unspecified, at most 50 processors will be returned.
- * The maximum value is 100; values above 100 will be coerced to 100.
- * @param {string} request.pageToken
- * We will return the processors sorted by creation time. The page token
- * will point to the next processor.
- * @param {object} [options]
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
- * @returns {Promise} - The promise which resolves to an array.
- * The first element of the array is Array of [Processor]{@link google.cloud.documentai.v1beta3.Processor}.
- * The client library will perform auto-pagination by default: it will call the API as many
- * times as needed and will merge results from all the pages into this array.
- * Note that it can affect your quota.
- * We recommend using `listProcessorsAsync()`
- * method described below for async iteration which you can stop as needed.
- * Please see the
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
- * for more details and examples.
- */
listProcessors(
request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest,
optionsOrCallback?:
@@ -1575,7 +1555,8 @@ export class DocumentProcessorServiceClient {
gax.routingHeader.fromParams({
parent: request.parent || '',
});
- const callSettings = new gax.CallSettings(options);
+ const defaultCallSettings = this._defaults['listProcessors'];
+ const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.listProcessors.createStream(
this.innerApiCalls.listProcessors as gax.GaxCall,
@@ -1610,11 +1591,8 @@ export class DocumentProcessorServiceClient {
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
- * @example
- * const iterable = client.listProcessorsAsync(request);
- * for await (const response of iterable) {
- * // process response
- * }
+ * @example include:samples/generated/v1beta3/document_processor_service.list_processors.js
+ * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ListProcessors_async
*/
listProcessorsAsync(
request?: protos.google.cloud.documentai.v1beta3.IListProcessorsRequest,
@@ -1628,8 +1606,8 @@ export class DocumentProcessorServiceClient {
gax.routingHeader.fromParams({
parent: request.parent || '',
});
- options = options || {};
- const callSettings = new gax.CallSettings(options);
+ const defaultCallSettings = this._defaults['listProcessors'];
+ const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.listProcessors.asyncIterate(
this.innerApiCalls['listProcessors'] as GaxCall,