diff --git a/google/cloud/documentai/__init__.py b/google/cloud/documentai/__init__.py index 204c15ca..c550d366 100644 --- a/google/cloud/documentai/__init__.py +++ b/google/cloud/documentai/__init__.py @@ -37,9 +37,6 @@ from google.cloud.documentai_v1.types.document_processor_service import ( BatchProcessResponse, ) -from google.cloud.documentai_v1.types.document_processor_service import ( - CommonOperationMetadata, -) from google.cloud.documentai_v1.types.document_processor_service import ( HumanReviewStatus, ) @@ -57,6 +54,7 @@ from google.cloud.documentai_v1.types.geometry import BoundingPoly from google.cloud.documentai_v1.types.geometry import NormalizedVertex from google.cloud.documentai_v1.types.geometry import Vertex +from google.cloud.documentai_v1.types.operation_metadata import CommonOperationMetadata __all__ = ( "DocumentProcessorServiceClient", @@ -71,7 +69,6 @@ "BatchProcessMetadata", "BatchProcessRequest", "BatchProcessResponse", - "CommonOperationMetadata", "HumanReviewStatus", "ProcessRequest", "ProcessResponse", @@ -81,4 +78,5 @@ "BoundingPoly", "NormalizedVertex", "Vertex", + "CommonOperationMetadata", ) diff --git a/google/cloud/documentai_v1/__init__.py b/google/cloud/documentai_v1/__init__.py index c6cd3be9..5b1d91b3 100644 --- a/google/cloud/documentai_v1/__init__.py +++ b/google/cloud/documentai_v1/__init__.py @@ -27,7 +27,6 @@ from .types.document_processor_service import BatchProcessMetadata from .types.document_processor_service import BatchProcessRequest from .types.document_processor_service import BatchProcessResponse -from .types.document_processor_service import CommonOperationMetadata from .types.document_processor_service import HumanReviewStatus from .types.document_processor_service import ProcessRequest from .types.document_processor_service import ProcessResponse @@ -37,6 +36,7 @@ from .types.geometry import BoundingPoly from .types.geometry import NormalizedVertex from .types.geometry import Vertex +from .types.operation_metadata import CommonOperationMetadata __all__ = ( "DocumentProcessorServiceAsyncClient", diff --git a/google/cloud/documentai_v1/types/__init__.py b/google/cloud/documentai_v1/types/__init__.py index 2be40a09..677a7bcb 100644 --- a/google/cloud/documentai_v1/types/__init__.py +++ b/google/cloud/documentai_v1/types/__init__.py @@ -26,7 +26,6 @@ BatchProcessMetadata, BatchProcessRequest, BatchProcessResponse, - CommonOperationMetadata, HumanReviewStatus, ProcessRequest, ProcessResponse, @@ -39,6 +38,7 @@ NormalizedVertex, Vertex, ) +from .operation_metadata import CommonOperationMetadata __all__ = ( "Document", @@ -51,7 +51,6 @@ "BatchProcessMetadata", "BatchProcessRequest", "BatchProcessResponse", - "CommonOperationMetadata", "HumanReviewStatus", "ProcessRequest", "ProcessResponse", @@ -61,4 +60,5 @@ "BoundingPoly", "NormalizedVertex", "Vertex", + "CommonOperationMetadata", ) diff --git a/google/cloud/documentai_v1/types/document_processor_service.py b/google/cloud/documentai_v1/types/document_processor_service.py index f24ba8c4..38e915be 100644 --- a/google/cloud/documentai_v1/types/document_processor_service.py +++ b/google/cloud/documentai_v1/types/document_processor_service.py @@ -17,6 +17,7 @@ from google.cloud.documentai_v1.types import document as gcd_document from google.cloud.documentai_v1.types import document_io +from google.cloud.documentai_v1.types import operation_metadata from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore @@ -33,7 +34,6 @@ "ReviewDocumentRequest", "ReviewDocumentResponse", "ReviewDocumentOperationMetadata", - "CommonOperationMetadata", }, ) @@ -242,37 +242,8 @@ class ReviewDocumentOperationMetadata(proto.Message): """ common_metadata = proto.Field( - proto.MESSAGE, number=5, message="CommonOperationMetadata", + proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata, ) -class CommonOperationMetadata(proto.Message): - r"""The common metadata for long running operations. - Attributes: - state (google.cloud.documentai_v1.types.CommonOperationMetadata.State): - The state of the operation. - state_message (str): - A message providing more details about the - current state of processing. - create_time (google.protobuf.timestamp_pb2.Timestamp): - The creation time of the operation. - update_time (google.protobuf.timestamp_pb2.Timestamp): - The last update time of the operation. - """ - - class State(proto.Enum): - r"""State of the longrunning operation.""" - STATE_UNSPECIFIED = 0 - RUNNING = 1 - CANCELLING = 2 - SUCCEEDED = 3 - FAILED = 4 - CANCELLED = 5 - - state = proto.Field(proto.ENUM, number=1, enum=State,) - state_message = proto.Field(proto.STRING, number=2,) - create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - - __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/documentai_v1/types/geometry.py b/google/cloud/documentai_v1/types/geometry.py index ce8158da..6d755641 100644 --- a/google/cloud/documentai_v1/types/geometry.py +++ b/google/cloud/documentai_v1/types/geometry.py @@ -31,7 +31,8 @@ class Vertex(proto.Message): x (int): X coordinate. y (int): - Y coordinate. + Y coordinate (starts from the top of the + image). """ x = proto.Field(proto.INT32, number=1,) @@ -47,7 +48,8 @@ class NormalizedVertex(proto.Message): x (float): X coordinate. y (float): - Y coordinate. + Y coordinate (starts from the top of the + image). """ x = proto.Field(proto.FLOAT, number=1,) diff --git a/google/cloud/documentai_v1/types/operation_metadata.py b/google/cloud/documentai_v1/types/operation_metadata.py new file mode 100644 index 00000000..ae78340e --- /dev/null +++ b/google/cloud/documentai_v1/types/operation_metadata.py @@ -0,0 +1,55 @@ +# -*- 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. +# +import proto # type: ignore + +from google.protobuf import timestamp_pb2 # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.documentai.v1", manifest={"CommonOperationMetadata",}, +) + + +class CommonOperationMetadata(proto.Message): + r"""The common metadata for long running operations. + Attributes: + state (google.cloud.documentai_v1.types.CommonOperationMetadata.State): + The state of the operation. + state_message (str): + A message providing more details about the + current state of processing. + create_time (google.protobuf.timestamp_pb2.Timestamp): + The creation time of the operation. + update_time (google.protobuf.timestamp_pb2.Timestamp): + The last update time of the operation. + """ + + class State(proto.Enum): + r"""State of the longrunning operation.""" + STATE_UNSPECIFIED = 0 + RUNNING = 1 + CANCELLING = 2 + SUCCEEDED = 3 + FAILED = 4 + CANCELLED = 5 + + state = proto.Field(proto.ENUM, number=1, enum=State,) + state_message = proto.Field(proto.STRING, number=2,) + create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) + + +__all__ = tuple(sorted(__protobuf__.manifest))