diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_batch_process_documents_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_batch_process_documents_async.py new file mode 100644 index 000000000000..1bd888b568b4 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_batch_process_documents_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchProcessDocuments +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1_DocumentProcessorService_BatchProcessDocuments_async] +from google.cloud import documentai_v1 + + +async def sample_batch_process_documents(): + """Snippet for batch_process_documents""" + + # Create a client + client = documentai_v1.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1.BatchProcessRequest( + name=name, + ) + + # Make the request + operation = client.batch_process_documents(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print(response) + +# [END documentai_generated_documentai_v1_DocumentProcessorService_BatchProcessDocuments_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_batch_process_documents_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_batch_process_documents_sync.py new file mode 100644 index 000000000000..ae827a1ce4b8 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_batch_process_documents_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchProcessDocuments +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1_DocumentProcessorService_BatchProcessDocuments_sync] +from google.cloud import documentai_v1 + + +def sample_batch_process_documents(): + """Snippet for batch_process_documents""" + + # Create a client + client = documentai_v1.DocumentProcessorServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1.BatchProcessRequest( + name=name, + ) + + # Make the request + operation = client.batch_process_documents(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + +# [END documentai_generated_documentai_v1_DocumentProcessorService_BatchProcessDocuments_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_process_document_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_process_document_async.py new file mode 100644 index 000000000000..b09a79177426 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_process_document_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ProcessDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1_DocumentProcessorService_ProcessDocument_async] +from google.cloud import documentai_v1 + + +async def sample_process_document(): + """Snippet for process_document""" + + # Create a client + client = documentai_v1.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + inline_document = documentai_v1.Document() + inline_document.uri = "uri_value" + + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1.ProcessRequest( + inline_document=inline_document, + name=name, + ) + + # Make the request + response = await client.process_document(request=request) + + # Handle response + print(response) + +# [END documentai_generated_documentai_v1_DocumentProcessorService_ProcessDocument_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_process_document_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_process_document_sync.py new file mode 100644 index 000000000000..f7c58628be43 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_process_document_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ProcessDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1_DocumentProcessorService_ProcessDocument_sync] +from google.cloud import documentai_v1 + + +def sample_process_document(): + """Snippet for process_document""" + + # Create a client + client = documentai_v1.DocumentProcessorServiceClient() + + # Initialize request argument(s) + inline_document = documentai_v1.Document() + inline_document.uri = "uri_value" + + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1.ProcessRequest( + inline_document=inline_document, + name=name, + ) + + # Make the request + response = client.process_document(request=request) + + # Handle response + print(response) + +# [END documentai_generated_documentai_v1_DocumentProcessorService_ProcessDocument_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_review_document_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_review_document_async.py new file mode 100644 index 000000000000..afd5c6dc54a7 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_review_document_async.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ReviewDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1_DocumentProcessorService_ReviewDocument_async] +from google.cloud import documentai_v1 + + +async def sample_review_document(): + """Snippet for review_document""" + + # Create a client + client = documentai_v1.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + inline_document = documentai_v1.Document() + inline_document.uri = "uri_value" + + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + human_review_config = f"projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" + + request = documentai_v1.ReviewDocumentRequest( + inline_document=inline_document, + human_review_config=human_review_config, + ) + + # Make the request + operation = client.review_document(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print(response) + +# [END documentai_generated_documentai_v1_DocumentProcessorService_ReviewDocument_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_review_document_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_review_document_sync.py new file mode 100644 index 000000000000..ce4d7b25d95c --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1_document_processor_service_review_document_sync.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ReviewDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1_DocumentProcessorService_ReviewDocument_sync] +from google.cloud import documentai_v1 + + +def sample_review_document(): + """Snippet for review_document""" + + # Create a client + client = documentai_v1.DocumentProcessorServiceClient() + + # Initialize request argument(s) + inline_document = documentai_v1.Document() + inline_document.uri = "uri_value" + + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + human_review_config = f"projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" + + request = documentai_v1.ReviewDocumentRequest( + inline_document=inline_document, + human_review_config=human_review_config, + ) + + # Make the request + operation = client.review_document(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + +# [END documentai_generated_documentai_v1_DocumentProcessorService_ReviewDocument_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_batch_process_documents_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_batch_process_documents_async.py new file mode 100644 index 000000000000..63b5ff54479b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_batch_process_documents_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchProcessDocuments +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_BatchProcessDocuments_async] +from google.cloud import documentai_v1beta3 + + +async def sample_batch_process_documents(): + """Snippet for batch_process_documents""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.BatchProcessRequest( + name=name, + ) + + # Make the request + operation = client.batch_process_documents(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_BatchProcessDocuments_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_batch_process_documents_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_batch_process_documents_sync.py new file mode 100644 index 000000000000..0e541965b68c --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_batch_process_documents_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchProcessDocuments +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_BatchProcessDocuments_sync] +from google.cloud import documentai_v1beta3 + + +def sample_batch_process_documents(): + """Snippet for batch_process_documents""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.BatchProcessRequest( + name=name, + ) + + # Make the request + operation = client.batch_process_documents(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_BatchProcessDocuments_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_create_processor_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_create_processor_async.py new file mode 100644 index 000000000000..05ed108f2db9 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_create_processor_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateProcessor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_CreateProcessor_async] +from google.cloud import documentai_v1beta3 + + +async def sample_create_processor(): + """Snippet for create_processor""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + parent = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.CreateProcessorRequest( + parent=parent, + ) + + # Make the request + response = await client.create_processor(request=request) + + # Handle response + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_CreateProcessor_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_create_processor_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_create_processor_sync.py new file mode 100644 index 000000000000..edef269200ca --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_create_processor_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateProcessor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_CreateProcessor_sync] +from google.cloud import documentai_v1beta3 + + +def sample_create_processor(): + """Snippet for create_processor""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + parent = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.CreateProcessorRequest( + parent=parent, + ) + + # Make the request + response = client.create_processor(request=request) + + # Handle response + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_CreateProcessor_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_delete_processor_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_delete_processor_async.py new file mode 100644 index 000000000000..10ac66e8e9fd --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_delete_processor_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteProcessor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_DeleteProcessor_async] +from google.cloud import documentai_v1beta3 + + +async def sample_delete_processor(): + """Snippet for delete_processor""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.DeleteProcessorRequest( + name=name, + ) + + # Make the request + operation = client.delete_processor(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_DeleteProcessor_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_delete_processor_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_delete_processor_sync.py new file mode 100644 index 000000000000..fbb5dd845573 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_delete_processor_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteProcessor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_DeleteProcessor_sync] +from google.cloud import documentai_v1beta3 + + +def sample_delete_processor(): + """Snippet for delete_processor""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.DeleteProcessorRequest( + name=name, + ) + + # Make the request + operation = client.delete_processor(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_DeleteProcessor_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_disable_processor_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_disable_processor_async.py new file mode 100644 index 000000000000..32907a2ace84 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_disable_processor_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DisableProcessor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_DisableProcessor_async] +from google.cloud import documentai_v1beta3 + + +async def sample_disable_processor(): + """Snippet for disable_processor""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.DisableProcessorRequest( + name=name, + ) + + # Make the request + operation = client.disable_processor(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_DisableProcessor_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_disable_processor_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_disable_processor_sync.py new file mode 100644 index 000000000000..f4fa53e59a8b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_disable_processor_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DisableProcessor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_DisableProcessor_sync] +from google.cloud import documentai_v1beta3 + + +def sample_disable_processor(): + """Snippet for disable_processor""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.DisableProcessorRequest( + name=name, + ) + + # Make the request + operation = client.disable_processor(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_DisableProcessor_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_enable_processor_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_enable_processor_async.py new file mode 100644 index 000000000000..515fa7bd18ab --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_enable_processor_async.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for EnableProcessor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_EnableProcessor_async] +from google.cloud import documentai_v1beta3 + + +async def sample_enable_processor(): + """Snippet for enable_processor""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.EnableProcessorRequest( + name=name, + ) + + # Make the request + operation = client.enable_processor(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_EnableProcessor_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_enable_processor_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_enable_processor_sync.py new file mode 100644 index 000000000000..17cc9f76dc39 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_enable_processor_sync.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for EnableProcessor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_EnableProcessor_sync] +from google.cloud import documentai_v1beta3 + + +def sample_enable_processor(): + """Snippet for enable_processor""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.EnableProcessorRequest( + name=name, + ) + + # Make the request + operation = client.enable_processor(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_EnableProcessor_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_fetch_processor_types_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_fetch_processor_types_async.py new file mode 100644 index 000000000000..ba9971de7f12 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_fetch_processor_types_async.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchProcessorTypes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_FetchProcessorTypes_async] +from google.cloud import documentai_v1beta3 + + +async def sample_fetch_processor_types(): + """Snippet for fetch_processor_types""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor_type = "processor_type_value" + parent = f"projects/{project}/locations/{location}/processorTypes/{processor_type}" + + request = documentai_v1beta3.FetchProcessorTypesRequest( + parent=parent, + ) + + # Make the request + response = await client.fetch_processor_types(request=request) + + # Handle response + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_FetchProcessorTypes_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_fetch_processor_types_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_fetch_processor_types_sync.py new file mode 100644 index 000000000000..5d2cde3f81cd --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_fetch_processor_types_sync.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for FetchProcessorTypes +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_FetchProcessorTypes_sync] +from google.cloud import documentai_v1beta3 + + +def sample_fetch_processor_types(): + """Snippet for fetch_processor_types""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor_type = "processor_type_value" + parent = f"projects/{project}/locations/{location}/processorTypes/{processor_type}" + + request = documentai_v1beta3.FetchProcessorTypesRequest( + parent=parent, + ) + + # Make the request + response = client.fetch_processor_types(request=request) + + # Handle response + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_FetchProcessorTypes_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_list_processors_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_list_processors_async.py new file mode 100644 index 000000000000..2cf1a9e1af8b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_list_processors_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListProcessors +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_ListProcessors_async] +from google.cloud import documentai_v1beta3 + + +async def sample_list_processors(): + """Snippet for list_processors""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + parent = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.ListProcessorsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_processors(request=request) + async for response in page_result: + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_ListProcessors_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_list_processors_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_list_processors_sync.py new file mode 100644 index 000000000000..6d84b5e5515b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_list_processors_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListProcessors +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_ListProcessors_sync] +from google.cloud import documentai_v1beta3 + + +def sample_list_processors(): + """Snippet for list_processors""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceClient() + + # Initialize request argument(s) + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + parent = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.ListProcessorsRequest( + parent=parent, + ) + + # Make the request + page_result = client.list_processors(request=request) + for response in page_result: + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_ListProcessors_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_process_document_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_process_document_async.py new file mode 100644 index 000000000000..46c9c1175123 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_process_document_async.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ProcessDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_ProcessDocument_async] +from google.cloud import documentai_v1beta3 + + +async def sample_process_document(): + """Snippet for process_document""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + inline_document = documentai_v1beta3.Document() + inline_document.uri = "uri_value" + + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.ProcessRequest( + inline_document=inline_document, + name=name, + ) + + # Make the request + response = await client.process_document(request=request) + + # Handle response + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_ProcessDocument_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_process_document_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_process_document_sync.py new file mode 100644 index 000000000000..259d85c981bf --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_process_document_sync.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ProcessDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_ProcessDocument_sync] +from google.cloud import documentai_v1beta3 + + +def sample_process_document(): + """Snippet for process_document""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceClient() + + # Initialize request argument(s) + inline_document = documentai_v1beta3.Document() + inline_document.uri = "uri_value" + + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + name = f"projects/{project}/locations/{location}/processors/{processor}" + + request = documentai_v1beta3.ProcessRequest( + inline_document=inline_document, + name=name, + ) + + # Make the request + response = client.process_document(request=request) + + # Handle response + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_ProcessDocument_sync] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_review_document_async.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_review_document_async.py new file mode 100644 index 000000000000..c40c5d9cd33f --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_review_document_async.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ReviewDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_ReviewDocument_async] +from google.cloud import documentai_v1beta3 + + +async def sample_review_document(): + """Snippet for review_document""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceAsyncClient() + + # Initialize request argument(s) + inline_document = documentai_v1beta3.Document() + inline_document.uri = "uri_value" + + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + human_review_config = f"projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" + + request = documentai_v1beta3.ReviewDocumentRequest( + inline_document=inline_document, + human_review_config=human_review_config, + ) + + # Make the request + operation = client.review_document(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_ReviewDocument_async] diff --git a/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_review_document_sync.py b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_review_document_sync.py new file mode 100644 index 000000000000..30d557997303 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated_samples/documentai_generated_documentai_v1beta3_document_processor_service_review_document_sync.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ReviewDocument +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-documentai + + +# [START documentai_generated_documentai_v1beta3_DocumentProcessorService_ReviewDocument_sync] +from google.cloud import documentai_v1beta3 + + +def sample_review_document(): + """Snippet for review_document""" + + # Create a client + client = documentai_v1beta3.DocumentProcessorServiceClient() + + # Initialize request argument(s) + inline_document = documentai_v1beta3.Document() + inline_document.uri = "uri_value" + + project = "my-project-id" + location = "us-central1" + processor = "processor_value" + human_review_config = f"projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" + + request = documentai_v1beta3.ReviewDocumentRequest( + inline_document=inline_document, + human_review_config=human_review_config, + ) + + # Make the request + operation = client.review_document(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + print(response) + +# [END documentai_generated_documentai_v1beta3_DocumentProcessorService_ReviewDocument_sync]