diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Barcode.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Barcode.php new file mode 100644 index 000000000000..fc1bf55a7ae2 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Barcode.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile( + ' + +(google/cloud/documentai/v1/barcode.protogoogle.cloud.documentai.v1"B +Barcode +format (  + value_format (  + raw_value ( B +com.google.cloud.documentai.v1B BarcodeProtoPZ>cloud.google.com/go/documentai/apiv1/documentaipb;documentaipbGoogle.Cloud.DocumentAI.V1Google\\Cloud\\DocumentAI\\V1Google::Cloud::DocumentAI::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Document.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Document.php new file mode 100644 index 000000000000..a1af7ec3b387 Binary files /dev/null and b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Document.php differ diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/DocumentIo.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/DocumentIo.php new file mode 100644 index 000000000000..0da52cce58e7 Binary files /dev/null and b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/DocumentIo.php differ diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/DocumentProcessorService.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/DocumentProcessorService.php new file mode 100644 index 000000000000..3116356b7020 Binary files /dev/null and b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/DocumentProcessorService.php differ diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/DocumentSchema.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/DocumentSchema.php new file mode 100644 index 000000000000..9ca954d27439 Binary files /dev/null and b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/DocumentSchema.php differ diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Evaluation.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Evaluation.php new file mode 100644 index 000000000000..ad18cd715e60 Binary files /dev/null and b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Evaluation.php differ diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Geometry.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Geometry.php new file mode 100644 index 000000000000..2780ed666e20 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Geometry.php @@ -0,0 +1,36 @@ +internalAddGeneratedFile( + ' + +)google/cloud/documentai/v1/geometry.protogoogle.cloud.documentai.v1" +Vertex +x ( +y ("( +NormalizedVertex +x ( +y (" + BoundingPoly4 +vertices ( 2".google.cloud.documentai.v1.VertexI +normalized_vertices ( 2,.google.cloud.documentai.v1.NormalizedVertexB +com.google.cloud.documentai.v1B GeometryProtoPZ>cloud.google.com/go/documentai/apiv1/documentaipb;documentaipbGoogle.Cloud.DocumentAI.V1Google\\Cloud\\DocumentAI\\V1Google::Cloud::DocumentAI::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/OperationMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/OperationMetadata.php new file mode 100644 index 000000000000..5152d9893a80 Binary files /dev/null and b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/OperationMetadata.php differ diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Processor.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Processor.php new file mode 100644 index 000000000000..fcfbdd5a105e Binary files /dev/null and b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/Processor.php differ diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/ProcessorType.php b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/ProcessorType.php new file mode 100644 index 000000000000..65a61c15c025 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/GPBMetadata/Google/Cloud/Documentai/V1/ProcessorType.php @@ -0,0 +1,40 @@ +internalAddGeneratedFile( + ' + +/google/cloud/documentai/v1/processor_type.protogoogle.cloud.documentai.v1google/api/resource.proto" + ProcessorType +name (  +type (  +category ( S +available_locations ( 26.google.cloud.documentai.v1.ProcessorType.LocationInfo +allow_creation (- + launch_stage (2.google.api.LaunchStage +sample_document_uris ( # + LocationInfo + location_id ( :uAr +\'documentai.googleapis.com/ProcessorTypeGprojects/{project}/locations/{location}/processorTypes/{processor_type}B +com.google.cloud.documentai.v1BDocumentAiProcessorTypePZ>cloud.google.com/go/documentai/apiv1/documentaipb;documentaipbGoogle.Cloud.DocumentAI.V1Google\\Cloud\\DocumentAI\\V1Google::Cloud::DocumentAI::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Barcode.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Barcode.php new file mode 100644 index 000000000000..c07863d95b65 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Barcode.php @@ -0,0 +1,255 @@ +google.cloud.documentai.v1.Barcode + */ +class Barcode extends \Google\Protobuf\Internal\Message +{ + /** + * Format of a barcode. + * The supported formats are: + * - `CODE_128`: Code 128 type. + * - `CODE_39`: Code 39 type. + * - `CODE_93`: Code 93 type. + * - `CODABAR`: Codabar type. + * - `DATA_MATRIX`: 2D Data Matrix type. + * - `ITF`: ITF type. + * - `EAN_13`: EAN-13 type. + * - `EAN_8`: EAN-8 type. + * - `QR_CODE`: 2D QR code type. + * - `UPC_A`: UPC-A type. + * - `UPC_E`: UPC-E type. + * - `PDF417`: PDF417 type. + * - `AZTEC`: 2D Aztec code type. + * - `DATABAR`: GS1 DataBar code type. + * + * Generated from protobuf field string format = 1; + */ + protected $format = ''; + /** + * Value format describes the format of the value that a barcode + * encodes. + * The supported formats are: + * - `CONTACT_INFO`: Contact information. + * - `EMAIL`: Email address. + * - `ISBN`: ISBN identifier. + * - `PHONE`: Phone number. + * - `PRODUCT`: Product. + * - `SMS`: SMS message. + * - `TEXT`: Text string. + * - `URL`: URL address. + * - `WIFI`: Wifi information. + * - `GEO`: Geo-localization. + * - `CALENDAR_EVENT`: Calendar event. + * - `DRIVER_LICENSE`: Driver's license. + * + * Generated from protobuf field string value_format = 2; + */ + protected $value_format = ''; + /** + * Raw value encoded in the barcode. + * For example: `'MEBKM:TITLE:Google;URL:https://www.google.com;;'`. + * + * Generated from protobuf field string raw_value = 3; + */ + protected $raw_value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $format + * Format of a barcode. + * The supported formats are: + * - `CODE_128`: Code 128 type. + * - `CODE_39`: Code 39 type. + * - `CODE_93`: Code 93 type. + * - `CODABAR`: Codabar type. + * - `DATA_MATRIX`: 2D Data Matrix type. + * - `ITF`: ITF type. + * - `EAN_13`: EAN-13 type. + * - `EAN_8`: EAN-8 type. + * - `QR_CODE`: 2D QR code type. + * - `UPC_A`: UPC-A type. + * - `UPC_E`: UPC-E type. + * - `PDF417`: PDF417 type. + * - `AZTEC`: 2D Aztec code type. + * - `DATABAR`: GS1 DataBar code type. + * @type string $value_format + * Value format describes the format of the value that a barcode + * encodes. + * The supported formats are: + * - `CONTACT_INFO`: Contact information. + * - `EMAIL`: Email address. + * - `ISBN`: ISBN identifier. + * - `PHONE`: Phone number. + * - `PRODUCT`: Product. + * - `SMS`: SMS message. + * - `TEXT`: Text string. + * - `URL`: URL address. + * - `WIFI`: Wifi information. + * - `GEO`: Geo-localization. + * - `CALENDAR_EVENT`: Calendar event. + * - `DRIVER_LICENSE`: Driver's license. + * @type string $raw_value + * Raw value encoded in the barcode. + * For example: `'MEBKM:TITLE:Google;URL:https://www.google.com;;'`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Barcode::initOnce(); + parent::__construct($data); + } + + /** + * Format of a barcode. + * The supported formats are: + * - `CODE_128`: Code 128 type. + * - `CODE_39`: Code 39 type. + * - `CODE_93`: Code 93 type. + * - `CODABAR`: Codabar type. + * - `DATA_MATRIX`: 2D Data Matrix type. + * - `ITF`: ITF type. + * - `EAN_13`: EAN-13 type. + * - `EAN_8`: EAN-8 type. + * - `QR_CODE`: 2D QR code type. + * - `UPC_A`: UPC-A type. + * - `UPC_E`: UPC-E type. + * - `PDF417`: PDF417 type. + * - `AZTEC`: 2D Aztec code type. + * - `DATABAR`: GS1 DataBar code type. + * + * Generated from protobuf field string format = 1; + * @return string + */ + public function getFormat() + { + return $this->format; + } + + /** + * Format of a barcode. + * The supported formats are: + * - `CODE_128`: Code 128 type. + * - `CODE_39`: Code 39 type. + * - `CODE_93`: Code 93 type. + * - `CODABAR`: Codabar type. + * - `DATA_MATRIX`: 2D Data Matrix type. + * - `ITF`: ITF type. + * - `EAN_13`: EAN-13 type. + * - `EAN_8`: EAN-8 type. + * - `QR_CODE`: 2D QR code type. + * - `UPC_A`: UPC-A type. + * - `UPC_E`: UPC-E type. + * - `PDF417`: PDF417 type. + * - `AZTEC`: 2D Aztec code type. + * - `DATABAR`: GS1 DataBar code type. + * + * Generated from protobuf field string format = 1; + * @param string $var + * @return $this + */ + public function setFormat($var) + { + GPBUtil::checkString($var, True); + $this->format = $var; + + return $this; + } + + /** + * Value format describes the format of the value that a barcode + * encodes. + * The supported formats are: + * - `CONTACT_INFO`: Contact information. + * - `EMAIL`: Email address. + * - `ISBN`: ISBN identifier. + * - `PHONE`: Phone number. + * - `PRODUCT`: Product. + * - `SMS`: SMS message. + * - `TEXT`: Text string. + * - `URL`: URL address. + * - `WIFI`: Wifi information. + * - `GEO`: Geo-localization. + * - `CALENDAR_EVENT`: Calendar event. + * - `DRIVER_LICENSE`: Driver's license. + * + * Generated from protobuf field string value_format = 2; + * @return string + */ + public function getValueFormat() + { + return $this->value_format; + } + + /** + * Value format describes the format of the value that a barcode + * encodes. + * The supported formats are: + * - `CONTACT_INFO`: Contact information. + * - `EMAIL`: Email address. + * - `ISBN`: ISBN identifier. + * - `PHONE`: Phone number. + * - `PRODUCT`: Product. + * - `SMS`: SMS message. + * - `TEXT`: Text string. + * - `URL`: URL address. + * - `WIFI`: Wifi information. + * - `GEO`: Geo-localization. + * - `CALENDAR_EVENT`: Calendar event. + * - `DRIVER_LICENSE`: Driver's license. + * + * Generated from protobuf field string value_format = 2; + * @param string $var + * @return $this + */ + public function setValueFormat($var) + { + GPBUtil::checkString($var, True); + $this->value_format = $var; + + return $this; + } + + /** + * Raw value encoded in the barcode. + * For example: `'MEBKM:TITLE:Google;URL:https://www.google.com;;'`. + * + * Generated from protobuf field string raw_value = 3; + * @return string + */ + public function getRawValue() + { + return $this->raw_value; + } + + /** + * Raw value encoded in the barcode. + * For example: `'MEBKM:TITLE:Google;URL:https://www.google.com;;'`. + * + * Generated from protobuf field string raw_value = 3; + * @param string $var + * @return $this + */ + public function setRawValue($var) + { + GPBUtil::checkString($var, True); + $this->raw_value = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchDocumentsInputConfig.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchDocumentsInputConfig.php new file mode 100644 index 000000000000..087665129f05 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchDocumentsInputConfig.php @@ -0,0 +1,108 @@ +google.cloud.documentai.v1.BatchDocumentsInputConfig + */ +class BatchDocumentsInputConfig extends \Google\Protobuf\Internal\Message +{ + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\GcsPrefix $gcs_prefix + * The set of documents that match the specified Cloud Storage `gcs_prefix`. + * @type \Google\Cloud\DocumentAI\V1\GcsDocuments $gcs_documents + * The set of documents individually specified on Cloud Storage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * The set of documents that match the specified Cloud Storage `gcs_prefix`. + * + * Generated from protobuf field .google.cloud.documentai.v1.GcsPrefix gcs_prefix = 1; + * @return \Google\Cloud\DocumentAI\V1\GcsPrefix|null + */ + public function getGcsPrefix() + { + return $this->readOneof(1); + } + + public function hasGcsPrefix() + { + return $this->hasOneof(1); + } + + /** + * The set of documents that match the specified Cloud Storage `gcs_prefix`. + * + * Generated from protobuf field .google.cloud.documentai.v1.GcsPrefix gcs_prefix = 1; + * @param \Google\Cloud\DocumentAI\V1\GcsPrefix $var + * @return $this + */ + public function setGcsPrefix($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\GcsPrefix::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The set of documents individually specified on Cloud Storage. + * + * Generated from protobuf field .google.cloud.documentai.v1.GcsDocuments gcs_documents = 2; + * @return \Google\Cloud\DocumentAI\V1\GcsDocuments|null + */ + public function getGcsDocuments() + { + return $this->readOneof(2); + } + + public function hasGcsDocuments() + { + return $this->hasOneof(2); + } + + /** + * The set of documents individually specified on Cloud Storage. + * + * Generated from protobuf field .google.cloud.documentai.v1.GcsDocuments gcs_documents = 2; + * @param \Google\Cloud\DocumentAI\V1\GcsDocuments $var + * @return $this + */ + public function setGcsDocuments($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\GcsDocuments::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessMetadata.php new file mode 100644 index 000000000000..acda6f101347 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessMetadata.php @@ -0,0 +1,228 @@ +google.cloud.documentai.v1.BatchProcessMetadata + */ +class BatchProcessMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the current batch processing. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchProcessMetadata.State state = 1; + */ + protected $state = 0; + /** + * A message providing more details about the current state of processing. + * For example, the error message if the operation is failed. + * + * Generated from protobuf field string state_message = 2; + */ + protected $state_message = ''; + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + */ + protected $create_time = null; + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + protected $update_time = null; + /** + * The list of response details of each document. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + */ + private $individual_process_statuses; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the current batch processing. + * @type string $state_message + * A message providing more details about the current state of processing. + * For example, the error message if the operation is failed. + * @type \Google\Protobuf\Timestamp $create_time + * The creation time of the operation. + * @type \Google\Protobuf\Timestamp $update_time + * The last update time of the operation. + * @type array<\Google\Cloud\DocumentAI\V1\BatchProcessMetadata\IndividualProcessStatus>|\Google\Protobuf\Internal\RepeatedField $individual_process_statuses + * The list of response details of each document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The state of the current batch processing. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchProcessMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the current batch processing. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchProcessMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\BatchProcessMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * A message providing more details about the current state of processing. + * For example, the error message if the operation is failed. + * + * Generated from protobuf field string state_message = 2; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * A message providing more details about the current state of processing. + * For example, the error message if the operation is failed. + * + * Generated from protobuf field string state_message = 2; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * The list of response details of each document. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIndividualProcessStatuses() + { + return $this->individual_process_statuses; + } + + /** + * The list of response details of each document. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * @param array<\Google\Cloud\DocumentAI\V1\BatchProcessMetadata\IndividualProcessStatus>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIndividualProcessStatuses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\BatchProcessMetadata\IndividualProcessStatus::class); + $this->individual_process_statuses = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessMetadata/IndividualProcessStatus.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessMetadata/IndividualProcessStatus.php new file mode 100644 index 000000000000..9b8d8d2c539b --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessMetadata/IndividualProcessStatus.php @@ -0,0 +1,208 @@ +google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus + */ +class IndividualProcessStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The source of the document, same as the + * [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source] + * field in the request when the batch process started. + * + * Generated from protobuf field string input_gcs_source = 1; + */ + protected $input_gcs_source = ''; + /** + * The status processing the document. + * + * Generated from protobuf field .google.rpc.Status status = 2; + */ + protected $status = null; + /** + * The Cloud Storage output destination (in the request as + * [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]) + * of the processed document if it was successful, otherwise empty. + * + * Generated from protobuf field string output_gcs_destination = 3; + */ + protected $output_gcs_destination = ''; + /** + * The status of human review on the processed document. + * + * Generated from protobuf field .google.cloud.documentai.v1.HumanReviewStatus human_review_status = 5; + */ + protected $human_review_status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $input_gcs_source + * The source of the document, same as the + * [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source] + * field in the request when the batch process started. + * @type \Google\Rpc\Status $status + * The status processing the document. + * @type string $output_gcs_destination + * The Cloud Storage output destination (in the request as + * [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]) + * of the processed document if it was successful, otherwise empty. + * @type \Google\Cloud\DocumentAI\V1\HumanReviewStatus $human_review_status + * The status of human review on the processed document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The source of the document, same as the + * [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source] + * field in the request when the batch process started. + * + * Generated from protobuf field string input_gcs_source = 1; + * @return string + */ + public function getInputGcsSource() + { + return $this->input_gcs_source; + } + + /** + * The source of the document, same as the + * [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source] + * field in the request when the batch process started. + * + * Generated from protobuf field string input_gcs_source = 1; + * @param string $var + * @return $this + */ + public function setInputGcsSource($var) + { + GPBUtil::checkString($var, True); + $this->input_gcs_source = $var; + + return $this; + } + + /** + * The status processing the document. + * + * Generated from protobuf field .google.rpc.Status status = 2; + * @return \Google\Rpc\Status|null + */ + public function getStatus() + { + return $this->status; + } + + public function hasStatus() + { + return isset($this->status); + } + + public function clearStatus() + { + unset($this->status); + } + + /** + * The status processing the document. + * + * Generated from protobuf field .google.rpc.Status status = 2; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->status = $var; + + return $this; + } + + /** + * The Cloud Storage output destination (in the request as + * [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]) + * of the processed document if it was successful, otherwise empty. + * + * Generated from protobuf field string output_gcs_destination = 3; + * @return string + */ + public function getOutputGcsDestination() + { + return $this->output_gcs_destination; + } + + /** + * The Cloud Storage output destination (in the request as + * [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]) + * of the processed document if it was successful, otherwise empty. + * + * Generated from protobuf field string output_gcs_destination = 3; + * @param string $var + * @return $this + */ + public function setOutputGcsDestination($var) + { + GPBUtil::checkString($var, True); + $this->output_gcs_destination = $var; + + return $this; + } + + /** + * The status of human review on the processed document. + * + * Generated from protobuf field .google.cloud.documentai.v1.HumanReviewStatus human_review_status = 5; + * @return \Google\Cloud\DocumentAI\V1\HumanReviewStatus|null + */ + public function getHumanReviewStatus() + { + return $this->human_review_status; + } + + public function hasHumanReviewStatus() + { + return isset($this->human_review_status); + } + + public function clearHumanReviewStatus() + { + unset($this->human_review_status); + } + + /** + * The status of human review on the processed document. + * + * Generated from protobuf field .google.cloud.documentai.v1.HumanReviewStatus human_review_status = 5; + * @param \Google\Cloud\DocumentAI\V1\HumanReviewStatus $var + * @return $this + */ + public function setHumanReviewStatus($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\HumanReviewStatus::class); + $this->human_review_status = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IndividualProcessStatus::class, \Google\Cloud\DocumentAI\V1\BatchProcessMetadata_IndividualProcessStatus::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessMetadata/State.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessMetadata/State.php new file mode 100644 index 000000000000..2271791e75f1 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessMetadata/State.php @@ -0,0 +1,92 @@ +google.cloud.documentai.v1.BatchProcessMetadata.State + */ +class State +{ + /** + * The default value. This value is used if the state is omitted. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Request operation is waiting for scheduling. + * + * Generated from protobuf enum WAITING = 1; + */ + const WAITING = 1; + /** + * Request is being processed. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The batch processing completed successfully. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * The batch processing was being cancelled. + * + * Generated from protobuf enum CANCELLING = 4; + */ + const CANCELLING = 4; + /** + * The batch processing was cancelled. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + /** + * The batch processing has failed. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::WAITING => 'WAITING', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::CANCELLING => 'CANCELLING', + self::CANCELLED => 'CANCELLED', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\DocumentAI\V1\BatchProcessMetadata_State::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessRequest.php new file mode 100644 index 000000000000..497ce50f8225 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessRequest.php @@ -0,0 +1,292 @@ +google.cloud.documentai.v1.BatchProcessRequest + */ +class BatchProcessRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The input documents for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig input_documents = 5; + */ + protected $input_documents = null; + /** + * The output configuration for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentOutputConfig document_output_config = 6; + */ + protected $document_output_config = null; + /** + * Whether human review should be skipped for this request. Default to + * `false`. + * + * Generated from protobuf field bool skip_human_review = 4; + */ + protected $skip_human_review = false; + /** + * Inference-time options for the process API + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions process_options = 7; + */ + protected $process_options = null; + + /** + * @param string $name Required. The resource name of + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * @return \Google\Cloud\DocumentAI\V1\BatchProcessRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @type \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig $input_documents + * The input documents for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * @type \Google\Cloud\DocumentAI\V1\DocumentOutputConfig $document_output_config + * The output configuration for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * @type bool $skip_human_review + * Whether human review should be skipped for this request. Default to + * `false`. + * @type \Google\Cloud\DocumentAI\V1\ProcessOptions $process_options + * Inference-time options for the process API + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The input documents for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig input_documents = 5; + * @return \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig|null + */ + public function getInputDocuments() + { + return $this->input_documents; + } + + public function hasInputDocuments() + { + return isset($this->input_documents); + } + + public function clearInputDocuments() + { + unset($this->input_documents); + } + + /** + * The input documents for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig input_documents = 5; + * @param \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig $var + * @return $this + */ + public function setInputDocuments($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig::class); + $this->input_documents = $var; + + return $this; + } + + /** + * The output configuration for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentOutputConfig document_output_config = 6; + * @return \Google\Cloud\DocumentAI\V1\DocumentOutputConfig|null + */ + public function getDocumentOutputConfig() + { + return $this->document_output_config; + } + + public function hasDocumentOutputConfig() + { + return isset($this->document_output_config); + } + + public function clearDocumentOutputConfig() + { + unset($this->document_output_config); + } + + /** + * The output configuration for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentOutputConfig document_output_config = 6; + * @param \Google\Cloud\DocumentAI\V1\DocumentOutputConfig $var + * @return $this + */ + public function setDocumentOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\DocumentOutputConfig::class); + $this->document_output_config = $var; + + return $this; + } + + /** + * Whether human review should be skipped for this request. Default to + * `false`. + * + * Generated from protobuf field bool skip_human_review = 4; + * @return bool + */ + public function getSkipHumanReview() + { + return $this->skip_human_review; + } + + /** + * Whether human review should be skipped for this request. Default to + * `false`. + * + * Generated from protobuf field bool skip_human_review = 4; + * @param bool $var + * @return $this + */ + public function setSkipHumanReview($var) + { + GPBUtil::checkBool($var); + $this->skip_human_review = $var; + + return $this; + } + + /** + * Inference-time options for the process API + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions process_options = 7; + * @return \Google\Cloud\DocumentAI\V1\ProcessOptions|null + */ + public function getProcessOptions() + { + return $this->process_options; + } + + public function hasProcessOptions() + { + return isset($this->process_options); + } + + public function clearProcessOptions() + { + unset($this->process_options); + } + + /** + * Inference-time options for the process API + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions process_options = 7; + * @param \Google\Cloud\DocumentAI\V1\ProcessOptions $var + * @return $this + */ + public function setProcessOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\ProcessOptions::class); + $this->process_options = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessResponse.php new file mode 100644 index 000000000000..57562ab5f73f --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BatchProcessResponse.php @@ -0,0 +1,34 @@ +google.cloud.documentai.v1.BatchProcessResponse + */ +class BatchProcessResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BoundingPoly.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BoundingPoly.php new file mode 100644 index 000000000000..90a2873a1327 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/BoundingPoly.php @@ -0,0 +1,101 @@ +google.cloud.documentai.v1.BoundingPoly + */ +class BoundingPoly extends \Google\Protobuf\Internal\Message +{ + /** + * The bounding polygon vertices. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Vertex vertices = 1; + */ + private $vertices; + /** + * The bounding polygon normalized vertices. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.NormalizedVertex normalized_vertices = 2; + */ + private $normalized_vertices; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\Vertex>|\Google\Protobuf\Internal\RepeatedField $vertices + * The bounding polygon vertices. + * @type array<\Google\Cloud\DocumentAI\V1\NormalizedVertex>|\Google\Protobuf\Internal\RepeatedField $normalized_vertices + * The bounding polygon normalized vertices. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * The bounding polygon vertices. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Vertex vertices = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVertices() + { + return $this->vertices; + } + + /** + * The bounding polygon vertices. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Vertex vertices = 1; + * @param array<\Google\Cloud\DocumentAI\V1\Vertex>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVertices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Vertex::class); + $this->vertices = $arr; + + return $this; + } + + /** + * The bounding polygon normalized vertices. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.NormalizedVertex normalized_vertices = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNormalizedVertices() + { + return $this->normalized_vertices; + } + + /** + * The bounding polygon normalized vertices. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.NormalizedVertex normalized_vertices = 2; + * @param array<\Google\Cloud\DocumentAI\V1\NormalizedVertex>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNormalizedVertices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\NormalizedVertex::class); + $this->normalized_vertices = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/CommonOperationMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/CommonOperationMetadata.php new file mode 100644 index 000000000000..e5406876c1ca --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/CommonOperationMetadata.php @@ -0,0 +1,223 @@ +google.cloud.documentai.v1.CommonOperationMetadata + */ +class CommonOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata.State state = 1; + */ + protected $state = 0; + /** + * A message providing more details about the current state of processing. + * + * Generated from protobuf field string state_message = 2; + */ + protected $state_message = ''; + /** + * A related resource to this operation. + * + * Generated from protobuf field string resource = 5; + */ + protected $resource = ''; + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + */ + protected $create_time = null; + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the operation. + * @type string $state_message + * A message providing more details about the current state of processing. + * @type string $resource + * A related resource to this operation. + * @type \Google\Protobuf\Timestamp $create_time + * The creation time of the operation. + * @type \Google\Protobuf\Timestamp $update_time + * The last update time of the operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\OperationMetadata::initOnce(); + parent::__construct($data); + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata\State::class); + $this->state = $var; + + return $this; + } + + /** + * A message providing more details about the current state of processing. + * + * Generated from protobuf field string state_message = 2; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * A message providing more details about the current state of processing. + * + * Generated from protobuf field string state_message = 2; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * A related resource to this operation. + * + * Generated from protobuf field string resource = 5; + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * A related resource to this operation. + * + * Generated from protobuf field string resource = 5; + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The creation time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * The last update time of the operation. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/CommonOperationMetadata/State.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/CommonOperationMetadata/State.php new file mode 100644 index 000000000000..59ee91f8b60e --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/CommonOperationMetadata/State.php @@ -0,0 +1,85 @@ +google.cloud.documentai.v1.CommonOperationMetadata.State + */ +class State +{ + /** + * Unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Operation is still running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * Operation is being cancelled. + * + * Generated from protobuf enum CANCELLING = 2; + */ + const CANCELLING = 2; + /** + * Operation succeeded. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + /** + * Operation failed. + * + * Generated from protobuf enum FAILED = 4; + */ + const FAILED = 4; + /** + * Operation is cancelled. + * + * Generated from protobuf enum CANCELLED = 5; + */ + const CANCELLED = 5; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::CANCELLING => 'CANCELLING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + self::CANCELLED => 'CANCELLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata_State::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/CreateProcessorRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/CreateProcessorRequest.php new file mode 100644 index 000000000000..1075d87e68ca --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/CreateProcessorRequest.php @@ -0,0 +1,156 @@ +google.cloud.documentai.v1.CreateProcessorRequest + */ +class CreateProcessorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent (project and location) under which to create the + * processor. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The processor to be created, requires + * [Processor.type][google.cloud.documentai.v1.Processor.type] and + * [Processor.display_name]][] to be set. Also, the + * [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] + * field must be set if the processor is under CMEK. + * + * Generated from protobuf field .google.cloud.documentai.v1.Processor processor = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $processor = null; + + /** + * @param string $parent Required. The parent (project and location) under which to create the + * processor. Format: `projects/{project}/locations/{location}` + * Please see {@see DocumentProcessorServiceClient::locationName()} for help formatting this field. + * @param \Google\Cloud\DocumentAI\V1\Processor $processor Required. The processor to be created, requires + * [Processor.type][google.cloud.documentai.v1.Processor.type] and + * [Processor.display_name]][] to be set. Also, the + * [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] + * field must be set if the processor is under CMEK. + * + * @return \Google\Cloud\DocumentAI\V1\CreateProcessorRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\DocumentAI\V1\Processor $processor): self + { + return (new self()) + ->setParent($parent) + ->setProcessor($processor); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent (project and location) under which to create the + * processor. Format: `projects/{project}/locations/{location}` + * @type \Google\Cloud\DocumentAI\V1\Processor $processor + * Required. The processor to be created, requires + * [Processor.type][google.cloud.documentai.v1.Processor.type] and + * [Processor.display_name]][] to be set. Also, the + * [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] + * field must be set if the processor is under CMEK. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent (project and location) under which to create the + * processor. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent (project and location) under which to create the + * processor. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The processor to be created, requires + * [Processor.type][google.cloud.documentai.v1.Processor.type] and + * [Processor.display_name]][] to be set. Also, the + * [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] + * field must be set if the processor is under CMEK. + * + * Generated from protobuf field .google.cloud.documentai.v1.Processor processor = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\DocumentAI\V1\Processor|null + */ + public function getProcessor() + { + return $this->processor; + } + + public function hasProcessor() + { + return isset($this->processor); + } + + public function clearProcessor() + { + unset($this->processor); + } + + /** + * Required. The processor to be created, requires + * [Processor.type][google.cloud.documentai.v1.Processor.type] and + * [Processor.display_name]][] to be set. Also, the + * [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] + * field must be set if the processor is under CMEK. + * + * Generated from protobuf field .google.cloud.documentai.v1.Processor processor = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\DocumentAI\V1\Processor $var + * @return $this + */ + public function setProcessor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Processor::class); + $this->processor = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorMetadata.php new file mode 100644 index 000000000000..80124ed069c0 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorMetadata.php @@ -0,0 +1,79 @@ +google.cloud.documentai.v1.DeleteProcessorMetadata + */ +class DeleteProcessorMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + */ + protected $common_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorRequest.php new file mode 100644 index 000000000000..6cb572b012b4 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorRequest.php @@ -0,0 +1,83 @@ +google.cloud.documentai.v1.DeleteProcessorRequest + */ +class DeleteProcessorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The processor resource name to be deleted. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The processor resource name to be deleted. Please see + * {@see DocumentProcessorServiceClient::processorName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\DeleteProcessorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The processor resource name to be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The processor resource name to be deleted. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The processor resource name to be deleted. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorVersionMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorVersionMetadata.php new file mode 100644 index 000000000000..4327a21261df --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorVersionMetadata.php @@ -0,0 +1,79 @@ +google.cloud.documentai.v1.DeleteProcessorVersionMetadata + */ +class DeleteProcessorVersionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + */ + protected $common_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorVersionRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorVersionRequest.php new file mode 100644 index 000000000000..c1b9fe66983a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeleteProcessorVersionRequest.php @@ -0,0 +1,83 @@ +google.cloud.documentai.v1.DeleteProcessorVersionRequest + */ +class DeleteProcessorVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The processor version resource name to be deleted. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The processor version resource name to be deleted. Please see + * {@see DocumentProcessorServiceClient::processorVersionName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\DeleteProcessorVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The processor version resource name to be deleted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The processor version resource name to be deleted. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The processor version resource name to be deleted. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeployProcessorVersionMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeployProcessorVersionMetadata.php new file mode 100644 index 000000000000..58dbc80516ee --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeployProcessorVersionMetadata.php @@ -0,0 +1,79 @@ +google.cloud.documentai.v1.DeployProcessorVersionMetadata + */ +class DeployProcessorVersionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + */ + protected $common_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeployProcessorVersionRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeployProcessorVersionRequest.php new file mode 100644 index 000000000000..38bd51702394 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeployProcessorVersionRequest.php @@ -0,0 +1,83 @@ +google.cloud.documentai.v1.DeployProcessorVersionRequest + */ +class DeployProcessorVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The processor version resource name to be deployed. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The processor version resource name to be deployed. Please see + * {@see DocumentProcessorServiceClient::processorVersionName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\DeployProcessorVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The processor version resource name to be deployed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The processor version resource name to be deployed. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The processor version resource name to be deployed. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeployProcessorVersionResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeployProcessorVersionResponse.php new file mode 100644 index 000000000000..f44a4454de41 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DeployProcessorVersionResponse.php @@ -0,0 +1,35 @@ +google.cloud.documentai.v1.DeployProcessorVersionResponse + */ +class DeployProcessorVersionResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DisableProcessorMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DisableProcessorMetadata.php new file mode 100644 index 000000000000..dbecdbea0c9e --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DisableProcessorMetadata.php @@ -0,0 +1,79 @@ +google.cloud.documentai.v1.DisableProcessorMetadata + */ +class DisableProcessorMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + */ + protected $common_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DisableProcessorRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DisableProcessorRequest.php new file mode 100644 index 000000000000..fcefe5486fe9 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DisableProcessorRequest.php @@ -0,0 +1,69 @@ +google.cloud.documentai.v1.DisableProcessorRequest + */ +class DisableProcessorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The processor resource name to be disabled. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The processor resource name to be disabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The processor resource name to be disabled. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The processor resource name to be disabled. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DisableProcessorResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DisableProcessorResponse.php new file mode 100644 index 000000000000..f1f15d776735 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DisableProcessorResponse.php @@ -0,0 +1,35 @@ +google.cloud.documentai.v1.DisableProcessorResponse + */ +class DisableProcessorResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document.php new file mode 100644 index 000000000000..792798286676 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document.php @@ -0,0 +1,523 @@ +google.cloud.documentai.v1.Document + */ +class Document extends \Google\Protobuf\Internal\Message +{ + /** + * An IANA published [media type (MIME + * type)](https://www.iana.org/assignments/media-types/media-types.xhtml). + * + * Generated from protobuf field string mime_type = 3; + */ + protected $mime_type = ''; + /** + * Optional. UTF-8 encoded text in reading order from the document. + * + * Generated from protobuf field string text = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $text = ''; + /** + * Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Style text_styles = 5 [deprecated = true]; + * @deprecated + */ + private $text_styles; + /** + * Visual page layout for the [Document][google.cloud.documentai.v1.Document]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page pages = 6; + */ + private $pages; + /** + * A list of entities detected on + * [Document.text][google.cloud.documentai.v1.Document.text]. For document + * shards, entities in this list may cross shard boundaries. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Entity entities = 7; + */ + private $entities; + /** + * Placeholder. Relationship among + * [Document.entities][google.cloud.documentai.v1.Document.entities]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.EntityRelation entity_relations = 8; + */ + private $entity_relations; + /** + * Placeholder. A list of text corrections made to + * [Document.text][google.cloud.documentai.v1.Document.text]. This is usually + * used for annotating corrections to OCR mistakes. Text changes for a given + * revision may not overlap with each other. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14; + */ + private $text_changes; + /** + * Information about the sharding if this document is sharded part of a larger + * document. If the document is not sharded, this message is not specified. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.ShardInfo shard_info = 9; + */ + protected $shard_info = null; + /** + * Any error that occurred while processing this document. + * + * Generated from protobuf field .google.rpc.Status error = 10; + */ + protected $error = null; + /** + * Placeholder. Revision history of this document. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Revision revisions = 13; + */ + private $revisions; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Optional. Currently supports Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. + * For more information, refer to [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris). + * @type string $content + * Optional. Inline document content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * @type string $mime_type + * An IANA published [media type (MIME + * type)](https://www.iana.org/assignments/media-types/media-types.xhtml). + * @type string $text + * Optional. UTF-8 encoded text in reading order from the document. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Style>|\Google\Protobuf\Internal\RepeatedField $text_styles + * Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page>|\Google\Protobuf\Internal\RepeatedField $pages + * Visual page layout for the [Document][google.cloud.documentai.v1.Document]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Entity>|\Google\Protobuf\Internal\RepeatedField $entities + * A list of entities detected on + * [Document.text][google.cloud.documentai.v1.Document.text]. For document + * shards, entities in this list may cross shard boundaries. + * @type array<\Google\Cloud\DocumentAI\V1\Document\EntityRelation>|\Google\Protobuf\Internal\RepeatedField $entity_relations + * Placeholder. Relationship among + * [Document.entities][google.cloud.documentai.v1.Document.entities]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\TextChange>|\Google\Protobuf\Internal\RepeatedField $text_changes + * Placeholder. A list of text corrections made to + * [Document.text][google.cloud.documentai.v1.Document.text]. This is usually + * used for annotating corrections to OCR mistakes. Text changes for a given + * revision may not overlap with each other. + * @type \Google\Cloud\DocumentAI\V1\Document\ShardInfo $shard_info + * Information about the sharding if this document is sharded part of a larger + * document. If the document is not sharded, this message is not specified. + * @type \Google\Rpc\Status $error + * Any error that occurred while processing this document. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Revision>|\Google\Protobuf\Internal\RepeatedField $revisions + * Placeholder. Revision history of this document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Currently supports Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. + * For more information, refer to [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris). + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getUri() + { + return $this->readOneof(1); + } + + public function hasUri() + { + return $this->hasOneof(1); + } + + /** + * Optional. Currently supports Google Cloud Storage URI of the form + * `gs://bucket_name/object_name`. Object versioning is not supported. + * For more information, refer to [Google Cloud Storage Request + * URIs](https://cloud.google.com/storage/docs/reference-uris). + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Optional. Inline document content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * + * Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getContent() + { + return $this->readOneof(2); + } + + public function hasContent() + { + return $this->hasOneof(2); + } + + /** + * Optional. Inline document content, represented as a stream of bytes. + * Note: As with all `bytes` fields, protobuffers use a pure binary + * representation, whereas JSON representations use base64. + * + * Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * An IANA published [media type (MIME + * type)](https://www.iana.org/assignments/media-types/media-types.xhtml). + * + * Generated from protobuf field string mime_type = 3; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * An IANA published [media type (MIME + * type)](https://www.iana.org/assignments/media-types/media-types.xhtml). + * + * Generated from protobuf field string mime_type = 3; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Optional. UTF-8 encoded text in reading order from the document. + * + * Generated from protobuf field string text = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Optional. UTF-8 encoded text in reading order from the document. + * + * Generated from protobuf field string text = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Style text_styles = 5 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getTextStyles() + { + @trigger_error('text_styles is deprecated.', E_USER_DEPRECATED); + return $this->text_styles; + } + + /** + * Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Style text_styles = 5 [deprecated = true]; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Style>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setTextStyles($var) + { + @trigger_error('text_styles is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Style::class); + $this->text_styles = $arr; + + return $this; + } + + /** + * Visual page layout for the [Document][google.cloud.documentai.v1.Document]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page pages = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPages() + { + return $this->pages; + } + + /** + * Visual page layout for the [Document][google.cloud.documentai.v1.Document]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page pages = 6; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page::class); + $this->pages = $arr; + + return $this; + } + + /** + * A list of entities detected on + * [Document.text][google.cloud.documentai.v1.Document.text]. For document + * shards, entities in this list may cross shard boundaries. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Entity entities = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntities() + { + return $this->entities; + } + + /** + * A list of entities detected on + * [Document.text][google.cloud.documentai.v1.Document.text]. For document + * shards, entities in this list may cross shard boundaries. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Entity entities = 7; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Entity::class); + $this->entities = $arr; + + return $this; + } + + /** + * Placeholder. Relationship among + * [Document.entities][google.cloud.documentai.v1.Document.entities]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.EntityRelation entity_relations = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntityRelations() + { + return $this->entity_relations; + } + + /** + * Placeholder. Relationship among + * [Document.entities][google.cloud.documentai.v1.Document.entities]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.EntityRelation entity_relations = 8; + * @param array<\Google\Cloud\DocumentAI\V1\Document\EntityRelation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntityRelations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\EntityRelation::class); + $this->entity_relations = $arr; + + return $this; + } + + /** + * Placeholder. A list of text corrections made to + * [Document.text][google.cloud.documentai.v1.Document.text]. This is usually + * used for annotating corrections to OCR mistakes. Text changes for a given + * revision may not overlap with each other. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTextChanges() + { + return $this->text_changes; + } + + /** + * Placeholder. A list of text corrections made to + * [Document.text][google.cloud.documentai.v1.Document.text]. This is usually + * used for annotating corrections to OCR mistakes. Text changes for a given + * revision may not overlap with each other. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14; + * @param array<\Google\Cloud\DocumentAI\V1\Document\TextChange>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTextChanges($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\TextChange::class); + $this->text_changes = $arr; + + return $this; + } + + /** + * Information about the sharding if this document is sharded part of a larger + * document. If the document is not sharded, this message is not specified. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.ShardInfo shard_info = 9; + * @return \Google\Cloud\DocumentAI\V1\Document\ShardInfo|null + */ + public function getShardInfo() + { + return $this->shard_info; + } + + public function hasShardInfo() + { + return isset($this->shard_info); + } + + public function clearShardInfo() + { + unset($this->shard_info); + } + + /** + * Information about the sharding if this document is sharded part of a larger + * document. If the document is not sharded, this message is not specified. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.ShardInfo shard_info = 9; + * @param \Google\Cloud\DocumentAI\V1\Document\ShardInfo $var + * @return $this + */ + public function setShardInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\ShardInfo::class); + $this->shard_info = $var; + + return $this; + } + + /** + * Any error that occurred while processing this document. + * + * Generated from protobuf field .google.rpc.Status error = 10; + * @return \Google\Rpc\Status|null + */ + public function getError() + { + return $this->error; + } + + public function hasError() + { + return isset($this->error); + } + + public function clearError() + { + unset($this->error); + } + + /** + * Any error that occurred while processing this document. + * + * Generated from protobuf field .google.rpc.Status error = 10; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->error = $var; + + return $this; + } + + /** + * Placeholder. Revision history of this document. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Revision revisions = 13; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRevisions() + { + return $this->revisions; + } + + /** + * Placeholder. Revision history of this document. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Revision revisions = 13; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Revision>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRevisions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Revision::class); + $this->revisions = $arr; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Entity.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Entity.php new file mode 100644 index 000000000000..b8ace41a89a5 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Entity.php @@ -0,0 +1,488 @@ +google.cloud.documentai.v1.Document.Entity + */ +class Entity extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Provenance of the entity. + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $text_anchor = null; + /** + * Required. Entity type from a schema e.g. `Address`. + * + * Generated from protobuf field string type = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $type = ''; + /** + * Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`. + * + * Generated from protobuf field string mention_text = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mention_text = ''; + /** + * Optional. Deprecated. Use `id` field instead. + * + * Generated from protobuf field string mention_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $mention_id = ''; + /** + * Optional. Confidence of detected Schema entity. Range `[0, 1]`. + * + * Generated from protobuf field float confidence = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $confidence = 0.0; + /** + * Optional. Represents the provenance of this entity wrt. the location on + * the page where it was found. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.PageAnchor page_anchor = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_anchor = null; + /** + * Optional. Canonical id. This will be a unique value in the entity list + * for this document. + * + * Generated from protobuf field string id = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $id = ''; + /** + * Optional. Normalized entity value. Absent if the extracted value could + * not be converted or the type (e.g. address) is not supported for certain + * parsers. This field is also only populated for certain supported document + * types. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Entity.NormalizedValue normalized_value = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $normalized_value = null; + /** + * Optional. Entities can be nested to form a hierarchical data structure + * representing the content in the document. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Entity properties = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $properties; + /** + * Optional. The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 11 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $provenance = null; + /** + * Optional. Whether the entity will be redacted for de-identification + * purposes. + * + * Generated from protobuf field bool redacted = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $redacted = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\TextAnchor $text_anchor + * Optional. Provenance of the entity. + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * @type string $type + * Required. Entity type from a schema e.g. `Address`. + * @type string $mention_text + * Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`. + * @type string $mention_id + * Optional. Deprecated. Use `id` field instead. + * @type float $confidence + * Optional. Confidence of detected Schema entity. Range `[0, 1]`. + * @type \Google\Cloud\DocumentAI\V1\Document\PageAnchor $page_anchor + * Optional. Represents the provenance of this entity wrt. the location on + * the page where it was found. + * @type string $id + * Optional. Canonical id. This will be a unique value in the entity list + * for this document. + * @type \Google\Cloud\DocumentAI\V1\Document\Entity\NormalizedValue $normalized_value + * Optional. Normalized entity value. Absent if the extracted value could + * not be converted or the type (e.g. address) is not supported for certain + * parsers. This field is also only populated for certain supported document + * types. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Entity>|\Google\Protobuf\Internal\RepeatedField $properties + * Optional. Entities can be nested to form a hierarchical data structure + * representing the content in the document. + * @type \Google\Cloud\DocumentAI\V1\Document\Provenance $provenance + * Optional. The history of this annotation. + * @type bool $redacted + * Optional. Whether the entity will be redacted for de-identification + * purposes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Provenance of the entity. + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\DocumentAI\V1\Document\TextAnchor|null + */ + public function getTextAnchor() + { + return $this->text_anchor; + } + + public function hasTextAnchor() + { + return isset($this->text_anchor); + } + + public function clearTextAnchor() + { + unset($this->text_anchor); + } + + /** + * Optional. Provenance of the entity. + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\DocumentAI\V1\Document\TextAnchor $var + * @return $this + */ + public function setTextAnchor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\TextAnchor::class); + $this->text_anchor = $var; + + return $this; + } + + /** + * Required. Entity type from a schema e.g. `Address`. + * + * Generated from protobuf field string type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Required. Entity type from a schema e.g. `Address`. + * + * Generated from protobuf field string type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`. + * + * Generated from protobuf field string mention_text = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMentionText() + { + return $this->mention_text; + } + + /** + * Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`. + * + * Generated from protobuf field string mention_text = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMentionText($var) + { + GPBUtil::checkString($var, True); + $this->mention_text = $var; + + return $this; + } + + /** + * Optional. Deprecated. Use `id` field instead. + * + * Generated from protobuf field string mention_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMentionId() + { + return $this->mention_id; + } + + /** + * Optional. Deprecated. Use `id` field instead. + * + * Generated from protobuf field string mention_id = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMentionId($var) + { + GPBUtil::checkString($var, True); + $this->mention_id = $var; + + return $this; + } + + /** + * Optional. Confidence of detected Schema entity. Range `[0, 1]`. + * + * Generated from protobuf field float confidence = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Optional. Confidence of detected Schema entity. Range `[0, 1]`. + * + * Generated from protobuf field float confidence = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * Optional. Represents the provenance of this entity wrt. the location on + * the page where it was found. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.PageAnchor page_anchor = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\DocumentAI\V1\Document\PageAnchor|null + */ + public function getPageAnchor() + { + return $this->page_anchor; + } + + public function hasPageAnchor() + { + return isset($this->page_anchor); + } + + public function clearPageAnchor() + { + unset($this->page_anchor); + } + + /** + * Optional. Represents the provenance of this entity wrt. the location on + * the page where it was found. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.PageAnchor page_anchor = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\DocumentAI\V1\Document\PageAnchor $var + * @return $this + */ + public function setPageAnchor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\PageAnchor::class); + $this->page_anchor = $var; + + return $this; + } + + /** + * Optional. Canonical id. This will be a unique value in the entity list + * for this document. + * + * Generated from protobuf field string id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Optional. Canonical id. This will be a unique value in the entity list + * for this document. + * + * Generated from protobuf field string id = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Optional. Normalized entity value. Absent if the extracted value could + * not be converted or the type (e.g. address) is not supported for certain + * parsers. This field is also only populated for certain supported document + * types. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Entity.NormalizedValue normalized_value = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\DocumentAI\V1\Document\Entity\NormalizedValue|null + */ + public function getNormalizedValue() + { + return $this->normalized_value; + } + + public function hasNormalizedValue() + { + return isset($this->normalized_value); + } + + public function clearNormalizedValue() + { + unset($this->normalized_value); + } + + /** + * Optional. Normalized entity value. Absent if the extracted value could + * not be converted or the type (e.g. address) is not supported for certain + * parsers. This field is also only populated for certain supported document + * types. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Entity.NormalizedValue normalized_value = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\DocumentAI\V1\Document\Entity\NormalizedValue $var + * @return $this + */ + public function setNormalizedValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Entity\NormalizedValue::class); + $this->normalized_value = $var; + + return $this; + } + + /** + * Optional. Entities can be nested to form a hierarchical data structure + * representing the content in the document. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Entity properties = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Optional. Entities can be nested to form a hierarchical data structure + * representing the content in the document. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Entity properties = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProperties($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Entity::class); + $this->properties = $arr; + + return $this; + } + + /** + * Optional. The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\DocumentAI\V1\Document\Provenance|null + */ + public function getProvenance() + { + return $this->provenance; + } + + public function hasProvenance() + { + return isset($this->provenance); + } + + public function clearProvenance() + { + unset($this->provenance); + } + + /** + * Optional. The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 11 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\DocumentAI\V1\Document\Provenance $var + * @return $this + */ + public function setProvenance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Provenance::class); + $this->provenance = $var; + + return $this; + } + + /** + * Optional. Whether the entity will be redacted for de-identification + * purposes. + * + * Generated from protobuf field bool redacted = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getRedacted() + { + return $this->redacted; + } + + /** + * Optional. Whether the entity will be redacted for de-identification + * purposes. + * + * Generated from protobuf field bool redacted = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setRedacted($var) + { + GPBUtil::checkBool($var); + $this->redacted = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Entity::class, \Google\Cloud\DocumentAI\V1\Document_Entity::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Entity/NormalizedValue.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Entity/NormalizedValue.php new file mode 100644 index 000000000000..d6f086a4508c --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Entity/NormalizedValue.php @@ -0,0 +1,357 @@ +google.cloud.documentai.v1.Document.Entity.NormalizedValue + */ +class NormalizedValue extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. An optional field to store a normalized string. + * For some entity types, one of respective `structured_value` fields may + * also be populated. Also not all the types of `structured_value` will be + * normalized. For example, some processors may not generate `float` + * or `integer` normalized text by default. + * Below are sample formats mapped to structured values. + * - Money/Currency type (`money_value`) is in the ISO 4217 text format. + * - Date type (`date_value`) is in the ISO 8601 text format. + * - Datetime type (`datetime_value`) is in the ISO 8601 text format. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $text = ''; + protected $structured_value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Type\Money $money_value + * Money value. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/money.proto + * @type \Google\Type\Date $date_value + * Date value. Includes year, month, day. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/date.proto + * @type \Google\Type\DateTime $datetime_value + * DateTime value. Includes date, time, and timezone. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto + * @type \Google\Type\PostalAddress $address_value + * Postal address. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto + * @type bool $boolean_value + * Boolean value. Can be used for entities with binary values, or for + * checkboxes. + * @type int $integer_value + * Integer value. + * @type float $float_value + * Float value. + * @type string $text + * Optional. An optional field to store a normalized string. + * For some entity types, one of respective `structured_value` fields may + * also be populated. Also not all the types of `structured_value` will be + * normalized. For example, some processors may not generate `float` + * or `integer` normalized text by default. + * Below are sample formats mapped to structured values. + * - Money/Currency type (`money_value`) is in the ISO 4217 text format. + * - Date type (`date_value`) is in the ISO 8601 text format. + * - Datetime type (`datetime_value`) is in the ISO 8601 text format. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Money value. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/money.proto + * + * Generated from protobuf field .google.type.Money money_value = 2; + * @return \Google\Type\Money|null + */ + public function getMoneyValue() + { + return $this->readOneof(2); + } + + public function hasMoneyValue() + { + return $this->hasOneof(2); + } + + /** + * Money value. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/money.proto + * + * Generated from protobuf field .google.type.Money money_value = 2; + * @param \Google\Type\Money $var + * @return $this + */ + public function setMoneyValue($var) + { + GPBUtil::checkMessage($var, \Google\Type\Money::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Date value. Includes year, month, day. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/date.proto + * + * Generated from protobuf field .google.type.Date date_value = 3; + * @return \Google\Type\Date|null + */ + public function getDateValue() + { + return $this->readOneof(3); + } + + public function hasDateValue() + { + return $this->hasOneof(3); + } + + /** + * Date value. Includes year, month, day. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/date.proto + * + * Generated from protobuf field .google.type.Date date_value = 3; + * @param \Google\Type\Date $var + * @return $this + */ + public function setDateValue($var) + { + GPBUtil::checkMessage($var, \Google\Type\Date::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * DateTime value. Includes date, time, and timezone. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto + * + * Generated from protobuf field .google.type.DateTime datetime_value = 4; + * @return \Google\Type\DateTime|null + */ + public function getDatetimeValue() + { + return $this->readOneof(4); + } + + public function hasDatetimeValue() + { + return $this->hasOneof(4); + } + + /** + * DateTime value. Includes date, time, and timezone. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto + * + * Generated from protobuf field .google.type.DateTime datetime_value = 4; + * @param \Google\Type\DateTime $var + * @return $this + */ + public function setDatetimeValue($var) + { + GPBUtil::checkMessage($var, \Google\Type\DateTime::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Postal address. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto + * + * Generated from protobuf field .google.type.PostalAddress address_value = 5; + * @return \Google\Type\PostalAddress|null + */ + public function getAddressValue() + { + return $this->readOneof(5); + } + + public function hasAddressValue() + { + return $this->hasOneof(5); + } + + /** + * Postal address. See also: + * https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto + * + * Generated from protobuf field .google.type.PostalAddress address_value = 5; + * @param \Google\Type\PostalAddress $var + * @return $this + */ + public function setAddressValue($var) + { + GPBUtil::checkMessage($var, \Google\Type\PostalAddress::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Boolean value. Can be used for entities with binary values, or for + * checkboxes. + * + * Generated from protobuf field bool boolean_value = 6; + * @return bool + */ + public function getBooleanValue() + { + return $this->readOneof(6); + } + + public function hasBooleanValue() + { + return $this->hasOneof(6); + } + + /** + * Boolean value. Can be used for entities with binary values, or for + * checkboxes. + * + * Generated from protobuf field bool boolean_value = 6; + * @param bool $var + * @return $this + */ + public function setBooleanValue($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Integer value. + * + * Generated from protobuf field int32 integer_value = 7; + * @return int + */ + public function getIntegerValue() + { + return $this->readOneof(7); + } + + public function hasIntegerValue() + { + return $this->hasOneof(7); + } + + /** + * Integer value. + * + * Generated from protobuf field int32 integer_value = 7; + * @param int $var + * @return $this + */ + public function setIntegerValue($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Float value. + * + * Generated from protobuf field float float_value = 8; + * @return float + */ + public function getFloatValue() + { + return $this->readOneof(8); + } + + public function hasFloatValue() + { + return $this->hasOneof(8); + } + + /** + * Float value. + * + * Generated from protobuf field float float_value = 8; + * @param float $var + * @return $this + */ + public function setFloatValue($var) + { + GPBUtil::checkFloat($var); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Optional. An optional field to store a normalized string. + * For some entity types, one of respective `structured_value` fields may + * also be populated. Also not all the types of `structured_value` will be + * normalized. For example, some processors may not generate `float` + * or `integer` normalized text by default. + * Below are sample formats mapped to structured values. + * - Money/Currency type (`money_value`) is in the ISO 4217 text format. + * - Date type (`date_value`) is in the ISO 8601 text format. + * - Datetime type (`datetime_value`) is in the ISO 8601 text format. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Optional. An optional field to store a normalized string. + * For some entity types, one of respective `structured_value` fields may + * also be populated. Also not all the types of `structured_value` will be + * normalized. For example, some processors may not generate `float` + * or `integer` normalized text by default. + * Below are sample formats mapped to structured values. + * - Money/Currency type (`money_value`) is in the ISO 4217 text format. + * - Date type (`date_value`) is in the ISO 8601 text format. + * - Datetime type (`datetime_value`) is in the ISO 8601 text format. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * @return string + */ + public function getStructuredValue() + { + return $this->whichOneof("structured_value"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NormalizedValue::class, \Google\Cloud\DocumentAI\V1\Document_Entity_NormalizedValue::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/EntityRelation.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/EntityRelation.php new file mode 100644 index 000000000000..ba0880d70ebd --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/EntityRelation.php @@ -0,0 +1,139 @@ +google.cloud.documentai.v1.Document.EntityRelation + */ +class EntityRelation extends \Google\Protobuf\Internal\Message +{ + /** + * Subject entity id. + * + * Generated from protobuf field string subject_id = 1; + */ + protected $subject_id = ''; + /** + * Object entity id. + * + * Generated from protobuf field string object_id = 2; + */ + protected $object_id = ''; + /** + * Relationship description. + * + * Generated from protobuf field string relation = 3; + */ + protected $relation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $subject_id + * Subject entity id. + * @type string $object_id + * Object entity id. + * @type string $relation + * Relationship description. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Subject entity id. + * + * Generated from protobuf field string subject_id = 1; + * @return string + */ + public function getSubjectId() + { + return $this->subject_id; + } + + /** + * Subject entity id. + * + * Generated from protobuf field string subject_id = 1; + * @param string $var + * @return $this + */ + public function setSubjectId($var) + { + GPBUtil::checkString($var, True); + $this->subject_id = $var; + + return $this; + } + + /** + * Object entity id. + * + * Generated from protobuf field string object_id = 2; + * @return string + */ + public function getObjectId() + { + return $this->object_id; + } + + /** + * Object entity id. + * + * Generated from protobuf field string object_id = 2; + * @param string $var + * @return $this + */ + public function setObjectId($var) + { + GPBUtil::checkString($var, True); + $this->object_id = $var; + + return $this; + } + + /** + * Relationship description. + * + * Generated from protobuf field string relation = 3; + * @return string + */ + public function getRelation() + { + return $this->relation; + } + + /** + * Relationship description. + * + * Generated from protobuf field string relation = 3; + * @param string $var + * @return $this + */ + public function setRelation($var) + { + GPBUtil::checkString($var, True); + $this->relation = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EntityRelation::class, \Google\Cloud\DocumentAI\V1\Document_EntityRelation::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page.php new file mode 100644 index 000000000000..34e47ccab957 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page.php @@ -0,0 +1,719 @@ +google.cloud.documentai.v1.Document.Page + */ +class Page extends \Google\Protobuf\Internal\Message +{ + /** + * 1-based index for current + * [Page][google.cloud.documentai.v1.Document.Page] in a parent + * [Document][google.cloud.documentai.v1.Document]. Useful when a page is + * taken out of a [Document][google.cloud.documentai.v1.Document] for + * individual processing. + * + * Generated from protobuf field int32 page_number = 1; + */ + protected $page_number = 0; + /** + * Rendered image for this page. This image is preprocessed to remove any + * skew, rotation, and distortions such that the annotation bounding boxes + * can be upright and axis-aligned. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Image image = 13; + */ + protected $image = null; + /** + * Transformation matrices that were applied to the original document image + * to produce [Page.image][google.cloud.documentai.v1.Document.Page.image]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Matrix transforms = 14; + */ + private $transforms; + /** + * Physical dimension of the page. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Dimension dimension = 2; + */ + protected $dimension = null; + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 3; + */ + protected $layout = null; + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 4; + */ + private $detected_languages; + /** + * A list of visually detected text blocks on the page. + * A block has a set of lines (collected into paragraphs) that have a common + * line-spacing and orientation. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Block blocks = 5; + */ + private $blocks; + /** + * A list of visually detected text paragraphs on the page. + * A collection of lines that a human would perceive as a paragraph. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Paragraph paragraphs = 6; + */ + private $paragraphs; + /** + * A list of visually detected text lines on the page. + * A collection of tokens that a human would perceive as a line. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Line lines = 7; + */ + private $lines; + /** + * A list of visually detected tokens on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Token tokens = 8; + */ + private $tokens; + /** + * A list of detected non-text visual elements e.g. checkbox, + * signature etc. on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.VisualElement visual_elements = 9; + */ + private $visual_elements; + /** + * A list of visually detected tables on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table tables = 10; + */ + private $tables; + /** + * A list of visually detected form fields on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.FormField form_fields = 11; + */ + private $form_fields; + /** + * A list of visually detected symbols on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Symbol symbols = 12; + */ + private $symbols; + /** + * A list of detected barcodes. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedBarcode detected_barcodes = 15; + */ + private $detected_barcodes; + /** + * Image quality scores. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.ImageQualityScores image_quality_scores = 17; + */ + protected $image_quality_scores = null; + /** + * The history of this page. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 16 [deprecated = true]; + * @deprecated + */ + protected $provenance = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $page_number + * 1-based index for current + * [Page][google.cloud.documentai.v1.Document.Page] in a parent + * [Document][google.cloud.documentai.v1.Document]. Useful when a page is + * taken out of a [Document][google.cloud.documentai.v1.Document] for + * individual processing. + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Image $image + * Rendered image for this page. This image is preprocessed to remove any + * skew, rotation, and distortions such that the annotation bounding boxes + * can be upright and axis-aligned. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Matrix>|\Google\Protobuf\Internal\RepeatedField $transforms + * Transformation matrices that were applied to the original document image + * to produce [Page.image][google.cloud.documentai.v1.Document.Page.image]. + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Dimension $dimension + * Physical dimension of the page. + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Block>|\Google\Protobuf\Internal\RepeatedField $blocks + * A list of visually detected text blocks on the page. + * A block has a set of lines (collected into paragraphs) that have a common + * line-spacing and orientation. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Paragraph>|\Google\Protobuf\Internal\RepeatedField $paragraphs + * A list of visually detected text paragraphs on the page. + * A collection of lines that a human would perceive as a paragraph. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Line>|\Google\Protobuf\Internal\RepeatedField $lines + * A list of visually detected text lines on the page. + * A collection of tokens that a human would perceive as a line. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Token>|\Google\Protobuf\Internal\RepeatedField $tokens + * A list of visually detected tokens on the page. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\VisualElement>|\Google\Protobuf\Internal\RepeatedField $visual_elements + * A list of detected non-text visual elements e.g. checkbox, + * signature etc. on the page. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Table>|\Google\Protobuf\Internal\RepeatedField $tables + * A list of visually detected tables on the page. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\FormField>|\Google\Protobuf\Internal\RepeatedField $form_fields + * A list of visually detected form fields on the page. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Symbol>|\Google\Protobuf\Internal\RepeatedField $symbols + * A list of visually detected symbols on the page. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedBarcode>|\Google\Protobuf\Internal\RepeatedField $detected_barcodes + * A list of detected barcodes. + * @type \Google\Cloud\DocumentAI\V1\Document\Page\ImageQualityScores $image_quality_scores + * Image quality scores. + * @type \Google\Cloud\DocumentAI\V1\Document\Provenance $provenance + * The history of this page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * 1-based index for current + * [Page][google.cloud.documentai.v1.Document.Page] in a parent + * [Document][google.cloud.documentai.v1.Document]. Useful when a page is + * taken out of a [Document][google.cloud.documentai.v1.Document] for + * individual processing. + * + * Generated from protobuf field int32 page_number = 1; + * @return int + */ + public function getPageNumber() + { + return $this->page_number; + } + + /** + * 1-based index for current + * [Page][google.cloud.documentai.v1.Document.Page] in a parent + * [Document][google.cloud.documentai.v1.Document]. Useful when a page is + * taken out of a [Document][google.cloud.documentai.v1.Document] for + * individual processing. + * + * Generated from protobuf field int32 page_number = 1; + * @param int $var + * @return $this + */ + public function setPageNumber($var) + { + GPBUtil::checkInt32($var); + $this->page_number = $var; + + return $this; + } + + /** + * Rendered image for this page. This image is preprocessed to remove any + * skew, rotation, and distortions such that the annotation bounding boxes + * can be upright and axis-aligned. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Image image = 13; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Image|null + */ + public function getImage() + { + return $this->image; + } + + public function hasImage() + { + return isset($this->image); + } + + public function clearImage() + { + unset($this->image); + } + + /** + * Rendered image for this page. This image is preprocessed to remove any + * skew, rotation, and distortions such that the annotation bounding boxes + * can be upright and axis-aligned. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Image image = 13; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Image $var + * @return $this + */ + public function setImage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Image::class); + $this->image = $var; + + return $this; + } + + /** + * Transformation matrices that were applied to the original document image + * to produce [Page.image][google.cloud.documentai.v1.Document.Page.image]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Matrix transforms = 14; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransforms() + { + return $this->transforms; + } + + /** + * Transformation matrices that were applied to the original document image + * to produce [Page.image][google.cloud.documentai.v1.Document.Page.image]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Matrix transforms = 14; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Matrix>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransforms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Matrix::class); + $this->transforms = $arr; + + return $this; + } + + /** + * Physical dimension of the page. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Dimension dimension = 2; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Dimension|null + */ + public function getDimension() + { + return $this->dimension; + } + + public function hasDimension() + { + return isset($this->dimension); + } + + public function clearDimension() + { + unset($this->dimension); + } + + /** + * Physical dimension of the page. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Dimension dimension = 2; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Dimension $var + * @return $this + */ + public function setDimension($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Dimension::class); + $this->dimension = $var; + + return $this; + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 3; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 3; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 4; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + + /** + * A list of visually detected text blocks on the page. + * A block has a set of lines (collected into paragraphs) that have a common + * line-spacing and orientation. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Block blocks = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBlocks() + { + return $this->blocks; + } + + /** + * A list of visually detected text blocks on the page. + * A block has a set of lines (collected into paragraphs) that have a common + * line-spacing and orientation. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Block blocks = 5; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Block>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBlocks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Block::class); + $this->blocks = $arr; + + return $this; + } + + /** + * A list of visually detected text paragraphs on the page. + * A collection of lines that a human would perceive as a paragraph. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Paragraph paragraphs = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParagraphs() + { + return $this->paragraphs; + } + + /** + * A list of visually detected text paragraphs on the page. + * A collection of lines that a human would perceive as a paragraph. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Paragraph paragraphs = 6; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Paragraph>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParagraphs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Paragraph::class); + $this->paragraphs = $arr; + + return $this; + } + + /** + * A list of visually detected text lines on the page. + * A collection of tokens that a human would perceive as a line. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Line lines = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLines() + { + return $this->lines; + } + + /** + * A list of visually detected text lines on the page. + * A collection of tokens that a human would perceive as a line. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Line lines = 7; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Line>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLines($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Line::class); + $this->lines = $arr; + + return $this; + } + + /** + * A list of visually detected tokens on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Token tokens = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTokens() + { + return $this->tokens; + } + + /** + * A list of visually detected tokens on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Token tokens = 8; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Token>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTokens($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Token::class); + $this->tokens = $arr; + + return $this; + } + + /** + * A list of detected non-text visual elements e.g. checkbox, + * signature etc. on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.VisualElement visual_elements = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVisualElements() + { + return $this->visual_elements; + } + + /** + * A list of detected non-text visual elements e.g. checkbox, + * signature etc. on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.VisualElement visual_elements = 9; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\VisualElement>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVisualElements($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\VisualElement::class); + $this->visual_elements = $arr; + + return $this; + } + + /** + * A list of visually detected tables on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table tables = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTables() + { + return $this->tables; + } + + /** + * A list of visually detected tables on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table tables = 10; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Table>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTables($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Table::class); + $this->tables = $arr; + + return $this; + } + + /** + * A list of visually detected form fields on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.FormField form_fields = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFormFields() + { + return $this->form_fields; + } + + /** + * A list of visually detected form fields on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.FormField form_fields = 11; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\FormField>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFormFields($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\FormField::class); + $this->form_fields = $arr; + + return $this; + } + + /** + * A list of visually detected symbols on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Symbol symbols = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSymbols() + { + return $this->symbols; + } + + /** + * A list of visually detected symbols on the page. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Symbol symbols = 12; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Symbol>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSymbols($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Symbol::class); + $this->symbols = $arr; + + return $this; + } + + /** + * A list of detected barcodes. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedBarcode detected_barcodes = 15; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedBarcodes() + { + return $this->detected_barcodes; + } + + /** + * A list of detected barcodes. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedBarcode detected_barcodes = 15; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedBarcode>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedBarcodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedBarcode::class); + $this->detected_barcodes = $arr; + + return $this; + } + + /** + * Image quality scores. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.ImageQualityScores image_quality_scores = 17; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\ImageQualityScores|null + */ + public function getImageQualityScores() + { + return $this->image_quality_scores; + } + + public function hasImageQualityScores() + { + return isset($this->image_quality_scores); + } + + public function clearImageQualityScores() + { + unset($this->image_quality_scores); + } + + /** + * Image quality scores. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.ImageQualityScores image_quality_scores = 17; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\ImageQualityScores $var + * @return $this + */ + public function setImageQualityScores($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\ImageQualityScores::class); + $this->image_quality_scores = $var; + + return $this; + } + + /** + * The history of this page. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 16 [deprecated = true]; + * @return \Google\Cloud\DocumentAI\V1\Document\Provenance|null + * @deprecated + */ + public function getProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return $this->provenance; + } + + public function hasProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return isset($this->provenance); + } + + public function clearProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + unset($this->provenance); + } + + /** + * The history of this page. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 16 [deprecated = true]; + * @param \Google\Cloud\DocumentAI\V1\Document\Provenance $var + * @return $this + * @deprecated + */ + public function setProvenance($var) + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Provenance::class); + $this->provenance = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Page::class, \Google\Cloud\DocumentAI\V1\Document_Page::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Block.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Block.php new file mode 100644 index 000000000000..e6b0f8115556 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Block.php @@ -0,0 +1,170 @@ +google.cloud.documentai.v1.Document.Page.Block + */ +class Block extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Block][google.cloud.documentai.v1.Document.Page.Block]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + */ + protected $layout = null; + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + */ + private $detected_languages; + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @deprecated + */ + protected $provenance = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Block][google.cloud.documentai.v1.Document.Page.Block]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * @type \Google\Cloud\DocumentAI\V1\Document\Provenance $provenance + * The history of this annotation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Block][google.cloud.documentai.v1.Document.Page.Block]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Block][google.cloud.documentai.v1.Document.Page.Block]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @return \Google\Cloud\DocumentAI\V1\Document\Provenance|null + * @deprecated + */ + public function getProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return $this->provenance; + } + + public function hasProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return isset($this->provenance); + } + + public function clearProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + unset($this->provenance); + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @param \Google\Cloud\DocumentAI\V1\Document\Provenance $var + * @return $this + * @deprecated + */ + public function setProvenance($var) + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Provenance::class); + $this->provenance = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Block::class, \Google\Cloud\DocumentAI\V1\Document_Page_Block::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/DetectedBarcode.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/DetectedBarcode.php new file mode 100644 index 000000000000..813cac1753e1 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/DetectedBarcode.php @@ -0,0 +1,132 @@ +google.cloud.documentai.v1.Document.Page.DetectedBarcode + */ +class DetectedBarcode extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + */ + protected $layout = null; + /** + * Detailed barcode information of the + * [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Barcode barcode = 2; + */ + protected $barcode = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + * @type \Google\Cloud\DocumentAI\V1\Barcode $barcode + * Detailed barcode information of the + * [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * Detailed barcode information of the + * [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Barcode barcode = 2; + * @return \Google\Cloud\DocumentAI\V1\Barcode|null + */ + public function getBarcode() + { + return $this->barcode; + } + + public function hasBarcode() + { + return isset($this->barcode); + } + + public function clearBarcode() + { + unset($this->barcode); + } + + /** + * Detailed barcode information of the + * [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Barcode barcode = 2; + * @param \Google\Cloud\DocumentAI\V1\Barcode $var + * @return $this + */ + public function setBarcode($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Barcode::class); + $this->barcode = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DetectedBarcode::class, \Google\Cloud\DocumentAI\V1\Document_Page_DetectedBarcode::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/DetectedLanguage.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/DetectedLanguage.php new file mode 100644 index 000000000000..047bb47a331f --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/DetectedLanguage.php @@ -0,0 +1,112 @@ +google.cloud.documentai.v1.Document.Page.DetectedLanguage + */ +class DetectedLanguage extends \Google\Protobuf\Internal\Message +{ + /** + * The [BCP-47 language + * code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier), + * such as `en-US` or `sr-Latn`. + * + * Generated from protobuf field string language_code = 1; + */ + protected $language_code = ''; + /** + * Confidence of detected language. Range `[0, 1]`. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $language_code + * The [BCP-47 language + * code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier), + * such as `en-US` or `sr-Latn`. + * @type float $confidence + * Confidence of detected language. Range `[0, 1]`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * The [BCP-47 language + * code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier), + * such as `en-US` or `sr-Latn`. + * + * Generated from protobuf field string language_code = 1; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The [BCP-47 language + * code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier), + * such as `en-US` or `sr-Latn`. + * + * Generated from protobuf field string language_code = 1; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * Confidence of detected language. Range `[0, 1]`. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of detected language. Range `[0, 1]`. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DetectedLanguage::class, \Google\Cloud\DocumentAI\V1\Document_Page_DetectedLanguage::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Dimension.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Dimension.php new file mode 100644 index 000000000000..94fa7020c1c5 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Dimension.php @@ -0,0 +1,138 @@ +google.cloud.documentai.v1.Document.Page.Dimension + */ +class Dimension extends \Google\Protobuf\Internal\Message +{ + /** + * Page width. + * + * Generated from protobuf field float width = 1; + */ + protected $width = 0.0; + /** + * Page height. + * + * Generated from protobuf field float height = 2; + */ + protected $height = 0.0; + /** + * Dimension unit. + * + * Generated from protobuf field string unit = 3; + */ + protected $unit = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $width + * Page width. + * @type float $height + * Page height. + * @type string $unit + * Dimension unit. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Page width. + * + * Generated from protobuf field float width = 1; + * @return float + */ + public function getWidth() + { + return $this->width; + } + + /** + * Page width. + * + * Generated from protobuf field float width = 1; + * @param float $var + * @return $this + */ + public function setWidth($var) + { + GPBUtil::checkFloat($var); + $this->width = $var; + + return $this; + } + + /** + * Page height. + * + * Generated from protobuf field float height = 2; + * @return float + */ + public function getHeight() + { + return $this->height; + } + + /** + * Page height. + * + * Generated from protobuf field float height = 2; + * @param float $var + * @return $this + */ + public function setHeight($var) + { + GPBUtil::checkFloat($var); + $this->height = $var; + + return $this; + } + + /** + * Dimension unit. + * + * Generated from protobuf field string unit = 3; + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * Dimension unit. + * + * Generated from protobuf field string unit = 3; + * @param string $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkString($var, True); + $this->unit = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Dimension::class, \Google\Cloud\DocumentAI\V1\Document_Page_Dimension::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/FormField.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/FormField.php new file mode 100644 index 000000000000..8eba8df34300 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/FormField.php @@ -0,0 +1,382 @@ +google.cloud.documentai.v1.Document.Page.FormField + */ +class FormField extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + * [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. + * e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout field_name = 1; + */ + protected $field_name = null; + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + * [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout field_value = 2; + */ + protected $field_value = null; + /** + * A list of detected languages for name together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage name_detected_languages = 3; + */ + private $name_detected_languages; + /** + * A list of detected languages for value together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage value_detected_languages = 4; + */ + private $value_detected_languages; + /** + * If the value is non-textual, this field represents the type. Current + * valid values are: + * - blank (this indicates the `field_value` is normal text) + * - `unfilled_checkbox` + * - `filled_checkbox` + * + * Generated from protobuf field string value_type = 5; + */ + protected $value_type = ''; + /** + * Created for Labeling UI to export key text. + * If corrections were made to the text identified by the + * `field_name.text_anchor`, this field will contain the correction. + * + * Generated from protobuf field string corrected_key_text = 6; + */ + protected $corrected_key_text = ''; + /** + * Created for Labeling UI to export value text. + * If corrections were made to the text identified by the + * `field_value.text_anchor`, this field will contain the correction. + * + * Generated from protobuf field string corrected_value_text = 7; + */ + protected $corrected_value_text = ''; + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 8; + */ + protected $provenance = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $field_name + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + * [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. + * e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $field_value + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + * [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $name_detected_languages + * A list of detected languages for name together with confidence. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $value_detected_languages + * A list of detected languages for value together with confidence. + * @type string $value_type + * If the value is non-textual, this field represents the type. Current + * valid values are: + * - blank (this indicates the `field_value` is normal text) + * - `unfilled_checkbox` + * - `filled_checkbox` + * @type string $corrected_key_text + * Created for Labeling UI to export key text. + * If corrections were made to the text identified by the + * `field_name.text_anchor`, this field will contain the correction. + * @type string $corrected_value_text + * Created for Labeling UI to export value text. + * If corrections were made to the text identified by the + * `field_value.text_anchor`, this field will contain the correction. + * @type \Google\Cloud\DocumentAI\V1\Document\Provenance $provenance + * The history of this annotation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + * [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. + * e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout field_name = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getFieldName() + { + return $this->field_name; + } + + public function hasFieldName() + { + return isset($this->field_name); + } + + public function clearFieldName() + { + unset($this->field_name); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + * [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. + * e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout field_name = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setFieldName($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->field_name = $var; + + return $this; + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + * [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout field_value = 2; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getFieldValue() + { + return $this->field_value; + } + + public function hasFieldValue() + { + return isset($this->field_value); + } + + public function clearFieldValue() + { + unset($this->field_value); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the + * [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout field_value = 2; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setFieldValue($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->field_value = $var; + + return $this; + } + + /** + * A list of detected languages for name together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage name_detected_languages = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNameDetectedLanguages() + { + return $this->name_detected_languages; + } + + /** + * A list of detected languages for name together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage name_detected_languages = 3; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNameDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->name_detected_languages = $arr; + + return $this; + } + + /** + * A list of detected languages for value together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage value_detected_languages = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValueDetectedLanguages() + { + return $this->value_detected_languages; + } + + /** + * A list of detected languages for value together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage value_detected_languages = 4; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValueDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->value_detected_languages = $arr; + + return $this; + } + + /** + * If the value is non-textual, this field represents the type. Current + * valid values are: + * - blank (this indicates the `field_value` is normal text) + * - `unfilled_checkbox` + * - `filled_checkbox` + * + * Generated from protobuf field string value_type = 5; + * @return string + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * If the value is non-textual, this field represents the type. Current + * valid values are: + * - blank (this indicates the `field_value` is normal text) + * - `unfilled_checkbox` + * - `filled_checkbox` + * + * Generated from protobuf field string value_type = 5; + * @param string $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkString($var, True); + $this->value_type = $var; + + return $this; + } + + /** + * Created for Labeling UI to export key text. + * If corrections were made to the text identified by the + * `field_name.text_anchor`, this field will contain the correction. + * + * Generated from protobuf field string corrected_key_text = 6; + * @return string + */ + public function getCorrectedKeyText() + { + return $this->corrected_key_text; + } + + /** + * Created for Labeling UI to export key text. + * If corrections were made to the text identified by the + * `field_name.text_anchor`, this field will contain the correction. + * + * Generated from protobuf field string corrected_key_text = 6; + * @param string $var + * @return $this + */ + public function setCorrectedKeyText($var) + { + GPBUtil::checkString($var, True); + $this->corrected_key_text = $var; + + return $this; + } + + /** + * Created for Labeling UI to export value text. + * If corrections were made to the text identified by the + * `field_value.text_anchor`, this field will contain the correction. + * + * Generated from protobuf field string corrected_value_text = 7; + * @return string + */ + public function getCorrectedValueText() + { + return $this->corrected_value_text; + } + + /** + * Created for Labeling UI to export value text. + * If corrections were made to the text identified by the + * `field_value.text_anchor`, this field will contain the correction. + * + * Generated from protobuf field string corrected_value_text = 7; + * @param string $var + * @return $this + */ + public function setCorrectedValueText($var) + { + GPBUtil::checkString($var, True); + $this->corrected_value_text = $var; + + return $this; + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 8; + * @return \Google\Cloud\DocumentAI\V1\Document\Provenance|null + */ + public function getProvenance() + { + return $this->provenance; + } + + public function hasProvenance() + { + return isset($this->provenance); + } + + public function clearProvenance() + { + unset($this->provenance); + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 8; + * @param \Google\Cloud\DocumentAI\V1\Document\Provenance $var + * @return $this + */ + public function setProvenance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Provenance::class); + $this->provenance = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FormField::class, \Google\Cloud\DocumentAI\V1\Document_Page_FormField::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Image.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Image.php new file mode 100644 index 000000000000..d148308f1446 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Image.php @@ -0,0 +1,180 @@ +google.cloud.documentai.v1.Document.Page.Image + */ +class Image extends \Google\Protobuf\Internal\Message +{ + /** + * Raw byte content of the image. + * + * Generated from protobuf field bytes content = 1; + */ + protected $content = ''; + /** + * Encoding [media type (MIME + * type)](https://www.iana.org/assignments/media-types/media-types.xhtml) + * for the image. + * + * Generated from protobuf field string mime_type = 2; + */ + protected $mime_type = ''; + /** + * Width of the image in pixels. + * + * Generated from protobuf field int32 width = 3; + */ + protected $width = 0; + /** + * Height of the image in pixels. + * + * Generated from protobuf field int32 height = 4; + */ + protected $height = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * Raw byte content of the image. + * @type string $mime_type + * Encoding [media type (MIME + * type)](https://www.iana.org/assignments/media-types/media-types.xhtml) + * for the image. + * @type int $width + * Width of the image in pixels. + * @type int $height + * Height of the image in pixels. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Raw byte content of the image. + * + * Generated from protobuf field bytes content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Raw byte content of the image. + * + * Generated from protobuf field bytes content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->content = $var; + + return $this; + } + + /** + * Encoding [media type (MIME + * type)](https://www.iana.org/assignments/media-types/media-types.xhtml) + * for the image. + * + * Generated from protobuf field string mime_type = 2; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * Encoding [media type (MIME + * type)](https://www.iana.org/assignments/media-types/media-types.xhtml) + * for the image. + * + * Generated from protobuf field string mime_type = 2; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * Width of the image in pixels. + * + * Generated from protobuf field int32 width = 3; + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * Width of the image in pixels. + * + * Generated from protobuf field int32 width = 3; + * @param int $var + * @return $this + */ + public function setWidth($var) + { + GPBUtil::checkInt32($var); + $this->width = $var; + + return $this; + } + + /** + * Height of the image in pixels. + * + * Generated from protobuf field int32 height = 4; + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * Height of the image in pixels. + * + * Generated from protobuf field int32 height = 4; + * @param int $var + * @return $this + */ + public function setHeight($var) + { + GPBUtil::checkInt32($var); + $this->height = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Image::class, \Google\Cloud\DocumentAI\V1\Document_Page_Image::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/ImageQualityScores.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/ImageQualityScores.php new file mode 100644 index 000000000000..022802ccec08 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/ImageQualityScores.php @@ -0,0 +1,104 @@ +google.cloud.documentai.v1.Document.Page.ImageQualityScores + */ +class ImageQualityScores extends \Google\Protobuf\Internal\Message +{ + /** + * The overall quality score. Range `[0, 1]` where `1` is perfect quality. + * + * Generated from protobuf field float quality_score = 1; + */ + protected $quality_score = 0.0; + /** + * A list of detected defects. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect detected_defects = 2; + */ + private $detected_defects; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $quality_score + * The overall quality score. Range `[0, 1]` where `1` is perfect quality. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\ImageQualityScores\DetectedDefect>|\Google\Protobuf\Internal\RepeatedField $detected_defects + * A list of detected defects. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * The overall quality score. Range `[0, 1]` where `1` is perfect quality. + * + * Generated from protobuf field float quality_score = 1; + * @return float + */ + public function getQualityScore() + { + return $this->quality_score; + } + + /** + * The overall quality score. Range `[0, 1]` where `1` is perfect quality. + * + * Generated from protobuf field float quality_score = 1; + * @param float $var + * @return $this + */ + public function setQualityScore($var) + { + GPBUtil::checkFloat($var); + $this->quality_score = $var; + + return $this; + } + + /** + * A list of detected defects. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect detected_defects = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedDefects() + { + return $this->detected_defects; + } + + /** + * A list of detected defects. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect detected_defects = 2; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\ImageQualityScores\DetectedDefect>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedDefects($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\ImageQualityScores\DetectedDefect::class); + $this->detected_defects = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ImageQualityScores::class, \Google\Cloud\DocumentAI\V1\Document_Page_ImageQualityScores::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/ImageQualityScores/DetectedDefect.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/ImageQualityScores/DetectedDefect.php new file mode 100644 index 000000000000..349207260af6 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/ImageQualityScores/DetectedDefect.php @@ -0,0 +1,140 @@ +google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect + */ +class DetectedDefect extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the defect type. Supported values are: + * - `quality/defect_blurry` + * - `quality/defect_noisy` + * - `quality/defect_dark` + * - `quality/defect_faint` + * - `quality/defect_text_too_small` + * - `quality/defect_document_cutoff` + * - `quality/defect_text_cutoff` + * - `quality/defect_glare` + * + * Generated from protobuf field string type = 1; + */ + protected $type = ''; + /** + * Confidence of detected defect. Range `[0, 1]` where `1` indicates + * strong confidence that the defect exists. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $type + * Name of the defect type. Supported values are: + * - `quality/defect_blurry` + * - `quality/defect_noisy` + * - `quality/defect_dark` + * - `quality/defect_faint` + * - `quality/defect_text_too_small` + * - `quality/defect_document_cutoff` + * - `quality/defect_text_cutoff` + * - `quality/defect_glare` + * @type float $confidence + * Confidence of detected defect. Range `[0, 1]` where `1` indicates + * strong confidence that the defect exists. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Name of the defect type. Supported values are: + * - `quality/defect_blurry` + * - `quality/defect_noisy` + * - `quality/defect_dark` + * - `quality/defect_faint` + * - `quality/defect_text_too_small` + * - `quality/defect_document_cutoff` + * - `quality/defect_text_cutoff` + * - `quality/defect_glare` + * + * Generated from protobuf field string type = 1; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Name of the defect type. Supported values are: + * - `quality/defect_blurry` + * - `quality/defect_noisy` + * - `quality/defect_dark` + * - `quality/defect_faint` + * - `quality/defect_text_too_small` + * - `quality/defect_document_cutoff` + * - `quality/defect_text_cutoff` + * - `quality/defect_glare` + * + * Generated from protobuf field string type = 1; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * Confidence of detected defect. Range `[0, 1]` where `1` indicates + * strong confidence that the defect exists. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of detected defect. Range `[0, 1]` where `1` indicates + * strong confidence that the defect exists. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DetectedDefect::class, \Google\Cloud\DocumentAI\V1\Document_Page_ImageQualityScores_DetectedDefect::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Layout.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Layout.php new file mode 100644 index 000000000000..88a05d40216e --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Layout.php @@ -0,0 +1,220 @@ +google.cloud.documentai.v1.Document.Page.Layout + */ +class Layout extends \Google\Protobuf\Internal\Message +{ + /** + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1; + */ + protected $text_anchor = null; + /** + * Confidence of the current + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] within + * context of the object this layout is for. e.g. confidence can be for a + * single token, a table, a visual element, etc. depending on context. + * Range `[0, 1]`. + * + * Generated from protobuf field float confidence = 2; + */ + protected $confidence = 0.0; + /** + * The bounding polygon for the + * [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + * + * Generated from protobuf field .google.cloud.documentai.v1.BoundingPoly bounding_poly = 3; + */ + protected $bounding_poly = null; + /** + * Detected orientation for the + * [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout.Orientation orientation = 4; + */ + protected $orientation = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\TextAnchor $text_anchor + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * @type float $confidence + * Confidence of the current + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] within + * context of the object this layout is for. e.g. confidence can be for a + * single token, a table, a visual element, etc. depending on context. + * Range `[0, 1]`. + * @type \Google\Cloud\DocumentAI\V1\BoundingPoly $bounding_poly + * The bounding polygon for the + * [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + * @type int $orientation + * Detected orientation for the + * [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\TextAnchor|null + */ + public function getTextAnchor() + { + return $this->text_anchor; + } + + public function hasTextAnchor() + { + return isset($this->text_anchor); + } + + public function clearTextAnchor() + { + unset($this->text_anchor); + } + + /** + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\TextAnchor $var + * @return $this + */ + public function setTextAnchor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\TextAnchor::class); + $this->text_anchor = $var; + + return $this; + } + + /** + * Confidence of the current + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] within + * context of the object this layout is for. e.g. confidence can be for a + * single token, a table, a visual element, etc. depending on context. + * Range `[0, 1]`. + * + * Generated from protobuf field float confidence = 2; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Confidence of the current + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] within + * context of the object this layout is for. e.g. confidence can be for a + * single token, a table, a visual element, etc. depending on context. + * Range `[0, 1]`. + * + * Generated from protobuf field float confidence = 2; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + + /** + * The bounding polygon for the + * [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + * + * Generated from protobuf field .google.cloud.documentai.v1.BoundingPoly bounding_poly = 3; + * @return \Google\Cloud\DocumentAI\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * The bounding polygon for the + * [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + * + * Generated from protobuf field .google.cloud.documentai.v1.BoundingPoly bounding_poly = 3; + * @param \Google\Cloud\DocumentAI\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * Detected orientation for the + * [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout.Orientation orientation = 4; + * @return int + */ + public function getOrientation() + { + return $this->orientation; + } + + /** + * Detected orientation for the + * [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout.Orientation orientation = 4; + * @param int $var + * @return $this + */ + public function setOrientation($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout\Orientation::class); + $this->orientation = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Layout::class, \Google\Cloud\DocumentAI\V1\Document_Page_Layout::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Layout/Orientation.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Layout/Orientation.php new file mode 100644 index 000000000000..ecbb474f5b17 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Layout/Orientation.php @@ -0,0 +1,81 @@ +google.cloud.documentai.v1.Document.Page.Layout.Orientation + */ +class Orientation +{ + /** + * Unspecified orientation. + * + * Generated from protobuf enum ORIENTATION_UNSPECIFIED = 0; + */ + const ORIENTATION_UNSPECIFIED = 0; + /** + * Orientation is aligned with page up. + * + * Generated from protobuf enum PAGE_UP = 1; + */ + const PAGE_UP = 1; + /** + * Orientation is aligned with page right. + * Turn the head 90 degrees clockwise from upright to read. + * + * Generated from protobuf enum PAGE_RIGHT = 2; + */ + const PAGE_RIGHT = 2; + /** + * Orientation is aligned with page down. + * Turn the head 180 degrees from upright to read. + * + * Generated from protobuf enum PAGE_DOWN = 3; + */ + const PAGE_DOWN = 3; + /** + * Orientation is aligned with page left. + * Turn the head 90 degrees counterclockwise from upright to read. + * + * Generated from protobuf enum PAGE_LEFT = 4; + */ + const PAGE_LEFT = 4; + + private static $valueToName = [ + self::ORIENTATION_UNSPECIFIED => 'ORIENTATION_UNSPECIFIED', + self::PAGE_UP => 'PAGE_UP', + self::PAGE_RIGHT => 'PAGE_RIGHT', + self::PAGE_DOWN => 'PAGE_DOWN', + self::PAGE_LEFT => 'PAGE_LEFT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Orientation::class, \Google\Cloud\DocumentAI\V1\Document_Page_Layout_Orientation::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Line.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Line.php new file mode 100644 index 000000000000..6a1b91fa2c24 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Line.php @@ -0,0 +1,170 @@ +google.cloud.documentai.v1.Document.Page.Line + */ +class Line extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Line][google.cloud.documentai.v1.Document.Page.Line]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + */ + protected $layout = null; + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + */ + private $detected_languages; + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @deprecated + */ + protected $provenance = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Line][google.cloud.documentai.v1.Document.Page.Line]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * @type \Google\Cloud\DocumentAI\V1\Document\Provenance $provenance + * The history of this annotation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Line][google.cloud.documentai.v1.Document.Page.Line]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Line][google.cloud.documentai.v1.Document.Page.Line]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @return \Google\Cloud\DocumentAI\V1\Document\Provenance|null + * @deprecated + */ + public function getProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return $this->provenance; + } + + public function hasProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return isset($this->provenance); + } + + public function clearProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + unset($this->provenance); + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @param \Google\Cloud\DocumentAI\V1\Document\Provenance $var + * @return $this + * @deprecated + */ + public function setProvenance($var) + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Provenance::class); + $this->provenance = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Line::class, \Google\Cloud\DocumentAI\V1\Document_Page_Line::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Matrix.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Matrix.php new file mode 100644 index 000000000000..5bdd20b17c61 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Matrix.php @@ -0,0 +1,185 @@ +google.cloud.documentai.v1.Document.Page.Matrix + */ +class Matrix extends \Google\Protobuf\Internal\Message +{ + /** + * Number of rows in the matrix. + * + * Generated from protobuf field int32 rows = 1; + */ + protected $rows = 0; + /** + * Number of columns in the matrix. + * + * Generated from protobuf field int32 cols = 2; + */ + protected $cols = 0; + /** + * This encodes information about what data type the matrix uses. + * For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list + * of OpenCV primitive data types, please refer to + * https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html + * + * Generated from protobuf field int32 type = 3; + */ + protected $type = 0; + /** + * The matrix data. + * + * Generated from protobuf field bytes data = 4; + */ + protected $data = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $rows + * Number of rows in the matrix. + * @type int $cols + * Number of columns in the matrix. + * @type int $type + * This encodes information about what data type the matrix uses. + * For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list + * of OpenCV primitive data types, please refer to + * https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html + * @type string $data + * The matrix data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Number of rows in the matrix. + * + * Generated from protobuf field int32 rows = 1; + * @return int + */ + public function getRows() + { + return $this->rows; + } + + /** + * Number of rows in the matrix. + * + * Generated from protobuf field int32 rows = 1; + * @param int $var + * @return $this + */ + public function setRows($var) + { + GPBUtil::checkInt32($var); + $this->rows = $var; + + return $this; + } + + /** + * Number of columns in the matrix. + * + * Generated from protobuf field int32 cols = 2; + * @return int + */ + public function getCols() + { + return $this->cols; + } + + /** + * Number of columns in the matrix. + * + * Generated from protobuf field int32 cols = 2; + * @param int $var + * @return $this + */ + public function setCols($var) + { + GPBUtil::checkInt32($var); + $this->cols = $var; + + return $this; + } + + /** + * This encodes information about what data type the matrix uses. + * For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list + * of OpenCV primitive data types, please refer to + * https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html + * + * Generated from protobuf field int32 type = 3; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * This encodes information about what data type the matrix uses. + * For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list + * of OpenCV primitive data types, please refer to + * https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html + * + * Generated from protobuf field int32 type = 3; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkInt32($var); + $this->type = $var; + + return $this; + } + + /** + * The matrix data. + * + * Generated from protobuf field bytes data = 4; + * @return string + */ + public function getData() + { + return $this->data; + } + + /** + * The matrix data. + * + * Generated from protobuf field bytes data = 4; + * @param string $var + * @return $this + */ + public function setData($var) + { + GPBUtil::checkString($var, False); + $this->data = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Matrix::class, \Google\Cloud\DocumentAI\V1\Document_Page_Matrix::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Paragraph.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Paragraph.php new file mode 100644 index 000000000000..ecf311660ec6 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Paragraph.php @@ -0,0 +1,169 @@ +google.cloud.documentai.v1.Document.Page.Paragraph + */ +class Paragraph extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + */ + protected $layout = null; + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + */ + private $detected_languages; + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @deprecated + */ + protected $provenance = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * @type \Google\Cloud\DocumentAI\V1\Document\Provenance $provenance + * The history of this annotation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @return \Google\Cloud\DocumentAI\V1\Document\Provenance|null + * @deprecated + */ + public function getProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return $this->provenance; + } + + public function hasProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return isset($this->provenance); + } + + public function clearProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + unset($this->provenance); + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @param \Google\Cloud\DocumentAI\V1\Document\Provenance $var + * @return $this + * @deprecated + */ + public function setProvenance($var) + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Provenance::class); + $this->provenance = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Paragraph::class, \Google\Cloud\DocumentAI\V1\Document_Page_Paragraph::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Symbol.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Symbol.php new file mode 100644 index 000000000000..823bdb5b507a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Symbol.php @@ -0,0 +1,118 @@ +google.cloud.documentai.v1.Document.Page.Symbol + */ +class Symbol extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + */ + protected $layout = null; + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + */ + private $detected_languages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 2; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Symbol::class, \Google\Cloud\DocumentAI\V1\Document_Page_Symbol::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Table.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Table.php new file mode 100644 index 000000000000..f92869f57296 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Table.php @@ -0,0 +1,237 @@ +google.cloud.documentai.v1.Document.Page.Table + */ +class Table extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Table][google.cloud.documentai.v1.Document.Page.Table]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + */ + protected $layout = null; + /** + * Header rows of the table. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table.TableRow header_rows = 2; + */ + private $header_rows; + /** + * Body rows of the table. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table.TableRow body_rows = 3; + */ + private $body_rows; + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 4; + */ + private $detected_languages; + /** + * The history of this table. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 5 [deprecated = true]; + * @deprecated + */ + protected $provenance = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Table][google.cloud.documentai.v1.Document.Page.Table]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Table\TableRow>|\Google\Protobuf\Internal\RepeatedField $header_rows + * Header rows of the table. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Table\TableRow>|\Google\Protobuf\Internal\RepeatedField $body_rows + * Body rows of the table. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * @type \Google\Cloud\DocumentAI\V1\Document\Provenance $provenance + * The history of this table. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Table][google.cloud.documentai.v1.Document.Page.Table]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Table][google.cloud.documentai.v1.Document.Page.Table]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * Header rows of the table. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table.TableRow header_rows = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHeaderRows() + { + return $this->header_rows; + } + + /** + * Header rows of the table. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table.TableRow header_rows = 2; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Table\TableRow>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHeaderRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Table\TableRow::class); + $this->header_rows = $arr; + + return $this; + } + + /** + * Body rows of the table. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table.TableRow body_rows = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBodyRows() + { + return $this->body_rows; + } + + /** + * Body rows of the table. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table.TableRow body_rows = 3; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Table\TableRow>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBodyRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Table\TableRow::class); + $this->body_rows = $arr; + + return $this; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 4; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + + /** + * The history of this table. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 5 [deprecated = true]; + * @return \Google\Cloud\DocumentAI\V1\Document\Provenance|null + * @deprecated + */ + public function getProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return $this->provenance; + } + + public function hasProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return isset($this->provenance); + } + + public function clearProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + unset($this->provenance); + } + + /** + * The history of this table. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 5 [deprecated = true]; + * @param \Google\Cloud\DocumentAI\V1\Document\Provenance $var + * @return $this + * @deprecated + */ + public function setProvenance($var) + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Provenance::class); + $this->provenance = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Table::class, \Google\Cloud\DocumentAI\V1\Document_Page_Table::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Table/TableCell.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Table/TableCell.php new file mode 100644 index 000000000000..083ff6c4e28a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Table/TableCell.php @@ -0,0 +1,186 @@ +google.cloud.documentai.v1.Document.Page.Table.TableCell + */ +class TableCell extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + */ + protected $layout = null; + /** + * How many rows this cell spans. + * + * Generated from protobuf field int32 row_span = 2; + */ + protected $row_span = 0; + /** + * How many columns this cell spans. + * + * Generated from protobuf field int32 col_span = 3; + */ + protected $col_span = 0; + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 4; + */ + private $detected_languages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. + * @type int $row_span + * How many rows this cell spans. + * @type int $col_span + * How many columns this cell spans. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * How many rows this cell spans. + * + * Generated from protobuf field int32 row_span = 2; + * @return int + */ + public function getRowSpan() + { + return $this->row_span; + } + + /** + * How many rows this cell spans. + * + * Generated from protobuf field int32 row_span = 2; + * @param int $var + * @return $this + */ + public function setRowSpan($var) + { + GPBUtil::checkInt32($var); + $this->row_span = $var; + + return $this; + } + + /** + * How many columns this cell spans. + * + * Generated from protobuf field int32 col_span = 3; + * @return int + */ + public function getColSpan() + { + return $this->col_span; + } + + /** + * How many columns this cell spans. + * + * Generated from protobuf field int32 col_span = 3; + * @param int $var + * @return $this + */ + public function setColSpan($var) + { + GPBUtil::checkInt32($var); + $this->col_span = $var; + + return $this; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 4; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TableCell::class, \Google\Cloud\DocumentAI\V1\Document_Page_Table_TableCell::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Table/TableRow.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Table/TableRow.php new file mode 100644 index 000000000000..c3c865e0ea5a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Table/TableRow.php @@ -0,0 +1,70 @@ +google.cloud.documentai.v1.Document.Page.Table.TableRow + */ +class TableRow extends \Google\Protobuf\Internal\Message +{ + /** + * Cells that make up this row. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table.TableCell cells = 1; + */ + private $cells; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\Table\TableCell>|\Google\Protobuf\Internal\RepeatedField $cells + * Cells that make up this row. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Cells that make up this row. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table.TableCell cells = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCells() + { + return $this->cells; + } + + /** + * Cells that make up this row. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.Table.TableCell cells = 1; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\Table\TableCell>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCells($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\Table\TableCell::class); + $this->cells = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TableRow::class, \Google\Cloud\DocumentAI\V1\Document_Page_Table_TableRow::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token.php new file mode 100644 index 000000000000..a373a99b3ab6 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token.php @@ -0,0 +1,261 @@ +google.cloud.documentai.v1.Document.Page.Token + */ +class Token extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Token][google.cloud.documentai.v1.Document.Page.Token]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + */ + protected $layout = null; + /** + * Detected break at the end of a + * [Token][google.cloud.documentai.v1.Document.Page.Token]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Token.DetectedBreak detected_break = 2; + */ + protected $detected_break = null; + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 3; + */ + private $detected_languages; + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 4 [deprecated = true]; + * @deprecated + */ + protected $provenance = null; + /** + * Text style attributes. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Token.StyleInfo style_info = 5; + */ + protected $style_info = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Token][google.cloud.documentai.v1.Document.Page.Token]. + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Token\DetectedBreak $detected_break + * Detected break at the end of a + * [Token][google.cloud.documentai.v1.Document.Page.Token]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * @type \Google\Cloud\DocumentAI\V1\Document\Provenance $provenance + * The history of this annotation. + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Token\StyleInfo $style_info + * Text style attributes. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Token][google.cloud.documentai.v1.Document.Page.Token]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [Token][google.cloud.documentai.v1.Document.Page.Token]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * Detected break at the end of a + * [Token][google.cloud.documentai.v1.Document.Page.Token]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Token.DetectedBreak detected_break = 2; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Token\DetectedBreak|null + */ + public function getDetectedBreak() + { + return $this->detected_break; + } + + public function hasDetectedBreak() + { + return isset($this->detected_break); + } + + public function clearDetectedBreak() + { + unset($this->detected_break); + } + + /** + * Detected break at the end of a + * [Token][google.cloud.documentai.v1.Document.Page.Token]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Token.DetectedBreak detected_break = 2; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Token\DetectedBreak $var + * @return $this + */ + public function setDetectedBreak($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Token\DetectedBreak::class); + $this->detected_break = $var; + + return $this; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 3; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 4 [deprecated = true]; + * @return \Google\Cloud\DocumentAI\V1\Document\Provenance|null + * @deprecated + */ + public function getProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return $this->provenance; + } + + public function hasProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return isset($this->provenance); + } + + public function clearProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + unset($this->provenance); + } + + /** + * The history of this annotation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance provenance = 4 [deprecated = true]; + * @param \Google\Cloud\DocumentAI\V1\Document\Provenance $var + * @return $this + * @deprecated + */ + public function setProvenance($var) + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Provenance::class); + $this->provenance = $var; + + return $this; + } + + /** + * Text style attributes. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Token.StyleInfo style_info = 5; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Token\StyleInfo|null + */ + public function getStyleInfo() + { + return $this->style_info; + } + + public function hasStyleInfo() + { + return isset($this->style_info); + } + + public function clearStyleInfo() + { + unset($this->style_info); + } + + /** + * Text style attributes. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Token.StyleInfo style_info = 5; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Token\StyleInfo $var + * @return $this + */ + public function setStyleInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Token\StyleInfo::class); + $this->style_info = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Token::class, \Google\Cloud\DocumentAI\V1\Document_Page_Token::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token/DetectedBreak.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token/DetectedBreak.php new file mode 100644 index 000000000000..d5fe06afd4f5 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token/DetectedBreak.php @@ -0,0 +1,71 @@ +google.cloud.documentai.v1.Document.Page.Token.DetectedBreak + */ +class DetectedBreak extends \Google\Protobuf\Internal\Message +{ + /** + * Detected break type. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type type = 1; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Detected break type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Detected break type. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Detected break type. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\Document\Page\Token\DetectedBreak\Type::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DetectedBreak::class, \Google\Cloud\DocumentAI\V1\Document_Page_Token_DetectedBreak::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token/DetectedBreak/Type.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token/DetectedBreak/Type.php new file mode 100644 index 000000000000..79c8990b17fc --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token/DetectedBreak/Type.php @@ -0,0 +1,71 @@ +google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type + */ +class Type +{ + /** + * Unspecified break type. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * A single whitespace. + * + * Generated from protobuf enum SPACE = 1; + */ + const SPACE = 1; + /** + * A wider whitespace. + * + * Generated from protobuf enum WIDE_SPACE = 2; + */ + const WIDE_SPACE = 2; + /** + * A hyphen that indicates that a token has been split across lines. + * + * Generated from protobuf enum HYPHEN = 3; + */ + const HYPHEN = 3; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::SPACE => 'SPACE', + self::WIDE_SPACE => 'WIDE_SPACE', + self::HYPHEN => 'HYPHEN', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Cloud\DocumentAI\V1\Document_Page_Token_DetectedBreak_Type::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token/StyleInfo.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token/StyleInfo.php new file mode 100644 index 000000000000..07671d50c147 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/Token/StyleInfo.php @@ -0,0 +1,586 @@ +google.cloud.documentai.v1.Document.Page.Token.StyleInfo + */ +class StyleInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Font size in points (`1` point is `¹⁄₇₂` inches). + * + * Generated from protobuf field int32 font_size = 1; + */ + protected $font_size = 0; + /** + * Font size in pixels, equal to _unrounded + * [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_ + * * _resolution_ ÷ `72.0`. + * + * Generated from protobuf field double pixel_font_size = 2; + */ + protected $pixel_font_size = 0.0; + /** + * Letter spacing in points. + * + * Generated from protobuf field double letter_spacing = 3; + */ + protected $letter_spacing = 0.0; + /** + * Name or style of the font. + * + * Generated from protobuf field string font_type = 4; + */ + protected $font_type = ''; + /** + * Whether the text is bold (equivalent to + * [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight] + * is at least `700`). + * + * Generated from protobuf field bool bold = 5; + */ + protected $bold = false; + /** + * Whether the text is italic. + * + * Generated from protobuf field bool italic = 6; + */ + protected $italic = false; + /** + * Whether the text is underlined. + * + * Generated from protobuf field bool underlined = 7; + */ + protected $underlined = false; + /** + * Whether the text is strikethrough. + * + * Generated from protobuf field bool strikeout = 8; + */ + protected $strikeout = false; + /** + * Whether the text is a subscript. + * + * Generated from protobuf field bool subscript = 9; + */ + protected $subscript = false; + /** + * Whether the text is a superscript. + * + * Generated from protobuf field bool superscript = 10; + */ + protected $superscript = false; + /** + * Whether the text is in small caps. + * + * Generated from protobuf field bool smallcaps = 11; + */ + protected $smallcaps = false; + /** + * TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy). + * Normal is `400`, bold is `700`. + * + * Generated from protobuf field int32 font_weight = 12; + */ + protected $font_weight = 0; + /** + * Whether the text is handwritten. + * + * Generated from protobuf field bool handwritten = 13; + */ + protected $handwritten = false; + /** + * Color of the text. + * + * Generated from protobuf field .google.type.Color text_color = 14; + */ + protected $text_color = null; + /** + * Color of the background. + * + * Generated from protobuf field .google.type.Color background_color = 15; + */ + protected $background_color = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $font_size + * Font size in points (`1` point is `¹⁄₇₂` inches). + * @type float $pixel_font_size + * Font size in pixels, equal to _unrounded + * [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_ + * * _resolution_ ÷ `72.0`. + * @type float $letter_spacing + * Letter spacing in points. + * @type string $font_type + * Name or style of the font. + * @type bool $bold + * Whether the text is bold (equivalent to + * [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight] + * is at least `700`). + * @type bool $italic + * Whether the text is italic. + * @type bool $underlined + * Whether the text is underlined. + * @type bool $strikeout + * Whether the text is strikethrough. + * @type bool $subscript + * Whether the text is a subscript. + * @type bool $superscript + * Whether the text is a superscript. + * @type bool $smallcaps + * Whether the text is in small caps. + * @type int $font_weight + * TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy). + * Normal is `400`, bold is `700`. + * @type bool $handwritten + * Whether the text is handwritten. + * @type \Google\Type\Color $text_color + * Color of the text. + * @type \Google\Type\Color $background_color + * Color of the background. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Font size in points (`1` point is `¹⁄₇₂` inches). + * + * Generated from protobuf field int32 font_size = 1; + * @return int + */ + public function getFontSize() + { + return $this->font_size; + } + + /** + * Font size in points (`1` point is `¹⁄₇₂` inches). + * + * Generated from protobuf field int32 font_size = 1; + * @param int $var + * @return $this + */ + public function setFontSize($var) + { + GPBUtil::checkInt32($var); + $this->font_size = $var; + + return $this; + } + + /** + * Font size in pixels, equal to _unrounded + * [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_ + * * _resolution_ ÷ `72.0`. + * + * Generated from protobuf field double pixel_font_size = 2; + * @return float + */ + public function getPixelFontSize() + { + return $this->pixel_font_size; + } + + /** + * Font size in pixels, equal to _unrounded + * [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_ + * * _resolution_ ÷ `72.0`. + * + * Generated from protobuf field double pixel_font_size = 2; + * @param float $var + * @return $this + */ + public function setPixelFontSize($var) + { + GPBUtil::checkDouble($var); + $this->pixel_font_size = $var; + + return $this; + } + + /** + * Letter spacing in points. + * + * Generated from protobuf field double letter_spacing = 3; + * @return float + */ + public function getLetterSpacing() + { + return $this->letter_spacing; + } + + /** + * Letter spacing in points. + * + * Generated from protobuf field double letter_spacing = 3; + * @param float $var + * @return $this + */ + public function setLetterSpacing($var) + { + GPBUtil::checkDouble($var); + $this->letter_spacing = $var; + + return $this; + } + + /** + * Name or style of the font. + * + * Generated from protobuf field string font_type = 4; + * @return string + */ + public function getFontType() + { + return $this->font_type; + } + + /** + * Name or style of the font. + * + * Generated from protobuf field string font_type = 4; + * @param string $var + * @return $this + */ + public function setFontType($var) + { + GPBUtil::checkString($var, True); + $this->font_type = $var; + + return $this; + } + + /** + * Whether the text is bold (equivalent to + * [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight] + * is at least `700`). + * + * Generated from protobuf field bool bold = 5; + * @return bool + */ + public function getBold() + { + return $this->bold; + } + + /** + * Whether the text is bold (equivalent to + * [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight] + * is at least `700`). + * + * Generated from protobuf field bool bold = 5; + * @param bool $var + * @return $this + */ + public function setBold($var) + { + GPBUtil::checkBool($var); + $this->bold = $var; + + return $this; + } + + /** + * Whether the text is italic. + * + * Generated from protobuf field bool italic = 6; + * @return bool + */ + public function getItalic() + { + return $this->italic; + } + + /** + * Whether the text is italic. + * + * Generated from protobuf field bool italic = 6; + * @param bool $var + * @return $this + */ + public function setItalic($var) + { + GPBUtil::checkBool($var); + $this->italic = $var; + + return $this; + } + + /** + * Whether the text is underlined. + * + * Generated from protobuf field bool underlined = 7; + * @return bool + */ + public function getUnderlined() + { + return $this->underlined; + } + + /** + * Whether the text is underlined. + * + * Generated from protobuf field bool underlined = 7; + * @param bool $var + * @return $this + */ + public function setUnderlined($var) + { + GPBUtil::checkBool($var); + $this->underlined = $var; + + return $this; + } + + /** + * Whether the text is strikethrough. + * + * Generated from protobuf field bool strikeout = 8; + * @return bool + */ + public function getStrikeout() + { + return $this->strikeout; + } + + /** + * Whether the text is strikethrough. + * + * Generated from protobuf field bool strikeout = 8; + * @param bool $var + * @return $this + */ + public function setStrikeout($var) + { + GPBUtil::checkBool($var); + $this->strikeout = $var; + + return $this; + } + + /** + * Whether the text is a subscript. + * + * Generated from protobuf field bool subscript = 9; + * @return bool + */ + public function getSubscript() + { + return $this->subscript; + } + + /** + * Whether the text is a subscript. + * + * Generated from protobuf field bool subscript = 9; + * @param bool $var + * @return $this + */ + public function setSubscript($var) + { + GPBUtil::checkBool($var); + $this->subscript = $var; + + return $this; + } + + /** + * Whether the text is a superscript. + * + * Generated from protobuf field bool superscript = 10; + * @return bool + */ + public function getSuperscript() + { + return $this->superscript; + } + + /** + * Whether the text is a superscript. + * + * Generated from protobuf field bool superscript = 10; + * @param bool $var + * @return $this + */ + public function setSuperscript($var) + { + GPBUtil::checkBool($var); + $this->superscript = $var; + + return $this; + } + + /** + * Whether the text is in small caps. + * + * Generated from protobuf field bool smallcaps = 11; + * @return bool + */ + public function getSmallcaps() + { + return $this->smallcaps; + } + + /** + * Whether the text is in small caps. + * + * Generated from protobuf field bool smallcaps = 11; + * @param bool $var + * @return $this + */ + public function setSmallcaps($var) + { + GPBUtil::checkBool($var); + $this->smallcaps = $var; + + return $this; + } + + /** + * TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy). + * Normal is `400`, bold is `700`. + * + * Generated from protobuf field int32 font_weight = 12; + * @return int + */ + public function getFontWeight() + { + return $this->font_weight; + } + + /** + * TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy). + * Normal is `400`, bold is `700`. + * + * Generated from protobuf field int32 font_weight = 12; + * @param int $var + * @return $this + */ + public function setFontWeight($var) + { + GPBUtil::checkInt32($var); + $this->font_weight = $var; + + return $this; + } + + /** + * Whether the text is handwritten. + * + * Generated from protobuf field bool handwritten = 13; + * @return bool + */ + public function getHandwritten() + { + return $this->handwritten; + } + + /** + * Whether the text is handwritten. + * + * Generated from protobuf field bool handwritten = 13; + * @param bool $var + * @return $this + */ + public function setHandwritten($var) + { + GPBUtil::checkBool($var); + $this->handwritten = $var; + + return $this; + } + + /** + * Color of the text. + * + * Generated from protobuf field .google.type.Color text_color = 14; + * @return \Google\Type\Color|null + */ + public function getTextColor() + { + return $this->text_color; + } + + public function hasTextColor() + { + return isset($this->text_color); + } + + public function clearTextColor() + { + unset($this->text_color); + } + + /** + * Color of the text. + * + * Generated from protobuf field .google.type.Color text_color = 14; + * @param \Google\Type\Color $var + * @return $this + */ + public function setTextColor($var) + { + GPBUtil::checkMessage($var, \Google\Type\Color::class); + $this->text_color = $var; + + return $this; + } + + /** + * Color of the background. + * + * Generated from protobuf field .google.type.Color background_color = 15; + * @return \Google\Type\Color|null + */ + public function getBackgroundColor() + { + return $this->background_color; + } + + public function hasBackgroundColor() + { + return isset($this->background_color); + } + + public function clearBackgroundColor() + { + unset($this->background_color); + } + + /** + * Color of the background. + * + * Generated from protobuf field .google.type.Color background_color = 15; + * @param \Google\Type\Color $var + * @return $this + */ + public function setBackgroundColor($var) + { + GPBUtil::checkMessage($var, \Google\Type\Color::class); + $this->background_color = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(StyleInfo::class, \Google\Cloud\DocumentAI\V1\Document_Page_Token_StyleInfo::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/VisualElement.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/VisualElement.php new file mode 100644 index 000000000000..ef372b3c73a9 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Page/VisualElement.php @@ -0,0 +1,157 @@ +google.cloud.documentai.v1.Document.Page.VisualElement + */ +class VisualElement extends \Google\Protobuf\Internal\Message +{ + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + */ + protected $layout = null; + /** + * Type of the + * [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + * + * Generated from protobuf field string type = 2; + */ + protected $type = ''; + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 3; + */ + private $detected_languages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Page\Layout $layout + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + * @type string $type + * Type of the + * [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $detected_languages + * A list of detected languages together with confidence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\Page\Layout|null + */ + public function getLayout() + { + return $this->layout; + } + + public function hasLayout() + { + return isset($this->layout); + } + + public function clearLayout() + { + unset($this->layout); + } + + /** + * [Layout][google.cloud.documentai.v1.Document.Page.Layout] for + * [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Page.Layout layout = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\Page\Layout $var + * @return $this + */ + public function setLayout($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Page\Layout::class); + $this->layout = $var; + + return $this; + } + + /** + * Type of the + * [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * Type of the + * [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDetectedLanguages() + { + return $this->detected_languages; + } + + /** + * A list of detected languages together with confidence. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page.DetectedLanguage detected_languages = 3; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDetectedLanguages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Page\DetectedLanguage::class); + $this->detected_languages = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(VisualElement::class, \Google\Cloud\DocumentAI\V1\Document_Page_VisualElement::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/PageAnchor.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/PageAnchor.php new file mode 100644 index 000000000000..34337ca820ce --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/PageAnchor.php @@ -0,0 +1,73 @@ +google.cloud.documentai.v1.Document.PageAnchor + */ +class PageAnchor extends \Google\Protobuf\Internal\Message +{ + /** + * One or more references to visual page elements + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.PageAnchor.PageRef page_refs = 1; + */ + private $page_refs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\Document\PageAnchor\PageRef>|\Google\Protobuf\Internal\RepeatedField $page_refs + * One or more references to visual page elements + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * One or more references to visual page elements + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.PageAnchor.PageRef page_refs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPageRefs() + { + return $this->page_refs; + } + + /** + * One or more references to visual page elements + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.PageAnchor.PageRef page_refs = 1; + * @param array<\Google\Cloud\DocumentAI\V1\Document\PageAnchor\PageRef>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPageRefs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\PageAnchor\PageRef::class); + $this->page_refs = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PageAnchor::class, \Google\Cloud\DocumentAI\V1\Document_PageAnchor::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/PageAnchor/PageRef.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/PageAnchor/PageRef.php new file mode 100644 index 000000000000..ca765e04371f --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/PageAnchor/PageRef.php @@ -0,0 +1,261 @@ +google.cloud.documentai.v1.Document.PageAnchor.PageRef + */ +class PageRef extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Index into the + * [Document.pages][google.cloud.documentai.v1.Document.pages] element, + * for example using + * `[Document.pages][page_refs.page]` to locate the related page element. + * This field is skipped when its value is the default `0`. See + * https://developers.google.com/protocol-buffers/docs/proto3#json. + * + * Generated from protobuf field int64 page = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page = 0; + /** + * Optional. The type of the layout element that is being referenced if + * any. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType layout_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $layout_type = 0; + /** + * Optional. Deprecated. Use + * [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] + * instead. + * + * Generated from protobuf field string layout_id = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @deprecated + */ + protected $layout_id = ''; + /** + * Optional. Identifies the bounding polygon of a layout element on the + * page. + * + * Generated from protobuf field .google.cloud.documentai.v1.BoundingPoly bounding_poly = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $bounding_poly = null; + /** + * Optional. Confidence of detected page element, if applicable. Range + * `[0, 1]`. + * + * Generated from protobuf field float confidence = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $page + * Required. Index into the + * [Document.pages][google.cloud.documentai.v1.Document.pages] element, + * for example using + * `[Document.pages][page_refs.page]` to locate the related page element. + * This field is skipped when its value is the default `0`. See + * https://developers.google.com/protocol-buffers/docs/proto3#json. + * @type int $layout_type + * Optional. The type of the layout element that is being referenced if + * any. + * @type string $layout_id + * Optional. Deprecated. Use + * [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] + * instead. + * @type \Google\Cloud\DocumentAI\V1\BoundingPoly $bounding_poly + * Optional. Identifies the bounding polygon of a layout element on the + * page. + * @type float $confidence + * Optional. Confidence of detected page element, if applicable. Range + * `[0, 1]`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Required. Index into the + * [Document.pages][google.cloud.documentai.v1.Document.pages] element, + * for example using + * `[Document.pages][page_refs.page]` to locate the related page element. + * This field is skipped when its value is the default `0`. See + * https://developers.google.com/protocol-buffers/docs/proto3#json. + * + * Generated from protobuf field int64 page = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int|string + */ + public function getPage() + { + return $this->page; + } + + /** + * Required. Index into the + * [Document.pages][google.cloud.documentai.v1.Document.pages] element, + * for example using + * `[Document.pages][page_refs.page]` to locate the related page element. + * This field is skipped when its value is the default `0`. See + * https://developers.google.com/protocol-buffers/docs/proto3#json. + * + * Generated from protobuf field int64 page = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int|string $var + * @return $this + */ + public function setPage($var) + { + GPBUtil::checkInt64($var); + $this->page = $var; + + return $this; + } + + /** + * Optional. The type of the layout element that is being referenced if + * any. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType layout_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getLayoutType() + { + return $this->layout_type; + } + + /** + * Optional. The type of the layout element that is being referenced if + * any. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType layout_type = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setLayoutType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\Document\PageAnchor\PageRef\LayoutType::class); + $this->layout_type = $var; + + return $this; + } + + /** + * Optional. Deprecated. Use + * [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] + * instead. + * + * Generated from protobuf field string layout_id = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @return string + * @deprecated + */ + public function getLayoutId() + { + @trigger_error('layout_id is deprecated.', E_USER_DEPRECATED); + return $this->layout_id; + } + + /** + * Optional. Deprecated. Use + * [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] + * instead. + * + * Generated from protobuf field string layout_id = 3 [deprecated = true, (.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + * @deprecated + */ + public function setLayoutId($var) + { + @trigger_error('layout_id is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkString($var, True); + $this->layout_id = $var; + + return $this; + } + + /** + * Optional. Identifies the bounding polygon of a layout element on the + * page. + * + * Generated from protobuf field .google.cloud.documentai.v1.BoundingPoly bounding_poly = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\DocumentAI\V1\BoundingPoly|null + */ + public function getBoundingPoly() + { + return $this->bounding_poly; + } + + public function hasBoundingPoly() + { + return isset($this->bounding_poly); + } + + public function clearBoundingPoly() + { + unset($this->bounding_poly); + } + + /** + * Optional. Identifies the bounding polygon of a layout element on the + * page. + * + * Generated from protobuf field .google.cloud.documentai.v1.BoundingPoly bounding_poly = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\DocumentAI\V1\BoundingPoly $var + * @return $this + */ + public function setBoundingPoly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\BoundingPoly::class); + $this->bounding_poly = $var; + + return $this; + } + + /** + * Optional. Confidence of detected page element, if applicable. Range + * `[0, 1]`. + * + * Generated from protobuf field float confidence = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * Optional. Confidence of detected page element, if applicable. Range + * `[0, 1]`. + * + * Generated from protobuf field float confidence = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PageRef::class, \Google\Cloud\DocumentAI\V1\Document_PageAnchor_PageRef::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/PageAnchor/PageRef/LayoutType.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/PageAnchor/PageRef/LayoutType.php new file mode 100644 index 000000000000..59f60718b807 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/PageAnchor/PageRef/LayoutType.php @@ -0,0 +1,112 @@ +google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType + */ +class LayoutType +{ + /** + * Layout Unspecified. + * + * Generated from protobuf enum LAYOUT_TYPE_UNSPECIFIED = 0; + */ + const LAYOUT_TYPE_UNSPECIFIED = 0; + /** + * References a + * [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks] + * element. + * + * Generated from protobuf enum BLOCK = 1; + */ + const BLOCK = 1; + /** + * References a + * [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs] + * element. + * + * Generated from protobuf enum PARAGRAPH = 2; + */ + const PARAGRAPH = 2; + /** + * References a + * [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element. + * + * Generated from protobuf enum LINE = 3; + */ + const LINE = 3; + /** + * References a + * [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens] + * element. + * + * Generated from protobuf enum TOKEN = 4; + */ + const TOKEN = 4; + /** + * References a + * [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements] + * element. + * + * Generated from protobuf enum VISUAL_ELEMENT = 5; + */ + const VISUAL_ELEMENT = 5; + /** + * Refrrences a + * [Page.tables][google.cloud.documentai.v1.Document.Page.tables] + * element. + * + * Generated from protobuf enum TABLE = 6; + */ + const TABLE = 6; + /** + * References a + * [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields] + * element. + * + * Generated from protobuf enum FORM_FIELD = 7; + */ + const FORM_FIELD = 7; + + private static $valueToName = [ + self::LAYOUT_TYPE_UNSPECIFIED => 'LAYOUT_TYPE_UNSPECIFIED', + self::BLOCK => 'BLOCK', + self::PARAGRAPH => 'PARAGRAPH', + self::LINE => 'LINE', + self::TOKEN => 'TOKEN', + self::VISUAL_ELEMENT => 'VISUAL_ELEMENT', + self::TABLE => 'TABLE', + self::FORM_FIELD => 'FORM_FIELD', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LayoutType::class, \Google\Cloud\DocumentAI\V1\Document_PageAnchor_PageRef_LayoutType::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Provenance.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Provenance.php new file mode 100644 index 000000000000..862fada0a40b --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Provenance.php @@ -0,0 +1,187 @@ +google.cloud.documentai.v1.Document.Provenance + */ +class Provenance extends \Google\Protobuf\Internal\Message +{ + /** + * The index of the revision that produced this element. + * + * Generated from protobuf field int32 revision = 1 [deprecated = true]; + * @deprecated + */ + protected $revision = 0; + /** + * The Id of this operation. Needs to be unique within the scope of the + * revision. + * + * Generated from protobuf field int32 id = 2 [deprecated = true]; + * @deprecated + */ + protected $id = 0; + /** + * References to the original elements that are replaced. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Provenance.Parent parents = 3; + */ + private $parents; + /** + * The type of provenance operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance.OperationType type = 4; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $revision + * The index of the revision that produced this element. + * @type int $id + * The Id of this operation. Needs to be unique within the scope of the + * revision. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Provenance\PBParent>|\Google\Protobuf\Internal\RepeatedField $parents + * References to the original elements that are replaced. + * @type int $type + * The type of provenance operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * The index of the revision that produced this element. + * + * Generated from protobuf field int32 revision = 1 [deprecated = true]; + * @return int + * @deprecated + */ + public function getRevision() + { + @trigger_error('revision is deprecated.', E_USER_DEPRECATED); + return $this->revision; + } + + /** + * The index of the revision that produced this element. + * + * Generated from protobuf field int32 revision = 1 [deprecated = true]; + * @param int $var + * @return $this + * @deprecated + */ + public function setRevision($var) + { + @trigger_error('revision is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkInt32($var); + $this->revision = $var; + + return $this; + } + + /** + * The Id of this operation. Needs to be unique within the scope of the + * revision. + * + * Generated from protobuf field int32 id = 2 [deprecated = true]; + * @return int + * @deprecated + */ + public function getId() + { + @trigger_error('id is deprecated.', E_USER_DEPRECATED); + return $this->id; + } + + /** + * The Id of this operation. Needs to be unique within the scope of the + * revision. + * + * Generated from protobuf field int32 id = 2 [deprecated = true]; + * @param int $var + * @return $this + * @deprecated + */ + public function setId($var) + { + @trigger_error('id is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkInt32($var); + $this->id = $var; + + return $this; + } + + /** + * References to the original elements that are replaced. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Provenance.Parent parents = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParents() + { + return $this->parents; + } + + /** + * References to the original elements that are replaced. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Provenance.Parent parents = 3; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Provenance\PBParent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Provenance\PBParent::class); + $this->parents = $arr; + + return $this; + } + + /** + * The type of provenance operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance.OperationType type = 4; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * The type of provenance operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Provenance.OperationType type = 4; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\Document\Provenance\OperationType::class); + $this->type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Provenance::class, \Google\Cloud\DocumentAI\V1\Document_Provenance::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Provenance/OperationType.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Provenance/OperationType.php new file mode 100644 index 000000000000..ff615ad82354 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Provenance/OperationType.php @@ -0,0 +1,105 @@ +google.cloud.documentai.v1.Document.Provenance.OperationType + */ +class OperationType +{ + /** + * Operation type unspecified. If no operation is specified a provenance + * entry is simply used to match against a `parent`. + * + * Generated from protobuf enum OPERATION_TYPE_UNSPECIFIED = 0; + */ + const OPERATION_TYPE_UNSPECIFIED = 0; + /** + * Add an element. + * + * Generated from protobuf enum ADD = 1; + */ + const ADD = 1; + /** + * Remove an element identified by `parent`. + * + * Generated from protobuf enum REMOVE = 2; + */ + const REMOVE = 2; + /** + * Updates any fields within the given provenance scope of the message. It + * overwrites the fields rather than replacing them. Use this when you + * want to update a field value of an entity without also updating all the + * child properties. + * + * Generated from protobuf enum UPDATE = 7; + */ + const UPDATE = 7; + /** + * Currently unused. Replace an element identified by `parent`. + * + * Generated from protobuf enum REPLACE = 3; + */ + const REPLACE = 3; + /** + * Deprecated. Request human review for the element identified by + * `parent`. + * + * Generated from protobuf enum EVAL_REQUESTED = 4 [deprecated = true]; + */ + const EVAL_REQUESTED = 4; + /** + * Deprecated. Element is reviewed and approved at human review, + * confidence will be set to 1.0. + * + * Generated from protobuf enum EVAL_APPROVED = 5 [deprecated = true]; + */ + const EVAL_APPROVED = 5; + /** + * Deprecated. Element is skipped in the validation process. + * + * Generated from protobuf enum EVAL_SKIPPED = 6 [deprecated = true]; + */ + const EVAL_SKIPPED = 6; + + private static $valueToName = [ + self::OPERATION_TYPE_UNSPECIFIED => 'OPERATION_TYPE_UNSPECIFIED', + self::ADD => 'ADD', + self::REMOVE => 'REMOVE', + self::UPDATE => 'UPDATE', + self::REPLACE => 'REPLACE', + self::EVAL_REQUESTED => 'EVAL_REQUESTED', + self::EVAL_APPROVED => 'EVAL_APPROVED', + self::EVAL_SKIPPED => 'EVAL_SKIPPED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OperationType::class, \Google\Cloud\DocumentAI\V1\Document_Provenance_OperationType::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Provenance/PBParent.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Provenance/PBParent.php new file mode 100644 index 000000000000..97dcd6f8da2f --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Provenance/PBParent.php @@ -0,0 +1,148 @@ +google.cloud.documentai.v1.Document.Provenance.Parent + */ +class PBParent extends \Google\Protobuf\Internal\Message +{ + /** + * The index of the index into current revision's parent_ids list. + * + * Generated from protobuf field int32 revision = 1; + */ + protected $revision = 0; + /** + * The index of the parent item in the corresponding item list (eg. list + * of entities, properties within entities, etc.) in the parent revision. + * + * Generated from protobuf field int32 index = 3; + */ + protected $index = 0; + /** + * The id of the parent provenance. + * + * Generated from protobuf field int32 id = 2 [deprecated = true]; + * @deprecated + */ + protected $id = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $revision + * The index of the index into current revision's parent_ids list. + * @type int $index + * The index of the parent item in the corresponding item list (eg. list + * of entities, properties within entities, etc.) in the parent revision. + * @type int $id + * The id of the parent provenance. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * The index of the index into current revision's parent_ids list. + * + * Generated from protobuf field int32 revision = 1; + * @return int + */ + public function getRevision() + { + return $this->revision; + } + + /** + * The index of the index into current revision's parent_ids list. + * + * Generated from protobuf field int32 revision = 1; + * @param int $var + * @return $this + */ + public function setRevision($var) + { + GPBUtil::checkInt32($var); + $this->revision = $var; + + return $this; + } + + /** + * The index of the parent item in the corresponding item list (eg. list + * of entities, properties within entities, etc.) in the parent revision. + * + * Generated from protobuf field int32 index = 3; + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * The index of the parent item in the corresponding item list (eg. list + * of entities, properties within entities, etc.) in the parent revision. + * + * Generated from protobuf field int32 index = 3; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->index = $var; + + return $this; + } + + /** + * The id of the parent provenance. + * + * Generated from protobuf field int32 id = 2 [deprecated = true]; + * @return int + * @deprecated + */ + public function getId() + { + @trigger_error('id is deprecated.', E_USER_DEPRECATED); + return $this->id; + } + + /** + * The id of the parent provenance. + * + * Generated from protobuf field int32 id = 2 [deprecated = true]; + * @param int $var + * @return $this + * @deprecated + */ + public function setId($var) + { + @trigger_error('id is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkInt32($var); + $this->id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PBParent::class, \Google\Cloud\DocumentAI\V1\Document_Provenance_Parent::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Revision.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Revision.php new file mode 100644 index 000000000000..ba22c0925a33 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Revision.php @@ -0,0 +1,336 @@ +google.cloud.documentai.v1.Document.Revision + */ +class Revision extends \Google\Protobuf\Internal\Message +{ + /** + * Id of the revision, internally generated by doc proto storage. + * Unique within the context of the document. + * + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * The revisions that this revision is based on. This can include one or + * more parent (when documents are merged.) This field represents the + * index into the `revisions` field. + * + * Generated from protobuf field repeated int32 parent = 2 [deprecated = true]; + * @deprecated + */ + private $parent; + /** + * The revisions that this revision is based on. Must include all the ids + * that have anything to do with this revision - eg. there are + * `provenance.parent.revision` fields that index into this field. + * + * Generated from protobuf field repeated string parent_ids = 7; + */ + private $parent_ids; + /** + * The time that the revision was created, internally generated by + * doc proto storage at the time of create. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + */ + protected $create_time = null; + /** + * Human Review information of this revision. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Revision.HumanReview human_review = 6; + */ + protected $human_review = null; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $agent + * If the change was made by a person specify the name or id of that + * person. + * @type string $processor + * If the annotation was made by processor identify the processor by its + * resource name. + * @type string $id + * Id of the revision, internally generated by doc proto storage. + * Unique within the context of the document. + * @type array|\Google\Protobuf\Internal\RepeatedField $parent + * The revisions that this revision is based on. This can include one or + * more parent (when documents are merged.) This field represents the + * index into the `revisions` field. + * @type array|\Google\Protobuf\Internal\RepeatedField $parent_ids + * The revisions that this revision is based on. Must include all the ids + * that have anything to do with this revision - eg. there are + * `provenance.parent.revision` fields that index into this field. + * @type \Google\Protobuf\Timestamp $create_time + * The time that the revision was created, internally generated by + * doc proto storage at the time of create. + * @type \Google\Cloud\DocumentAI\V1\Document\Revision\HumanReview $human_review + * Human Review information of this revision. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * If the change was made by a person specify the name or id of that + * person. + * + * Generated from protobuf field string agent = 4; + * @return string + */ + public function getAgent() + { + return $this->readOneof(4); + } + + public function hasAgent() + { + return $this->hasOneof(4); + } + + /** + * If the change was made by a person specify the name or id of that + * person. + * + * Generated from protobuf field string agent = 4; + * @param string $var + * @return $this + */ + public function setAgent($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * If the annotation was made by processor identify the processor by its + * resource name. + * + * Generated from protobuf field string processor = 5; + * @return string + */ + public function getProcessor() + { + return $this->readOneof(5); + } + + public function hasProcessor() + { + return $this->hasOneof(5); + } + + /** + * If the annotation was made by processor identify the processor by its + * resource name. + * + * Generated from protobuf field string processor = 5; + * @param string $var + * @return $this + */ + public function setProcessor($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Id of the revision, internally generated by doc proto storage. + * Unique within the context of the document. + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Id of the revision, internally generated by doc proto storage. + * Unique within the context of the document. + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The revisions that this revision is based on. This can include one or + * more parent (when documents are merged.) This field represents the + * index into the `revisions` field. + * + * Generated from protobuf field repeated int32 parent = 2 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getParent() + { + @trigger_error('parent is deprecated.', E_USER_DEPRECATED); + return $this->parent; + } + + /** + * The revisions that this revision is based on. This can include one or + * more parent (when documents are merged.) This field represents the + * index into the `revisions` field. + * + * Generated from protobuf field repeated int32 parent = 2 [deprecated = true]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setParent($var) + { + @trigger_error('parent is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->parent = $arr; + + return $this; + } + + /** + * The revisions that this revision is based on. Must include all the ids + * that have anything to do with this revision - eg. there are + * `provenance.parent.revision` fields that index into this field. + * + * Generated from protobuf field repeated string parent_ids = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParentIds() + { + return $this->parent_ids; + } + + /** + * The revisions that this revision is based on. Must include all the ids + * that have anything to do with this revision - eg. there are + * `provenance.parent.revision` fields that index into this field. + * + * Generated from protobuf field repeated string parent_ids = 7; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParentIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->parent_ids = $arr; + + return $this; + } + + /** + * The time that the revision was created, internally generated by + * doc proto storage at the time of create. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time that the revision was created, internally generated by + * doc proto storage at the time of create. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Human Review information of this revision. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Revision.HumanReview human_review = 6; + * @return \Google\Cloud\DocumentAI\V1\Document\Revision\HumanReview|null + */ + public function getHumanReview() + { + return $this->human_review; + } + + public function hasHumanReview() + { + return isset($this->human_review); + } + + public function clearHumanReview() + { + unset($this->human_review); + } + + /** + * Human Review information of this revision. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Revision.HumanReview human_review = 6; + * @param \Google\Cloud\DocumentAI\V1\Document\Revision\HumanReview $var + * @return $this + */ + public function setHumanReview($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Revision\HumanReview::class); + $this->human_review = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Revision::class, \Google\Cloud\DocumentAI\V1\Document_Revision::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Revision/HumanReview.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Revision/HumanReview.php new file mode 100644 index 000000000000..5ed97f0bafa3 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Revision/HumanReview.php @@ -0,0 +1,108 @@ +google.cloud.documentai.v1.Document.Revision.HumanReview + */ +class HumanReview extends \Google\Protobuf\Internal\Message +{ + /** + * Human review state. e.g. `requested`, `succeeded`, `rejected`. + * + * Generated from protobuf field string state = 1; + */ + protected $state = ''; + /** + * A message providing more details about the current state of processing. + * For example, the rejection reason when the state is `rejected`. + * + * Generated from protobuf field string state_message = 2; + */ + protected $state_message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $state + * Human review state. e.g. `requested`, `succeeded`, `rejected`. + * @type string $state_message + * A message providing more details about the current state of processing. + * For example, the rejection reason when the state is `rejected`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Human review state. e.g. `requested`, `succeeded`, `rejected`. + * + * Generated from protobuf field string state = 1; + * @return string + */ + public function getState() + { + return $this->state; + } + + /** + * Human review state. e.g. `requested`, `succeeded`, `rejected`. + * + * Generated from protobuf field string state = 1; + * @param string $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkString($var, True); + $this->state = $var; + + return $this; + } + + /** + * A message providing more details about the current state of processing. + * For example, the rejection reason when the state is `rejected`. + * + * Generated from protobuf field string state_message = 2; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * A message providing more details about the current state of processing. + * For example, the rejection reason when the state is `rejected`. + * + * Generated from protobuf field string state_message = 2; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(HumanReview::class, \Google\Cloud\DocumentAI\V1\Document_Revision_HumanReview::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/ShardInfo.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/ShardInfo.php new file mode 100644 index 000000000000..6d9bb1f585f0 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/ShardInfo.php @@ -0,0 +1,148 @@ +google.cloud.documentai.v1.Document.ShardInfo + */ +class ShardInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The 0-based index of this shard. + * + * Generated from protobuf field int64 shard_index = 1; + */ + protected $shard_index = 0; + /** + * Total number of shards. + * + * Generated from protobuf field int64 shard_count = 2; + */ + protected $shard_count = 0; + /** + * The index of the first character in + * [Document.text][google.cloud.documentai.v1.Document.text] in the overall + * document global text. + * + * Generated from protobuf field int64 text_offset = 3; + */ + protected $text_offset = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $shard_index + * The 0-based index of this shard. + * @type int|string $shard_count + * Total number of shards. + * @type int|string $text_offset + * The index of the first character in + * [Document.text][google.cloud.documentai.v1.Document.text] in the overall + * document global text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * The 0-based index of this shard. + * + * Generated from protobuf field int64 shard_index = 1; + * @return int|string + */ + public function getShardIndex() + { + return $this->shard_index; + } + + /** + * The 0-based index of this shard. + * + * Generated from protobuf field int64 shard_index = 1; + * @param int|string $var + * @return $this + */ + public function setShardIndex($var) + { + GPBUtil::checkInt64($var); + $this->shard_index = $var; + + return $this; + } + + /** + * Total number of shards. + * + * Generated from protobuf field int64 shard_count = 2; + * @return int|string + */ + public function getShardCount() + { + return $this->shard_count; + } + + /** + * Total number of shards. + * + * Generated from protobuf field int64 shard_count = 2; + * @param int|string $var + * @return $this + */ + public function setShardCount($var) + { + GPBUtil::checkInt64($var); + $this->shard_count = $var; + + return $this; + } + + /** + * The index of the first character in + * [Document.text][google.cloud.documentai.v1.Document.text] in the overall + * document global text. + * + * Generated from protobuf field int64 text_offset = 3; + * @return int|string + */ + public function getTextOffset() + { + return $this->text_offset; + } + + /** + * The index of the first character in + * [Document.text][google.cloud.documentai.v1.Document.text] in the overall + * document global text. + * + * Generated from protobuf field int64 text_offset = 3; + * @param int|string $var + * @return $this + */ + public function setTextOffset($var) + { + GPBUtil::checkInt64($var); + $this->text_offset = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ShardInfo::class, \Google\Cloud\DocumentAI\V1\Document_ShardInfo::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Style.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Style.php new file mode 100644 index 000000000000..919a62161e39 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Style.php @@ -0,0 +1,377 @@ +google.cloud.documentai.v1.Document.Style + */ +class Style extends \Google\Protobuf\Internal\Message +{ + /** + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1; + */ + protected $text_anchor = null; + /** + * Text color. + * + * Generated from protobuf field .google.type.Color color = 2; + */ + protected $color = null; + /** + * Text background color. + * + * Generated from protobuf field .google.type.Color background_color = 3; + */ + protected $background_color = null; + /** + * [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp). + * Possible values are `normal`, `bold`, `bolder`, and `lighter`. + * + * Generated from protobuf field string font_weight = 4; + */ + protected $font_weight = ''; + /** + * [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp). + * Possible values are `normal`, `italic`, and `oblique`. + * + * Generated from protobuf field string text_style = 5; + */ + protected $text_style = ''; + /** + * [Text + * decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp). + * Follows CSS standard. + * + * + * Generated from protobuf field string text_decoration = 6; + */ + protected $text_decoration = ''; + /** + * Font size. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Style.FontSize font_size = 7; + */ + protected $font_size = null; + /** + * Font family such as `Arial`, `Times New Roman`. + * https://www.w3schools.com/cssref/pr_font_font-family.asp + * + * Generated from protobuf field string font_family = 8; + */ + protected $font_family = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\TextAnchor $text_anchor + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * @type \Google\Type\Color $color + * Text color. + * @type \Google\Type\Color $background_color + * Text background color. + * @type string $font_weight + * [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp). + * Possible values are `normal`, `bold`, `bolder`, and `lighter`. + * @type string $text_style + * [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp). + * Possible values are `normal`, `italic`, and `oblique`. + * @type string $text_decoration + * [Text + * decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp). + * Follows CSS standard. + * + * @type \Google\Cloud\DocumentAI\V1\Document\Style\FontSize $font_size + * Font size. + * @type string $font_family + * Font family such as `Arial`, `Times New Roman`. + * https://www.w3schools.com/cssref/pr_font_font-family.asp + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\TextAnchor|null + */ + public function getTextAnchor() + { + return $this->text_anchor; + } + + public function hasTextAnchor() + { + return isset($this->text_anchor); + } + + public function clearTextAnchor() + { + unset($this->text_anchor); + } + + /** + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\TextAnchor $var + * @return $this + */ + public function setTextAnchor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\TextAnchor::class); + $this->text_anchor = $var; + + return $this; + } + + /** + * Text color. + * + * Generated from protobuf field .google.type.Color color = 2; + * @return \Google\Type\Color|null + */ + public function getColor() + { + return $this->color; + } + + public function hasColor() + { + return isset($this->color); + } + + public function clearColor() + { + unset($this->color); + } + + /** + * Text color. + * + * Generated from protobuf field .google.type.Color color = 2; + * @param \Google\Type\Color $var + * @return $this + */ + public function setColor($var) + { + GPBUtil::checkMessage($var, \Google\Type\Color::class); + $this->color = $var; + + return $this; + } + + /** + * Text background color. + * + * Generated from protobuf field .google.type.Color background_color = 3; + * @return \Google\Type\Color|null + */ + public function getBackgroundColor() + { + return $this->background_color; + } + + public function hasBackgroundColor() + { + return isset($this->background_color); + } + + public function clearBackgroundColor() + { + unset($this->background_color); + } + + /** + * Text background color. + * + * Generated from protobuf field .google.type.Color background_color = 3; + * @param \Google\Type\Color $var + * @return $this + */ + public function setBackgroundColor($var) + { + GPBUtil::checkMessage($var, \Google\Type\Color::class); + $this->background_color = $var; + + return $this; + } + + /** + * [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp). + * Possible values are `normal`, `bold`, `bolder`, and `lighter`. + * + * Generated from protobuf field string font_weight = 4; + * @return string + */ + public function getFontWeight() + { + return $this->font_weight; + } + + /** + * [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp). + * Possible values are `normal`, `bold`, `bolder`, and `lighter`. + * + * Generated from protobuf field string font_weight = 4; + * @param string $var + * @return $this + */ + public function setFontWeight($var) + { + GPBUtil::checkString($var, True); + $this->font_weight = $var; + + return $this; + } + + /** + * [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp). + * Possible values are `normal`, `italic`, and `oblique`. + * + * Generated from protobuf field string text_style = 5; + * @return string + */ + public function getTextStyle() + { + return $this->text_style; + } + + /** + * [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp). + * Possible values are `normal`, `italic`, and `oblique`. + * + * Generated from protobuf field string text_style = 5; + * @param string $var + * @return $this + */ + public function setTextStyle($var) + { + GPBUtil::checkString($var, True); + $this->text_style = $var; + + return $this; + } + + /** + * [Text + * decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp). + * Follows CSS standard. + * + * + * Generated from protobuf field string text_decoration = 6; + * @return string + */ + public function getTextDecoration() + { + return $this->text_decoration; + } + + /** + * [Text + * decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp). + * Follows CSS standard. + * + * + * Generated from protobuf field string text_decoration = 6; + * @param string $var + * @return $this + */ + public function setTextDecoration($var) + { + GPBUtil::checkString($var, True); + $this->text_decoration = $var; + + return $this; + } + + /** + * Font size. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Style.FontSize font_size = 7; + * @return \Google\Cloud\DocumentAI\V1\Document\Style\FontSize|null + */ + public function getFontSize() + { + return $this->font_size; + } + + public function hasFontSize() + { + return isset($this->font_size); + } + + public function clearFontSize() + { + unset($this->font_size); + } + + /** + * Font size. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.Style.FontSize font_size = 7; + * @param \Google\Cloud\DocumentAI\V1\Document\Style\FontSize $var + * @return $this + */ + public function setFontSize($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\Style\FontSize::class); + $this->font_size = $var; + + return $this; + } + + /** + * Font family such as `Arial`, `Times New Roman`. + * https://www.w3schools.com/cssref/pr_font_font-family.asp + * + * Generated from protobuf field string font_family = 8; + * @return string + */ + public function getFontFamily() + { + return $this->font_family; + } + + /** + * Font family such as `Arial`, `Times New Roman`. + * https://www.w3schools.com/cssref/pr_font_font-family.asp + * + * Generated from protobuf field string font_family = 8; + * @param string $var + * @return $this + */ + public function setFontFamily($var) + { + GPBUtil::checkString($var, True); + $this->font_family = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Style::class, \Google\Cloud\DocumentAI\V1\Document_Style::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Style/FontSize.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Style/FontSize.php new file mode 100644 index 000000000000..0df1bbb3866b --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/Style/FontSize.php @@ -0,0 +1,108 @@ +google.cloud.documentai.v1.Document.Style.FontSize + */ +class FontSize extends \Google\Protobuf\Internal\Message +{ + /** + * Font size for the text. + * + * Generated from protobuf field float size = 1; + */ + protected $size = 0.0; + /** + * Unit for the font size. Follows CSS naming (such as `in`, `px`, and + * `pt`). + * + * Generated from protobuf field string unit = 2; + */ + protected $unit = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $size + * Font size for the text. + * @type string $unit + * Unit for the font size. Follows CSS naming (such as `in`, `px`, and + * `pt`). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Font size for the text. + * + * Generated from protobuf field float size = 1; + * @return float + */ + public function getSize() + { + return $this->size; + } + + /** + * Font size for the text. + * + * Generated from protobuf field float size = 1; + * @param float $var + * @return $this + */ + public function setSize($var) + { + GPBUtil::checkFloat($var); + $this->size = $var; + + return $this; + } + + /** + * Unit for the font size. Follows CSS naming (such as `in`, `px`, and + * `pt`). + * + * Generated from protobuf field string unit = 2; + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * Unit for the font size. Follows CSS naming (such as `in`, `px`, and + * `pt`). + * + * Generated from protobuf field string unit = 2; + * @param string $var + * @return $this + */ + public function setUnit($var) + { + GPBUtil::checkString($var, True); + $this->unit = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FontSize::class, \Google\Cloud\DocumentAI\V1\Document_Style_FontSize::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/TextAnchor.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/TextAnchor.php new file mode 100644 index 000000000000..d0ae3fa3ca95 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/TextAnchor.php @@ -0,0 +1,117 @@ +google.cloud.documentai.v1.Document.TextAnchor + */ +class TextAnchor extends \Google\Protobuf\Internal\Message +{ + /** + * The text segments from the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.TextAnchor.TextSegment text_segments = 1; + */ + private $text_segments; + /** + * Contains the content of the text span so that users do + * not have to look it up in the text_segments. It is always + * populated for formFields. + * + * Generated from protobuf field string content = 2; + */ + protected $content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\Document\TextAnchor\TextSegment>|\Google\Protobuf\Internal\RepeatedField $text_segments + * The text segments from the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * @type string $content + * Contains the content of the text span so that users do + * not have to look it up in the text_segments. It is always + * populated for formFields. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * The text segments from the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.TextAnchor.TextSegment text_segments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTextSegments() + { + return $this->text_segments; + } + + /** + * The text segments from the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.TextAnchor.TextSegment text_segments = 1; + * @param array<\Google\Cloud\DocumentAI\V1\Document\TextAnchor\TextSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTextSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\TextAnchor\TextSegment::class); + $this->text_segments = $arr; + + return $this; + } + + /** + * Contains the content of the text span so that users do + * not have to look it up in the text_segments. It is always + * populated for formFields. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Contains the content of the text span so that users do + * not have to look it up in the text_segments. It is always + * populated for formFields. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TextAnchor::class, \Google\Cloud\DocumentAI\V1\Document_TextAnchor::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/TextAnchor/TextSegment.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/TextAnchor/TextSegment.php new file mode 100644 index 000000000000..7f67fa87c9e7 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/TextAnchor/TextSegment.php @@ -0,0 +1,124 @@ +google.cloud.documentai.v1.Document.TextAnchor.TextSegment + */ +class TextSegment extends \Google\Protobuf\Internal\Message +{ + /** + * [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + * start UTF-8 char index in the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field int64 start_index = 1; + */ + protected $start_index = 0; + /** + * [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + * half open end UTF-8 char index in the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field int64 end_index = 2; + */ + protected $end_index = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $start_index + * [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + * start UTF-8 char index in the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * @type int|string $end_index + * [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + * half open end UTF-8 char index in the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + * start UTF-8 char index in the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field int64 start_index = 1; + * @return int|string + */ + public function getStartIndex() + { + return $this->start_index; + } + + /** + * [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + * start UTF-8 char index in the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field int64 start_index = 1; + * @param int|string $var + * @return $this + */ + public function setStartIndex($var) + { + GPBUtil::checkInt64($var); + $this->start_index = $var; + + return $this; + } + + /** + * [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + * half open end UTF-8 char index in the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field int64 end_index = 2; + * @return int|string + */ + public function getEndIndex() + { + return $this->end_index; + } + + /** + * [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] + * half open end UTF-8 char index in the + * [Document.text][google.cloud.documentai.v1.Document.text]. + * + * Generated from protobuf field int64 end_index = 2; + * @param int|string $var + * @return $this + */ + public function setEndIndex($var) + { + GPBUtil::checkInt64($var); + $this->end_index = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TextSegment::class, \Google\Cloud\DocumentAI\V1\Document_TextAnchor_TextSegment::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/TextChange.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/TextChange.php new file mode 100644 index 000000000000..ed6ad16e5623 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Document/TextChange.php @@ -0,0 +1,173 @@ +google.cloud.documentai.v1.Document.TextChange + */ +class TextChange extends \Google\Protobuf\Internal\Message +{ + /** + * Provenance of the correction. + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. There can + * only be a single `TextAnchor.text_segments` element. If the start and + * end index of the text segment are the same, the text change is inserted + * before that index. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1; + */ + protected $text_anchor = null; + /** + * The text that replaces the text identified in the `text_anchor`. + * + * Generated from protobuf field string changed_text = 2; + */ + protected $changed_text = ''; + /** + * The history of this annotation. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @deprecated + */ + private $provenance; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document\TextAnchor $text_anchor + * Provenance of the correction. + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. There can + * only be a single `TextAnchor.text_segments` element. If the start and + * end index of the text segment are the same, the text change is inserted + * before that index. + * @type string $changed_text + * The text that replaces the text identified in the `text_anchor`. + * @type array<\Google\Cloud\DocumentAI\V1\Document\Provenance>|\Google\Protobuf\Internal\RepeatedField $provenance + * The history of this annotation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Document::initOnce(); + parent::__construct($data); + } + + /** + * Provenance of the correction. + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. There can + * only be a single `TextAnchor.text_segments` element. If the start and + * end index of the text segment are the same, the text change is inserted + * before that index. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1; + * @return \Google\Cloud\DocumentAI\V1\Document\TextAnchor|null + */ + public function getTextAnchor() + { + return $this->text_anchor; + } + + public function hasTextAnchor() + { + return isset($this->text_anchor); + } + + public function clearTextAnchor() + { + unset($this->text_anchor); + } + + /** + * Provenance of the correction. + * Text anchor indexing into the + * [Document.text][google.cloud.documentai.v1.Document.text]. There can + * only be a single `TextAnchor.text_segments` element. If the start and + * end index of the text segment are the same, the text change is inserted + * before that index. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document.TextAnchor text_anchor = 1; + * @param \Google\Cloud\DocumentAI\V1\Document\TextAnchor $var + * @return $this + */ + public function setTextAnchor($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document\TextAnchor::class); + $this->text_anchor = $var; + + return $this; + } + + /** + * The text that replaces the text identified in the `text_anchor`. + * + * Generated from protobuf field string changed_text = 2; + * @return string + */ + public function getChangedText() + { + return $this->changed_text; + } + + /** + * The text that replaces the text identified in the `text_anchor`. + * + * Generated from protobuf field string changed_text = 2; + * @param string $var + * @return $this + */ + public function setChangedText($var) + { + GPBUtil::checkString($var, True); + $this->changed_text = $var; + + return $this; + } + + /** + * The history of this annotation. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getProvenance() + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + return $this->provenance; + } + + /** + * The history of this annotation. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Provenance provenance = 3 [deprecated = true]; + * @param array<\Google\Cloud\DocumentAI\V1\Document\Provenance>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setProvenance($var) + { + @trigger_error('provenance is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Document\Provenance::class); + $this->provenance = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TextChange::class, \Google\Cloud\DocumentAI\V1\Document_TextChange::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentOutputConfig.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentOutputConfig.php new file mode 100644 index 000000000000..d7f41a08760d --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentOutputConfig.php @@ -0,0 +1,76 @@ +google.cloud.documentai.v1.DocumentOutputConfig + */ +class DocumentOutputConfig extends \Google\Protobuf\Internal\Message +{ + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\DocumentOutputConfig\GcsOutputConfig $gcs_output_config + * Output config to write the results to Cloud Storage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * Output config to write the results to Cloud Storage. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig gcs_output_config = 1; + * @return \Google\Cloud\DocumentAI\V1\DocumentOutputConfig\GcsOutputConfig|null + */ + public function getGcsOutputConfig() + { + return $this->readOneof(1); + } + + public function hasGcsOutputConfig() + { + return $this->hasOneof(1); + } + + /** + * Output config to write the results to Cloud Storage. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig gcs_output_config = 1; + * @param \Google\Cloud\DocumentAI\V1\DocumentOutputConfig\GcsOutputConfig $var + * @return $this + */ + public function setGcsOutputConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\DocumentOutputConfig\GcsOutputConfig::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentOutputConfig/GcsOutputConfig.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentOutputConfig/GcsOutputConfig.php new file mode 100644 index 000000000000..cbbd78f0a971 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentOutputConfig/GcsOutputConfig.php @@ -0,0 +1,166 @@ +google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + */ +class GcsOutputConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The Cloud Storage uri (a directory) of the output. + * + * Generated from protobuf field string gcs_uri = 1; + */ + protected $gcs_uri = ''; + /** + * Specifies which fields to include in the output documents. + * Only supports top level document and pages field so it must be in the + * form of `{document_field_name}` or `pages.{page_field_name}`. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2; + */ + protected $field_mask = null; + /** + * Specifies the sharding config for the output document. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig sharding_config = 3; + */ + protected $sharding_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcs_uri + * The Cloud Storage uri (a directory) of the output. + * @type \Google\Protobuf\FieldMask $field_mask + * Specifies which fields to include in the output documents. + * Only supports top level document and pages field so it must be in the + * form of `{document_field_name}` or `pages.{page_field_name}`. + * @type \Google\Cloud\DocumentAI\V1\DocumentOutputConfig\GcsOutputConfig\ShardingConfig $sharding_config + * Specifies the sharding config for the output document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * The Cloud Storage uri (a directory) of the output. + * + * Generated from protobuf field string gcs_uri = 1; + * @return string + */ + public function getGcsUri() + { + return $this->gcs_uri; + } + + /** + * The Cloud Storage uri (a directory) of the output. + * + * Generated from protobuf field string gcs_uri = 1; + * @param string $var + * @return $this + */ + public function setGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->gcs_uri = $var; + + return $this; + } + + /** + * Specifies which fields to include in the output documents. + * Only supports top level document and pages field so it must be in the + * form of `{document_field_name}` or `pages.{page_field_name}`. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getFieldMask() + { + return $this->field_mask; + } + + public function hasFieldMask() + { + return isset($this->field_mask); + } + + public function clearFieldMask() + { + unset($this->field_mask); + } + + /** + * Specifies which fields to include in the output documents. + * Only supports top level document and pages field so it must be in the + * form of `{document_field_name}` or `pages.{page_field_name}`. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setFieldMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->field_mask = $var; + + return $this; + } + + /** + * Specifies the sharding config for the output document. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig sharding_config = 3; + * @return \Google\Cloud\DocumentAI\V1\DocumentOutputConfig\GcsOutputConfig\ShardingConfig|null + */ + public function getShardingConfig() + { + return $this->sharding_config; + } + + public function hasShardingConfig() + { + return isset($this->sharding_config); + } + + public function clearShardingConfig() + { + unset($this->sharding_config); + } + + /** + * Specifies the sharding config for the output document. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig sharding_config = 3; + * @param \Google\Cloud\DocumentAI\V1\DocumentOutputConfig\GcsOutputConfig\ShardingConfig $var + * @return $this + */ + public function setShardingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\DocumentOutputConfig\GcsOutputConfig\ShardingConfig::class); + $this->sharding_config = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(GcsOutputConfig::class, \Google\Cloud\DocumentAI\V1\DocumentOutputConfig_GcsOutputConfig::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentOutputConfig/GcsOutputConfig/ShardingConfig.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentOutputConfig/GcsOutputConfig/ShardingConfig.php new file mode 100644 index 000000000000..9764b5c850c0 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentOutputConfig/GcsOutputConfig/ShardingConfig.php @@ -0,0 +1,104 @@ +google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + */ +class ShardingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The number of pages per shard. + * + * Generated from protobuf field int32 pages_per_shard = 1; + */ + protected $pages_per_shard = 0; + /** + * The number of overlapping pages between consecutive shards. + * + * Generated from protobuf field int32 pages_overlap = 2; + */ + protected $pages_overlap = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $pages_per_shard + * The number of pages per shard. + * @type int $pages_overlap + * The number of overlapping pages between consecutive shards. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * The number of pages per shard. + * + * Generated from protobuf field int32 pages_per_shard = 1; + * @return int + */ + public function getPagesPerShard() + { + return $this->pages_per_shard; + } + + /** + * The number of pages per shard. + * + * Generated from protobuf field int32 pages_per_shard = 1; + * @param int $var + * @return $this + */ + public function setPagesPerShard($var) + { + GPBUtil::checkInt32($var); + $this->pages_per_shard = $var; + + return $this; + } + + /** + * The number of overlapping pages between consecutive shards. + * + * Generated from protobuf field int32 pages_overlap = 2; + * @return int + */ + public function getPagesOverlap() + { + return $this->pages_overlap; + } + + /** + * The number of overlapping pages between consecutive shards. + * + * Generated from protobuf field int32 pages_overlap = 2; + * @param int $var + * @return $this + */ + public function setPagesOverlap($var) + { + GPBUtil::checkInt32($var); + $this->pages_overlap = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ShardingConfig::class, \Google\Cloud\DocumentAI\V1\DocumentOutputConfig_GcsOutputConfig_ShardingConfig::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema.php new file mode 100644 index 000000000000..13b434f2f8a4 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema.php @@ -0,0 +1,179 @@ +google.cloud.documentai.v1.DocumentSchema + */ +class DocumentSchema extends \Google\Protobuf\Internal\Message +{ + /** + * Display name to show to users. + * + * Generated from protobuf field string display_name = 1; + */ + protected $display_name = ''; + /** + * Description of the schema. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * Entity types of the schema. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.DocumentSchema.EntityType entity_types = 3; + */ + private $entity_types; + /** + * Metadata of the schema. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema.Metadata metadata = 4; + */ + protected $metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * Display name to show to users. + * @type string $description + * Description of the schema. + * @type array<\Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType>|\Google\Protobuf\Internal\RepeatedField $entity_types + * Entity types of the schema. + * @type \Google\Cloud\DocumentAI\V1\DocumentSchema\Metadata $metadata + * Metadata of the schema. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentSchema::initOnce(); + parent::__construct($data); + } + + /** + * Display name to show to users. + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Display name to show to users. + * + * Generated from protobuf field string display_name = 1; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Description of the schema. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Description of the schema. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Entity types of the schema. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.DocumentSchema.EntityType entity_types = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntityTypes() + { + return $this->entity_types; + } + + /** + * Entity types of the schema. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.DocumentSchema.EntityType entity_types = 3; + * @param array<\Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntityTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType::class); + $this->entity_types = $arr; + + return $this; + } + + /** + * Metadata of the schema. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema.Metadata metadata = 4; + * @return \Google\Cloud\DocumentAI\V1\DocumentSchema\Metadata|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Metadata of the schema. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema.Metadata metadata = 4; + * @param \Google\Cloud\DocumentAI\V1\DocumentSchema\Metadata $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\DocumentSchema\Metadata::class); + $this->metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType.php new file mode 100644 index 000000000000..72b224ab8df9 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType.php @@ -0,0 +1,276 @@ +google.cloud.documentai.v1.DocumentSchema.EntityType + */ +class EntityType extends \Google\Protobuf\Internal\Message +{ + /** + * User defined name for the type. + * + * Generated from protobuf field string display_name = 13; + */ + protected $display_name = ''; + /** + * Name of the type. It must be unique within the schema file and + * cannot be a "Common Type". The following naming conventions are used: + * - Use `snake_casing`. + * - Name matching is case-sensitive. + * - Maximum 64 characters. + * - Must start with a letter. + * - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward + * compatibility internal infrastructure and tooling can handle any ascii + * character.) + * - The `/` is sometimes used to denote a property of a type. For example + * `line_item/amount`. This convention is deprecated, but will still be + * honored for backward compatibility. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The entity type that this type is derived from. For now, one and only + * one should be set. + * + * Generated from protobuf field repeated string base_types = 2; + */ + private $base_types; + /** + * Description the nested structure, or composition of an entity. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.DocumentSchema.EntityType.Property properties = 6; + */ + private $properties; + protected $value_source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType\EnumValues $enum_values + * If specified, lists all the possible values for this entity. This + * should not be more than a handful of values. If the number of values + * is >10 or could change frequently use the `EntityType.value_ontology` + * field and specify a list of all possible values in a value ontology + * file. + * @type string $display_name + * User defined name for the type. + * @type string $name + * Name of the type. It must be unique within the schema file and + * cannot be a "Common Type". The following naming conventions are used: + * - Use `snake_casing`. + * - Name matching is case-sensitive. + * - Maximum 64 characters. + * - Must start with a letter. + * - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward + * compatibility internal infrastructure and tooling can handle any ascii + * character.) + * - The `/` is sometimes used to denote a property of a type. For example + * `line_item/amount`. This convention is deprecated, but will still be + * honored for backward compatibility. + * @type array|\Google\Protobuf\Internal\RepeatedField $base_types + * The entity type that this type is derived from. For now, one and only + * one should be set. + * @type array<\Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType\Property>|\Google\Protobuf\Internal\RepeatedField $properties + * Description the nested structure, or composition of an entity. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentSchema::initOnce(); + parent::__construct($data); + } + + /** + * If specified, lists all the possible values for this entity. This + * should not be more than a handful of values. If the number of values + * is >10 or could change frequently use the `EntityType.value_ontology` + * field and specify a list of all possible values in a value ontology + * file. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues enum_values = 14; + * @return \Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType\EnumValues|null + */ + public function getEnumValues() + { + return $this->readOneof(14); + } + + public function hasEnumValues() + { + return $this->hasOneof(14); + } + + /** + * If specified, lists all the possible values for this entity. This + * should not be more than a handful of values. If the number of values + * is >10 or could change frequently use the `EntityType.value_ontology` + * field and specify a list of all possible values in a value ontology + * file. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues enum_values = 14; + * @param \Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType\EnumValues $var + * @return $this + */ + public function setEnumValues($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType\EnumValues::class); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * User defined name for the type. + * + * Generated from protobuf field string display_name = 13; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * User defined name for the type. + * + * Generated from protobuf field string display_name = 13; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Name of the type. It must be unique within the schema file and + * cannot be a "Common Type". The following naming conventions are used: + * - Use `snake_casing`. + * - Name matching is case-sensitive. + * - Maximum 64 characters. + * - Must start with a letter. + * - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward + * compatibility internal infrastructure and tooling can handle any ascii + * character.) + * - The `/` is sometimes used to denote a property of a type. For example + * `line_item/amount`. This convention is deprecated, but will still be + * honored for backward compatibility. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name of the type. It must be unique within the schema file and + * cannot be a "Common Type". The following naming conventions are used: + * - Use `snake_casing`. + * - Name matching is case-sensitive. + * - Maximum 64 characters. + * - Must start with a letter. + * - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward + * compatibility internal infrastructure and tooling can handle any ascii + * character.) + * - The `/` is sometimes used to denote a property of a type. For example + * `line_item/amount`. This convention is deprecated, but will still be + * honored for backward compatibility. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The entity type that this type is derived from. For now, one and only + * one should be set. + * + * Generated from protobuf field repeated string base_types = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBaseTypes() + { + return $this->base_types; + } + + /** + * The entity type that this type is derived from. For now, one and only + * one should be set. + * + * Generated from protobuf field repeated string base_types = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBaseTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->base_types = $arr; + + return $this; + } + + /** + * Description the nested structure, or composition of an entity. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.DocumentSchema.EntityType.Property properties = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Description the nested structure, or composition of an entity. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.DocumentSchema.EntityType.Property properties = 6; + * @param array<\Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType\Property>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProperties($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType\Property::class); + $this->properties = $arr; + + return $this; + } + + /** + * @return string + */ + public function getValueSource() + { + return $this->whichOneof("value_source"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EntityType::class, \Google\Cloud\DocumentAI\V1\DocumentSchema_EntityType::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType/EnumValues.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType/EnumValues.php new file mode 100644 index 000000000000..40edb0b0d86f --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType/EnumValues.php @@ -0,0 +1,70 @@ +google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + */ +class EnumValues extends \Google\Protobuf\Internal\Message +{ + /** + * The individual values that this enum values type can include. + * + * Generated from protobuf field repeated string values = 1; + */ + private $values; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $values + * The individual values that this enum values type can include. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentSchema::initOnce(); + parent::__construct($data); + } + + /** + * The individual values that this enum values type can include. + * + * Generated from protobuf field repeated string values = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * The individual values that this enum values type can include. + * + * Generated from protobuf field repeated string values = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->values = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EnumValues::class, \Google\Cloud\DocumentAI\V1\DocumentSchema_EntityType_EnumValues::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType/Property.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType/Property.php new file mode 100644 index 000000000000..20d4f8e12369 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType/Property.php @@ -0,0 +1,150 @@ +google.cloud.documentai.v1.DocumentSchema.EntityType.Property + */ +class Property extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the property. Follows the same guidelines as the + * EntityType name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * A reference to the value type of the property. This type is subject + * to the same conventions as the `Entity.base_types` field. + * + * Generated from protobuf field string value_type = 2; + */ + protected $value_type = ''; + /** + * Occurrence type limits the number of instances an entity type appears + * in the document. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType occurrence_type = 3; + */ + protected $occurrence_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the property. Follows the same guidelines as the + * EntityType name. + * @type string $value_type + * A reference to the value type of the property. This type is subject + * to the same conventions as the `Entity.base_types` field. + * @type int $occurrence_type + * Occurrence type limits the number of instances an entity type appears + * in the document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentSchema::initOnce(); + parent::__construct($data); + } + + /** + * The name of the property. Follows the same guidelines as the + * EntityType name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the property. Follows the same guidelines as the + * EntityType name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * A reference to the value type of the property. This type is subject + * to the same conventions as the `Entity.base_types` field. + * + * Generated from protobuf field string value_type = 2; + * @return string + */ + public function getValueType() + { + return $this->value_type; + } + + /** + * A reference to the value type of the property. This type is subject + * to the same conventions as the `Entity.base_types` field. + * + * Generated from protobuf field string value_type = 2; + * @param string $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkString($var, True); + $this->value_type = $var; + + return $this; + } + + /** + * Occurrence type limits the number of instances an entity type appears + * in the document. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType occurrence_type = 3; + * @return int + */ + public function getOccurrenceType() + { + return $this->occurrence_type; + } + + /** + * Occurrence type limits the number of instances an entity type appears + * in the document. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType occurrence_type = 3; + * @param int $var + * @return $this + */ + public function setOccurrenceType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\DocumentSchema\EntityType\Property\OccurrenceType::class); + $this->occurrence_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Property::class, \Google\Cloud\DocumentAI\V1\DocumentSchema_EntityType_Property::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType/Property/OccurrenceType.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType/Property/OccurrenceType.php new file mode 100644 index 000000000000..08b9fa2fb91a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/EntityType/Property/OccurrenceType.php @@ -0,0 +1,88 @@ +google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType + */ +class OccurrenceType +{ + /** + * Unspecified occurrence type. + * + * Generated from protobuf enum OCCURRENCE_TYPE_UNSPECIFIED = 0; + */ + const OCCURRENCE_TYPE_UNSPECIFIED = 0; + /** + * There will be zero or one instance of this entity type. The same + * entity instance may be mentioned multiple times. + * + * Generated from protobuf enum OPTIONAL_ONCE = 1; + */ + const OPTIONAL_ONCE = 1; + /** + * The entity type will appear zero or multiple times. + * + * Generated from protobuf enum OPTIONAL_MULTIPLE = 2; + */ + const OPTIONAL_MULTIPLE = 2; + /** + * The entity type will only appear exactly once. The same + * entity instance may be mentioned multiple times. + * + * Generated from protobuf enum REQUIRED_ONCE = 3; + */ + const REQUIRED_ONCE = 3; + /** + * The entity type will appear once or more times. + * + * Generated from protobuf enum REQUIRED_MULTIPLE = 4; + */ + const REQUIRED_MULTIPLE = 4; + + private static $valueToName = [ + self::OCCURRENCE_TYPE_UNSPECIFIED => 'OCCURRENCE_TYPE_UNSPECIFIED', + self::OPTIONAL_ONCE => 'OPTIONAL_ONCE', + self::OPTIONAL_MULTIPLE => 'OPTIONAL_MULTIPLE', + self::REQUIRED_ONCE => 'REQUIRED_ONCE', + self::REQUIRED_MULTIPLE => 'REQUIRED_MULTIPLE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OccurrenceType::class, \Google\Cloud\DocumentAI\V1\DocumentSchema_EntityType_Property_OccurrenceType::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/Metadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/Metadata.php new file mode 100644 index 000000000000..a7906306349a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/DocumentSchema/Metadata.php @@ -0,0 +1,192 @@ +google.cloud.documentai.v1.DocumentSchema.Metadata + */ +class Metadata extends \Google\Protobuf\Internal\Message +{ + /** + * If true, a `document` entity type can be applied to subdocument + * (splitting). Otherwise, it can only be applied to the entire document + * (classification). + * + * Generated from protobuf field bool document_splitter = 1; + */ + protected $document_splitter = false; + /** + * If true, on a given page, there can be multiple `document` annotations + * covering it. + * + * Generated from protobuf field bool document_allow_multiple_labels = 2; + */ + protected $document_allow_multiple_labels = false; + /** + * If set, all the nested entities must be prefixed with the parents. + * + * Generated from protobuf field bool prefixed_naming_on_properties = 6; + */ + protected $prefixed_naming_on_properties = false; + /** + * If set, we will skip the naming format validation in the schema. So the + * string values in `DocumentSchema.EntityType.name` and + * `DocumentSchema.EntityType.Property.name` will not be checked. + * + * Generated from protobuf field bool skip_naming_validation = 7; + */ + protected $skip_naming_validation = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $document_splitter + * If true, a `document` entity type can be applied to subdocument + * (splitting). Otherwise, it can only be applied to the entire document + * (classification). + * @type bool $document_allow_multiple_labels + * If true, on a given page, there can be multiple `document` annotations + * covering it. + * @type bool $prefixed_naming_on_properties + * If set, all the nested entities must be prefixed with the parents. + * @type bool $skip_naming_validation + * If set, we will skip the naming format validation in the schema. So the + * string values in `DocumentSchema.EntityType.name` and + * `DocumentSchema.EntityType.Property.name` will not be checked. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentSchema::initOnce(); + parent::__construct($data); + } + + /** + * If true, a `document` entity type can be applied to subdocument + * (splitting). Otherwise, it can only be applied to the entire document + * (classification). + * + * Generated from protobuf field bool document_splitter = 1; + * @return bool + */ + public function getDocumentSplitter() + { + return $this->document_splitter; + } + + /** + * If true, a `document` entity type can be applied to subdocument + * (splitting). Otherwise, it can only be applied to the entire document + * (classification). + * + * Generated from protobuf field bool document_splitter = 1; + * @param bool $var + * @return $this + */ + public function setDocumentSplitter($var) + { + GPBUtil::checkBool($var); + $this->document_splitter = $var; + + return $this; + } + + /** + * If true, on a given page, there can be multiple `document` annotations + * covering it. + * + * Generated from protobuf field bool document_allow_multiple_labels = 2; + * @return bool + */ + public function getDocumentAllowMultipleLabels() + { + return $this->document_allow_multiple_labels; + } + + /** + * If true, on a given page, there can be multiple `document` annotations + * covering it. + * + * Generated from protobuf field bool document_allow_multiple_labels = 2; + * @param bool $var + * @return $this + */ + public function setDocumentAllowMultipleLabels($var) + { + GPBUtil::checkBool($var); + $this->document_allow_multiple_labels = $var; + + return $this; + } + + /** + * If set, all the nested entities must be prefixed with the parents. + * + * Generated from protobuf field bool prefixed_naming_on_properties = 6; + * @return bool + */ + public function getPrefixedNamingOnProperties() + { + return $this->prefixed_naming_on_properties; + } + + /** + * If set, all the nested entities must be prefixed with the parents. + * + * Generated from protobuf field bool prefixed_naming_on_properties = 6; + * @param bool $var + * @return $this + */ + public function setPrefixedNamingOnProperties($var) + { + GPBUtil::checkBool($var); + $this->prefixed_naming_on_properties = $var; + + return $this; + } + + /** + * If set, we will skip the naming format validation in the schema. So the + * string values in `DocumentSchema.EntityType.name` and + * `DocumentSchema.EntityType.Property.name` will not be checked. + * + * Generated from protobuf field bool skip_naming_validation = 7; + * @return bool + */ + public function getSkipNamingValidation() + { + return $this->skip_naming_validation; + } + + /** + * If set, we will skip the naming format validation in the schema. So the + * string values in `DocumentSchema.EntityType.name` and + * `DocumentSchema.EntityType.Property.name` will not be checked. + * + * Generated from protobuf field bool skip_naming_validation = 7; + * @param bool $var + * @return $this + */ + public function setSkipNamingValidation($var) + { + GPBUtil::checkBool($var); + $this->skip_naming_validation = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Metadata::class, \Google\Cloud\DocumentAI\V1\DocumentSchema_Metadata::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EnableProcessorMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EnableProcessorMetadata.php new file mode 100644 index 000000000000..dc3948aaae17 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EnableProcessorMetadata.php @@ -0,0 +1,79 @@ +google.cloud.documentai.v1.EnableProcessorMetadata + */ +class EnableProcessorMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + */ + protected $common_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EnableProcessorRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EnableProcessorRequest.php new file mode 100644 index 000000000000..3e3a5c3e66b6 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EnableProcessorRequest.php @@ -0,0 +1,69 @@ +google.cloud.documentai.v1.EnableProcessorRequest + */ +class EnableProcessorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The processor resource name to be enabled. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The processor resource name to be enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The processor resource name to be enabled. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The processor resource name to be enabled. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EnableProcessorResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EnableProcessorResponse.php new file mode 100644 index 000000000000..573c89ac5fa2 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EnableProcessorResponse.php @@ -0,0 +1,35 @@ +google.cloud.documentai.v1.EnableProcessorResponse + */ +class EnableProcessorResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluateProcessorVersionMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluateProcessorVersionMetadata.php new file mode 100644 index 000000000000..4ac915145e9d --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluateProcessorVersionMetadata.php @@ -0,0 +1,79 @@ +google.cloud.documentai.v1.EvaluateProcessorVersionMetadata + */ +class EvaluateProcessorVersionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + */ + protected $common_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluateProcessorVersionRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluateProcessorVersionRequest.php new file mode 100644 index 000000000000..3cada6bf65f7 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluateProcessorVersionRequest.php @@ -0,0 +1,146 @@ +google.cloud.documentai.v1.EvaluateProcessorVersionRequest + */ +class EvaluateProcessorVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to + * evaluate. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string processor_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $processor_version = ''; + /** + * Optional. The documents used in the evaluation. If unspecified, use the + * processor's dataset as evaluation input. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig evaluation_documents = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $evaluation_documents = null; + + /** + * @param string $processorVersion Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to + * evaluate. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * Please see {@see DocumentProcessorServiceClient::processorVersionName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\EvaluateProcessorVersionRequest + * + * @experimental + */ + public static function build(string $processorVersion): self + { + return (new self()) + ->setProcessorVersion($processorVersion); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $processor_version + * Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to + * evaluate. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @type \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig $evaluation_documents + * Optional. The documents used in the evaluation. If unspecified, use the + * processor's dataset as evaluation input. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to + * evaluate. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string processor_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProcessorVersion() + { + return $this->processor_version; + } + + /** + * Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to + * evaluate. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string processor_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProcessorVersion($var) + { + GPBUtil::checkString($var, True); + $this->processor_version = $var; + + return $this; + } + + /** + * Optional. The documents used in the evaluation. If unspecified, use the + * processor's dataset as evaluation input. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig evaluation_documents = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig|null + */ + public function getEvaluationDocuments() + { + return $this->evaluation_documents; + } + + public function hasEvaluationDocuments() + { + return isset($this->evaluation_documents); + } + + public function clearEvaluationDocuments() + { + unset($this->evaluation_documents); + } + + /** + * Optional. The documents used in the evaluation. If unspecified, use the + * processor's dataset as evaluation input. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig evaluation_documents = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig $var + * @return $this + */ + public function setEvaluationDocuments($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig::class); + $this->evaluation_documents = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluateProcessorVersionResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluateProcessorVersionResponse.php new file mode 100644 index 000000000000..df4d38b40cde --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluateProcessorVersionResponse.php @@ -0,0 +1,69 @@ +google.cloud.documentai.v1.EvaluateProcessorVersionResponse + */ +class EvaluateProcessorVersionResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the created evaluation. + * + * Generated from protobuf field string evaluation = 2; + */ + protected $evaluation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $evaluation + * The resource name of the created evaluation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the created evaluation. + * + * Generated from protobuf field string evaluation = 2; + * @return string + */ + public function getEvaluation() + { + return $this->evaluation; + } + + /** + * The resource name of the created evaluation. + * + * Generated from protobuf field string evaluation = 2; + * @param string $var + * @return $this + */ + public function setEvaluation($var) + { + GPBUtil::checkString($var, True); + $this->evaluation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation.php new file mode 100644 index 000000000000..7c1964f147c9 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation.php @@ -0,0 +1,309 @@ +google.cloud.documentai.v1.Evaluation + */ +class Evaluation extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the evaluation. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The time that the evaluation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; + */ + protected $create_time = null; + /** + * Counters for the documents used in the evaluation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Counters document_counters = 5; + */ + protected $document_counters = null; + /** + * Metrics for all the entities in aggregate. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics all_entities_metrics = 3; + */ + protected $all_entities_metrics = null; + /** + * Metrics across confidence levels, for different entities. + * + * Generated from protobuf field map entity_metrics = 4; + */ + private $entity_metrics; + /** + * The KMS key name used for encryption. + * + * Generated from protobuf field string kms_key_name = 6; + */ + protected $kms_key_name = ''; + /** + * The KMS key version with which data is encrypted. + * + * Generated from protobuf field string kms_key_version_name = 7; + */ + protected $kms_key_version_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the evaluation. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}` + * @type \Google\Protobuf\Timestamp $create_time + * The time that the evaluation was created. + * @type \Google\Cloud\DocumentAI\V1\Evaluation\Counters $document_counters + * Counters for the documents used in the evaluation. + * @type \Google\Cloud\DocumentAI\V1\Evaluation\MultiConfidenceMetrics $all_entities_metrics + * Metrics for all the entities in aggregate. + * @type array|\Google\Protobuf\Internal\MapField $entity_metrics + * Metrics across confidence levels, for different entities. + * @type string $kms_key_name + * The KMS key name used for encryption. + * @type string $kms_key_version_name + * The KMS key version with which data is encrypted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Evaluation::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the evaluation. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the evaluation. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The time that the evaluation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time that the evaluation was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Counters for the documents used in the evaluation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Counters document_counters = 5; + * @return \Google\Cloud\DocumentAI\V1\Evaluation\Counters|null + */ + public function getDocumentCounters() + { + return $this->document_counters; + } + + public function hasDocumentCounters() + { + return isset($this->document_counters); + } + + public function clearDocumentCounters() + { + unset($this->document_counters); + } + + /** + * Counters for the documents used in the evaluation. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Counters document_counters = 5; + * @param \Google\Cloud\DocumentAI\V1\Evaluation\Counters $var + * @return $this + */ + public function setDocumentCounters($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Evaluation\Counters::class); + $this->document_counters = $var; + + return $this; + } + + /** + * Metrics for all the entities in aggregate. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics all_entities_metrics = 3; + * @return \Google\Cloud\DocumentAI\V1\Evaluation\MultiConfidenceMetrics|null + */ + public function getAllEntitiesMetrics() + { + return $this->all_entities_metrics; + } + + public function hasAllEntitiesMetrics() + { + return isset($this->all_entities_metrics); + } + + public function clearAllEntitiesMetrics() + { + unset($this->all_entities_metrics); + } + + /** + * Metrics for all the entities in aggregate. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics all_entities_metrics = 3; + * @param \Google\Cloud\DocumentAI\V1\Evaluation\MultiConfidenceMetrics $var + * @return $this + */ + public function setAllEntitiesMetrics($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Evaluation\MultiConfidenceMetrics::class); + $this->all_entities_metrics = $var; + + return $this; + } + + /** + * Metrics across confidence levels, for different entities. + * + * Generated from protobuf field map entity_metrics = 4; + * @return \Google\Protobuf\Internal\MapField + */ + public function getEntityMetrics() + { + return $this->entity_metrics; + } + + /** + * Metrics across confidence levels, for different entities. + * + * Generated from protobuf field map entity_metrics = 4; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setEntityMetrics($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Evaluation\MultiConfidenceMetrics::class); + $this->entity_metrics = $arr; + + return $this; + } + + /** + * The KMS key name used for encryption. + * + * Generated from protobuf field string kms_key_name = 6; + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * The KMS key name used for encryption. + * + * Generated from protobuf field string kms_key_name = 6; + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * The KMS key version with which data is encrypted. + * + * Generated from protobuf field string kms_key_version_name = 7; + * @return string + */ + public function getKmsKeyVersionName() + { + return $this->kms_key_version_name; + } + + /** + * The KMS key version with which data is encrypted. + * + * Generated from protobuf field string kms_key_version_name = 7; + * @param string $var + * @return $this + */ + public function setKmsKeyVersionName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_version_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/ConfidenceLevelMetrics.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/ConfidenceLevelMetrics.php new file mode 100644 index 000000000000..41905bc2b7ff --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/ConfidenceLevelMetrics.php @@ -0,0 +1,114 @@ +google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics + */ +class ConfidenceLevelMetrics extends \Google\Protobuf\Internal\Message +{ + /** + * The confidence level. + * + * Generated from protobuf field float confidence_level = 1; + */ + protected $confidence_level = 0.0; + /** + * The metrics at the specific confidence level. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Metrics metrics = 2; + */ + protected $metrics = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $confidence_level + * The confidence level. + * @type \Google\Cloud\DocumentAI\V1\Evaluation\Metrics $metrics + * The metrics at the specific confidence level. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Evaluation::initOnce(); + parent::__construct($data); + } + + /** + * The confidence level. + * + * Generated from protobuf field float confidence_level = 1; + * @return float + */ + public function getConfidenceLevel() + { + return $this->confidence_level; + } + + /** + * The confidence level. + * + * Generated from protobuf field float confidence_level = 1; + * @param float $var + * @return $this + */ + public function setConfidenceLevel($var) + { + GPBUtil::checkFloat($var); + $this->confidence_level = $var; + + return $this; + } + + /** + * The metrics at the specific confidence level. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Metrics metrics = 2; + * @return \Google\Cloud\DocumentAI\V1\Evaluation\Metrics|null + */ + public function getMetrics() + { + return $this->metrics; + } + + public function hasMetrics() + { + return isset($this->metrics); + } + + public function clearMetrics() + { + unset($this->metrics); + } + + /** + * The metrics at the specific confidence level. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Metrics metrics = 2; + * @param \Google\Cloud\DocumentAI\V1\Evaluation\Metrics $var + * @return $this + */ + public function setMetrics($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Evaluation\Metrics::class); + $this->metrics = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ConfidenceLevelMetrics::class, \Google\Cloud\DocumentAI\V1\Evaluation_ConfidenceLevelMetrics::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/Counters.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/Counters.php new file mode 100644 index 000000000000..525a04970600 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/Counters.php @@ -0,0 +1,180 @@ +google.cloud.documentai.v1.Evaluation.Counters + */ +class Counters extends \Google\Protobuf\Internal\Message +{ + /** + * How many documents were sent for evaluation. + * + * Generated from protobuf field int32 input_documents_count = 1; + */ + protected $input_documents_count = 0; + /** + * How many documents were not included in the evaluation as they didn't + * pass validation. + * + * Generated from protobuf field int32 invalid_documents_count = 2; + */ + protected $invalid_documents_count = 0; + /** + * How many documents were not included in the evaluation as Document AI + * failed to process them. + * + * Generated from protobuf field int32 failed_documents_count = 3; + */ + protected $failed_documents_count = 0; + /** + * How many documents were used in the evaluation. + * + * Generated from protobuf field int32 evaluated_documents_count = 4; + */ + protected $evaluated_documents_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $input_documents_count + * How many documents were sent for evaluation. + * @type int $invalid_documents_count + * How many documents were not included in the evaluation as they didn't + * pass validation. + * @type int $failed_documents_count + * How many documents were not included in the evaluation as Document AI + * failed to process them. + * @type int $evaluated_documents_count + * How many documents were used in the evaluation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Evaluation::initOnce(); + parent::__construct($data); + } + + /** + * How many documents were sent for evaluation. + * + * Generated from protobuf field int32 input_documents_count = 1; + * @return int + */ + public function getInputDocumentsCount() + { + return $this->input_documents_count; + } + + /** + * How many documents were sent for evaluation. + * + * Generated from protobuf field int32 input_documents_count = 1; + * @param int $var + * @return $this + */ + public function setInputDocumentsCount($var) + { + GPBUtil::checkInt32($var); + $this->input_documents_count = $var; + + return $this; + } + + /** + * How many documents were not included in the evaluation as they didn't + * pass validation. + * + * Generated from protobuf field int32 invalid_documents_count = 2; + * @return int + */ + public function getInvalidDocumentsCount() + { + return $this->invalid_documents_count; + } + + /** + * How many documents were not included in the evaluation as they didn't + * pass validation. + * + * Generated from protobuf field int32 invalid_documents_count = 2; + * @param int $var + * @return $this + */ + public function setInvalidDocumentsCount($var) + { + GPBUtil::checkInt32($var); + $this->invalid_documents_count = $var; + + return $this; + } + + /** + * How many documents were not included in the evaluation as Document AI + * failed to process them. + * + * Generated from protobuf field int32 failed_documents_count = 3; + * @return int + */ + public function getFailedDocumentsCount() + { + return $this->failed_documents_count; + } + + /** + * How many documents were not included in the evaluation as Document AI + * failed to process them. + * + * Generated from protobuf field int32 failed_documents_count = 3; + * @param int $var + * @return $this + */ + public function setFailedDocumentsCount($var) + { + GPBUtil::checkInt32($var); + $this->failed_documents_count = $var; + + return $this; + } + + /** + * How many documents were used in the evaluation. + * + * Generated from protobuf field int32 evaluated_documents_count = 4; + * @return int + */ + public function getEvaluatedDocumentsCount() + { + return $this->evaluated_documents_count; + } + + /** + * How many documents were used in the evaluation. + * + * Generated from protobuf field int32 evaluated_documents_count = 4; + * @param int $var + * @return $this + */ + public function setEvaluatedDocumentsCount($var) + { + GPBUtil::checkInt32($var); + $this->evaluated_documents_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Counters::class, \Google\Cloud\DocumentAI\V1\Evaluation_Counters::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/Metrics.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/Metrics.php new file mode 100644 index 000000000000..daf92a7fb96a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/Metrics.php @@ -0,0 +1,410 @@ +google.cloud.documentai.v1.Evaluation.Metrics + */ +class Metrics extends \Google\Protobuf\Internal\Message +{ + /** + * The calculated precision. + * + * Generated from protobuf field float precision = 1; + */ + protected $precision = 0.0; + /** + * The calculated recall. + * + * Generated from protobuf field float recall = 2; + */ + protected $recall = 0.0; + /** + * The calculated f1 score. + * + * Generated from protobuf field float f1_score = 3; + */ + protected $f1_score = 0.0; + /** + * The amount of occurrences in predicted documents. + * + * Generated from protobuf field int32 predicted_occurrences_count = 4; + */ + protected $predicted_occurrences_count = 0; + /** + * The amount of occurrences in ground truth documents. + * + * Generated from protobuf field int32 ground_truth_occurrences_count = 5; + */ + protected $ground_truth_occurrences_count = 0; + /** + * The amount of documents with a predicted occurrence. + * + * Generated from protobuf field int32 predicted_document_count = 10; + */ + protected $predicted_document_count = 0; + /** + * The amount of documents with a ground truth occurrence. + * + * Generated from protobuf field int32 ground_truth_document_count = 11; + */ + protected $ground_truth_document_count = 0; + /** + * The amount of true positives. + * + * Generated from protobuf field int32 true_positives_count = 6; + */ + protected $true_positives_count = 0; + /** + * The amount of false positives. + * + * Generated from protobuf field int32 false_positives_count = 7; + */ + protected $false_positives_count = 0; + /** + * The amount of false negatives. + * + * Generated from protobuf field int32 false_negatives_count = 8; + */ + protected $false_negatives_count = 0; + /** + * The amount of documents that had an occurrence of this label. + * + * Generated from protobuf field int32 total_documents_count = 9; + */ + protected $total_documents_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $precision + * The calculated precision. + * @type float $recall + * The calculated recall. + * @type float $f1_score + * The calculated f1 score. + * @type int $predicted_occurrences_count + * The amount of occurrences in predicted documents. + * @type int $ground_truth_occurrences_count + * The amount of occurrences in ground truth documents. + * @type int $predicted_document_count + * The amount of documents with a predicted occurrence. + * @type int $ground_truth_document_count + * The amount of documents with a ground truth occurrence. + * @type int $true_positives_count + * The amount of true positives. + * @type int $false_positives_count + * The amount of false positives. + * @type int $false_negatives_count + * The amount of false negatives. + * @type int $total_documents_count + * The amount of documents that had an occurrence of this label. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Evaluation::initOnce(); + parent::__construct($data); + } + + /** + * The calculated precision. + * + * Generated from protobuf field float precision = 1; + * @return float + */ + public function getPrecision() + { + return $this->precision; + } + + /** + * The calculated precision. + * + * Generated from protobuf field float precision = 1; + * @param float $var + * @return $this + */ + public function setPrecision($var) + { + GPBUtil::checkFloat($var); + $this->precision = $var; + + return $this; + } + + /** + * The calculated recall. + * + * Generated from protobuf field float recall = 2; + * @return float + */ + public function getRecall() + { + return $this->recall; + } + + /** + * The calculated recall. + * + * Generated from protobuf field float recall = 2; + * @param float $var + * @return $this + */ + public function setRecall($var) + { + GPBUtil::checkFloat($var); + $this->recall = $var; + + return $this; + } + + /** + * The calculated f1 score. + * + * Generated from protobuf field float f1_score = 3; + * @return float + */ + public function getF1Score() + { + return $this->f1_score; + } + + /** + * The calculated f1 score. + * + * Generated from protobuf field float f1_score = 3; + * @param float $var + * @return $this + */ + public function setF1Score($var) + { + GPBUtil::checkFloat($var); + $this->f1_score = $var; + + return $this; + } + + /** + * The amount of occurrences in predicted documents. + * + * Generated from protobuf field int32 predicted_occurrences_count = 4; + * @return int + */ + public function getPredictedOccurrencesCount() + { + return $this->predicted_occurrences_count; + } + + /** + * The amount of occurrences in predicted documents. + * + * Generated from protobuf field int32 predicted_occurrences_count = 4; + * @param int $var + * @return $this + */ + public function setPredictedOccurrencesCount($var) + { + GPBUtil::checkInt32($var); + $this->predicted_occurrences_count = $var; + + return $this; + } + + /** + * The amount of occurrences in ground truth documents. + * + * Generated from protobuf field int32 ground_truth_occurrences_count = 5; + * @return int + */ + public function getGroundTruthOccurrencesCount() + { + return $this->ground_truth_occurrences_count; + } + + /** + * The amount of occurrences in ground truth documents. + * + * Generated from protobuf field int32 ground_truth_occurrences_count = 5; + * @param int $var + * @return $this + */ + public function setGroundTruthOccurrencesCount($var) + { + GPBUtil::checkInt32($var); + $this->ground_truth_occurrences_count = $var; + + return $this; + } + + /** + * The amount of documents with a predicted occurrence. + * + * Generated from protobuf field int32 predicted_document_count = 10; + * @return int + */ + public function getPredictedDocumentCount() + { + return $this->predicted_document_count; + } + + /** + * The amount of documents with a predicted occurrence. + * + * Generated from protobuf field int32 predicted_document_count = 10; + * @param int $var + * @return $this + */ + public function setPredictedDocumentCount($var) + { + GPBUtil::checkInt32($var); + $this->predicted_document_count = $var; + + return $this; + } + + /** + * The amount of documents with a ground truth occurrence. + * + * Generated from protobuf field int32 ground_truth_document_count = 11; + * @return int + */ + public function getGroundTruthDocumentCount() + { + return $this->ground_truth_document_count; + } + + /** + * The amount of documents with a ground truth occurrence. + * + * Generated from protobuf field int32 ground_truth_document_count = 11; + * @param int $var + * @return $this + */ + public function setGroundTruthDocumentCount($var) + { + GPBUtil::checkInt32($var); + $this->ground_truth_document_count = $var; + + return $this; + } + + /** + * The amount of true positives. + * + * Generated from protobuf field int32 true_positives_count = 6; + * @return int + */ + public function getTruePositivesCount() + { + return $this->true_positives_count; + } + + /** + * The amount of true positives. + * + * Generated from protobuf field int32 true_positives_count = 6; + * @param int $var + * @return $this + */ + public function setTruePositivesCount($var) + { + GPBUtil::checkInt32($var); + $this->true_positives_count = $var; + + return $this; + } + + /** + * The amount of false positives. + * + * Generated from protobuf field int32 false_positives_count = 7; + * @return int + */ + public function getFalsePositivesCount() + { + return $this->false_positives_count; + } + + /** + * The amount of false positives. + * + * Generated from protobuf field int32 false_positives_count = 7; + * @param int $var + * @return $this + */ + public function setFalsePositivesCount($var) + { + GPBUtil::checkInt32($var); + $this->false_positives_count = $var; + + return $this; + } + + /** + * The amount of false negatives. + * + * Generated from protobuf field int32 false_negatives_count = 8; + * @return int + */ + public function getFalseNegativesCount() + { + return $this->false_negatives_count; + } + + /** + * The amount of false negatives. + * + * Generated from protobuf field int32 false_negatives_count = 8; + * @param int $var + * @return $this + */ + public function setFalseNegativesCount($var) + { + GPBUtil::checkInt32($var); + $this->false_negatives_count = $var; + + return $this; + } + + /** + * The amount of documents that had an occurrence of this label. + * + * Generated from protobuf field int32 total_documents_count = 9; + * @return int + */ + public function getTotalDocumentsCount() + { + return $this->total_documents_count; + } + + /** + * The amount of documents that had an occurrence of this label. + * + * Generated from protobuf field int32 total_documents_count = 9; + * @param int $var + * @return $this + */ + public function setTotalDocumentsCount($var) + { + GPBUtil::checkInt32($var); + $this->total_documents_count = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Metrics::class, \Google\Cloud\DocumentAI\V1\Evaluation_Metrics::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/MultiConfidenceMetrics.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/MultiConfidenceMetrics.php new file mode 100644 index 000000000000..5fddfea94ab2 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/MultiConfidenceMetrics.php @@ -0,0 +1,290 @@ +google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics + */ +class MultiConfidenceMetrics extends \Google\Protobuf\Internal\Message +{ + /** + * Metrics across confidence levels with fuzzy matching enabled. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics confidence_level_metrics = 1; + */ + private $confidence_level_metrics; + /** + * Metrics across confidence levels with only exact matching. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics confidence_level_metrics_exact = 4; + */ + private $confidence_level_metrics_exact; + /** + * The calculated area under the precision recall curve (AUPRC), computed by + * integrating over all confidence thresholds. + * + * Generated from protobuf field float auprc = 2; + */ + protected $auprc = 0.0; + /** + * The Estimated Calibration Error (ECE) of the confidence of the predicted + * entities. + * + * Generated from protobuf field float estimated_calibration_error = 3; + */ + protected $estimated_calibration_error = 0.0; + /** + * The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching + * only. + * + * Generated from protobuf field float auprc_exact = 5; + */ + protected $auprc_exact = 0.0; + /** + * The ECE for the predicted entities with fuzzy matching disabled, i.e., + * exact matching only. + * + * Generated from protobuf field float estimated_calibration_error_exact = 6; + */ + protected $estimated_calibration_error_exact = 0.0; + /** + * The metrics type for the label. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType metrics_type = 7; + */ + protected $metrics_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\Evaluation\ConfidenceLevelMetrics>|\Google\Protobuf\Internal\RepeatedField $confidence_level_metrics + * Metrics across confidence levels with fuzzy matching enabled. + * @type array<\Google\Cloud\DocumentAI\V1\Evaluation\ConfidenceLevelMetrics>|\Google\Protobuf\Internal\RepeatedField $confidence_level_metrics_exact + * Metrics across confidence levels with only exact matching. + * @type float $auprc + * The calculated area under the precision recall curve (AUPRC), computed by + * integrating over all confidence thresholds. + * @type float $estimated_calibration_error + * The Estimated Calibration Error (ECE) of the confidence of the predicted + * entities. + * @type float $auprc_exact + * The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching + * only. + * @type float $estimated_calibration_error_exact + * The ECE for the predicted entities with fuzzy matching disabled, i.e., + * exact matching only. + * @type int $metrics_type + * The metrics type for the label. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Evaluation::initOnce(); + parent::__construct($data); + } + + /** + * Metrics across confidence levels with fuzzy matching enabled. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics confidence_level_metrics = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConfidenceLevelMetrics() + { + return $this->confidence_level_metrics; + } + + /** + * Metrics across confidence levels with fuzzy matching enabled. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics confidence_level_metrics = 1; + * @param array<\Google\Cloud\DocumentAI\V1\Evaluation\ConfidenceLevelMetrics>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConfidenceLevelMetrics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Evaluation\ConfidenceLevelMetrics::class); + $this->confidence_level_metrics = $arr; + + return $this; + } + + /** + * Metrics across confidence levels with only exact matching. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics confidence_level_metrics_exact = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConfidenceLevelMetricsExact() + { + return $this->confidence_level_metrics_exact; + } + + /** + * Metrics across confidence levels with only exact matching. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics confidence_level_metrics_exact = 4; + * @param array<\Google\Cloud\DocumentAI\V1\Evaluation\ConfidenceLevelMetrics>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConfidenceLevelMetricsExact($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Evaluation\ConfidenceLevelMetrics::class); + $this->confidence_level_metrics_exact = $arr; + + return $this; + } + + /** + * The calculated area under the precision recall curve (AUPRC), computed by + * integrating over all confidence thresholds. + * + * Generated from protobuf field float auprc = 2; + * @return float + */ + public function getAuprc() + { + return $this->auprc; + } + + /** + * The calculated area under the precision recall curve (AUPRC), computed by + * integrating over all confidence thresholds. + * + * Generated from protobuf field float auprc = 2; + * @param float $var + * @return $this + */ + public function setAuprc($var) + { + GPBUtil::checkFloat($var); + $this->auprc = $var; + + return $this; + } + + /** + * The Estimated Calibration Error (ECE) of the confidence of the predicted + * entities. + * + * Generated from protobuf field float estimated_calibration_error = 3; + * @return float + */ + public function getEstimatedCalibrationError() + { + return $this->estimated_calibration_error; + } + + /** + * The Estimated Calibration Error (ECE) of the confidence of the predicted + * entities. + * + * Generated from protobuf field float estimated_calibration_error = 3; + * @param float $var + * @return $this + */ + public function setEstimatedCalibrationError($var) + { + GPBUtil::checkFloat($var); + $this->estimated_calibration_error = $var; + + return $this; + } + + /** + * The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching + * only. + * + * Generated from protobuf field float auprc_exact = 5; + * @return float + */ + public function getAuprcExact() + { + return $this->auprc_exact; + } + + /** + * The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching + * only. + * + * Generated from protobuf field float auprc_exact = 5; + * @param float $var + * @return $this + */ + public function setAuprcExact($var) + { + GPBUtil::checkFloat($var); + $this->auprc_exact = $var; + + return $this; + } + + /** + * The ECE for the predicted entities with fuzzy matching disabled, i.e., + * exact matching only. + * + * Generated from protobuf field float estimated_calibration_error_exact = 6; + * @return float + */ + public function getEstimatedCalibrationErrorExact() + { + return $this->estimated_calibration_error_exact; + } + + /** + * The ECE for the predicted entities with fuzzy matching disabled, i.e., + * exact matching only. + * + * Generated from protobuf field float estimated_calibration_error_exact = 6; + * @param float $var + * @return $this + */ + public function setEstimatedCalibrationErrorExact($var) + { + GPBUtil::checkFloat($var); + $this->estimated_calibration_error_exact = $var; + + return $this; + } + + /** + * The metrics type for the label. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType metrics_type = 7; + * @return int + */ + public function getMetricsType() + { + return $this->metrics_type; + } + + /** + * The metrics type for the label. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType metrics_type = 7; + * @param int $var + * @return $this + */ + public function setMetricsType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\Evaluation\MultiConfidenceMetrics\MetricsType::class); + $this->metrics_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MultiConfidenceMetrics::class, \Google\Cloud\DocumentAI\V1\Evaluation_MultiConfidenceMetrics::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/MultiConfidenceMetrics/MetricsType.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/MultiConfidenceMetrics/MetricsType.php new file mode 100644 index 000000000000..d48051e88622 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Evaluation/MultiConfidenceMetrics/MetricsType.php @@ -0,0 +1,63 @@ +google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType + */ +class MetricsType +{ + /** + * The metrics type is unspecified. By default, metrics without a + * particular specification are for leaf entity types (i.e., top-level + * entity types without child types, or child types which are not + * parent types themselves). + * + * Generated from protobuf enum METRICS_TYPE_UNSPECIFIED = 0; + */ + const METRICS_TYPE_UNSPECIFIED = 0; + /** + * Indicates whether metrics for this particular label type represent an + * aggregate of metrics for other types instead of being based on actual + * TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf) + * entity types are an aggregate of metrics for their children. + * + * Generated from protobuf enum AGGREGATE = 1; + */ + const AGGREGATE = 1; + + private static $valueToName = [ + self::METRICS_TYPE_UNSPECIFIED => 'METRICS_TYPE_UNSPECIFIED', + self::AGGREGATE => 'AGGREGATE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MetricsType::class, \Google\Cloud\DocumentAI\V1\Evaluation_MultiConfidenceMetrics_MetricsType::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluationReference.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluationReference.php new file mode 100644 index 000000000000..4e86a056e7f1 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/EvaluationReference.php @@ -0,0 +1,189 @@ +google.cloud.documentai.v1.EvaluationReference + */ +class EvaluationReference extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the Long Running Operation for the evaluation. + * + * Generated from protobuf field string operation = 1; + */ + protected $operation = ''; + /** + * The resource name of the evaluation. + * + * Generated from protobuf field string evaluation = 2 [(.google.api.resource_reference) = { + */ + protected $evaluation = ''; + /** + * An aggregate of the statistics for the evaluation with fuzzy matching on. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Metrics aggregate_metrics = 4; + */ + protected $aggregate_metrics = null; + /** + * An aggregate of the statistics for the evaluation with fuzzy matching off. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Metrics aggregate_metrics_exact = 5; + */ + protected $aggregate_metrics_exact = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $operation + * The resource name of the Long Running Operation for the evaluation. + * @type string $evaluation + * The resource name of the evaluation. + * @type \Google\Cloud\DocumentAI\V1\Evaluation\Metrics $aggregate_metrics + * An aggregate of the statistics for the evaluation with fuzzy matching on. + * @type \Google\Cloud\DocumentAI\V1\Evaluation\Metrics $aggregate_metrics_exact + * An aggregate of the statistics for the evaluation with fuzzy matching off. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Evaluation::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the Long Running Operation for the evaluation. + * + * Generated from protobuf field string operation = 1; + * @return string + */ + public function getOperation() + { + return $this->operation; + } + + /** + * The resource name of the Long Running Operation for the evaluation. + * + * Generated from protobuf field string operation = 1; + * @param string $var + * @return $this + */ + public function setOperation($var) + { + GPBUtil::checkString($var, True); + $this->operation = $var; + + return $this; + } + + /** + * The resource name of the evaluation. + * + * Generated from protobuf field string evaluation = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getEvaluation() + { + return $this->evaluation; + } + + /** + * The resource name of the evaluation. + * + * Generated from protobuf field string evaluation = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEvaluation($var) + { + GPBUtil::checkString($var, True); + $this->evaluation = $var; + + return $this; + } + + /** + * An aggregate of the statistics for the evaluation with fuzzy matching on. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Metrics aggregate_metrics = 4; + * @return \Google\Cloud\DocumentAI\V1\Evaluation\Metrics|null + */ + public function getAggregateMetrics() + { + return $this->aggregate_metrics; + } + + public function hasAggregateMetrics() + { + return isset($this->aggregate_metrics); + } + + public function clearAggregateMetrics() + { + unset($this->aggregate_metrics); + } + + /** + * An aggregate of the statistics for the evaluation with fuzzy matching on. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Metrics aggregate_metrics = 4; + * @param \Google\Cloud\DocumentAI\V1\Evaluation\Metrics $var + * @return $this + */ + public function setAggregateMetrics($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Evaluation\Metrics::class); + $this->aggregate_metrics = $var; + + return $this; + } + + /** + * An aggregate of the statistics for the evaluation with fuzzy matching off. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Metrics aggregate_metrics_exact = 5; + * @return \Google\Cloud\DocumentAI\V1\Evaluation\Metrics|null + */ + public function getAggregateMetricsExact() + { + return $this->aggregate_metrics_exact; + } + + public function hasAggregateMetricsExact() + { + return isset($this->aggregate_metrics_exact); + } + + public function clearAggregateMetricsExact() + { + unset($this->aggregate_metrics_exact); + } + + /** + * An aggregate of the statistics for the evaluation with fuzzy matching off. + * + * Generated from protobuf field .google.cloud.documentai.v1.Evaluation.Metrics aggregate_metrics_exact = 5; + * @param \Google\Cloud\DocumentAI\V1\Evaluation\Metrics $var + * @return $this + */ + public function setAggregateMetricsExact($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Evaluation\Metrics::class); + $this->aggregate_metrics_exact = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/FetchProcessorTypesRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/FetchProcessorTypesRequest.php new file mode 100644 index 000000000000..f16e7109954b --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/FetchProcessorTypesRequest.php @@ -0,0 +1,89 @@ +google.cloud.documentai.v1.FetchProcessorTypesRequest + */ +class FetchProcessorTypesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + + /** + * @param string $parent Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. Please see + * {@see DocumentProcessorServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\FetchProcessorTypesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/FetchProcessorTypesResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/FetchProcessorTypesResponse.php new file mode 100644 index 000000000000..dd5747eca369 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/FetchProcessorTypesResponse.php @@ -0,0 +1,69 @@ +google.cloud.documentai.v1.FetchProcessorTypesResponse + */ +class FetchProcessorTypesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of processor types. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorType processor_types = 1; + */ + private $processor_types; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\ProcessorType>|\Google\Protobuf\Internal\RepeatedField $processor_types + * The list of processor types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The list of processor types. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorType processor_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProcessorTypes() + { + return $this->processor_types; + } + + /** + * The list of processor types. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorType processor_types = 1; + * @param array<\Google\Cloud\DocumentAI\V1\ProcessorType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProcessorTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\ProcessorType::class); + $this->processor_types = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GcsDocument.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GcsDocument.php new file mode 100644 index 000000000000..29eb74b4cdad --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GcsDocument.php @@ -0,0 +1,101 @@ +google.cloud.documentai.v1.GcsDocument + */ +class GcsDocument extends \Google\Protobuf\Internal\Message +{ + /** + * The Cloud Storage object uri. + * + * Generated from protobuf field string gcs_uri = 1; + */ + protected $gcs_uri = ''; + /** + * An IANA MIME type (RFC6838) of the content. + * + * Generated from protobuf field string mime_type = 2; + */ + protected $mime_type = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcs_uri + * The Cloud Storage object uri. + * @type string $mime_type + * An IANA MIME type (RFC6838) of the content. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * The Cloud Storage object uri. + * + * Generated from protobuf field string gcs_uri = 1; + * @return string + */ + public function getGcsUri() + { + return $this->gcs_uri; + } + + /** + * The Cloud Storage object uri. + * + * Generated from protobuf field string gcs_uri = 1; + * @param string $var + * @return $this + */ + public function setGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->gcs_uri = $var; + + return $this; + } + + /** + * An IANA MIME type (RFC6838) of the content. + * + * Generated from protobuf field string mime_type = 2; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * An IANA MIME type (RFC6838) of the content. + * + * Generated from protobuf field string mime_type = 2; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GcsDocuments.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GcsDocuments.php new file mode 100644 index 000000000000..c23bdc383d2f --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GcsDocuments.php @@ -0,0 +1,67 @@ +google.cloud.documentai.v1.GcsDocuments + */ +class GcsDocuments extends \Google\Protobuf\Internal\Message +{ + /** + * The list of documents. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.GcsDocument documents = 1; + */ + private $documents; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\GcsDocument>|\Google\Protobuf\Internal\RepeatedField $documents + * The list of documents. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * The list of documents. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.GcsDocument documents = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDocuments() + { + return $this->documents; + } + + /** + * The list of documents. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.GcsDocument documents = 1; + * @param array<\Google\Cloud\DocumentAI\V1\GcsDocument>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDocuments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\GcsDocument::class); + $this->documents = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GcsPrefix.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GcsPrefix.php new file mode 100644 index 000000000000..47f0c4f619e3 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GcsPrefix.php @@ -0,0 +1,67 @@ +google.cloud.documentai.v1.GcsPrefix + */ +class GcsPrefix extends \Google\Protobuf\Internal\Message +{ + /** + * The URI prefix. + * + * Generated from protobuf field string gcs_uri_prefix = 1; + */ + protected $gcs_uri_prefix = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcs_uri_prefix + * The URI prefix. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * The URI prefix. + * + * Generated from protobuf field string gcs_uri_prefix = 1; + * @return string + */ + public function getGcsUriPrefix() + { + return $this->gcs_uri_prefix; + } + + /** + * The URI prefix. + * + * Generated from protobuf field string gcs_uri_prefix = 1; + * @param string $var + * @return $this + */ + public function setGcsUriPrefix($var) + { + GPBUtil::checkString($var, True); + $this->gcs_uri_prefix = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetEvaluationRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetEvaluationRequest.php new file mode 100644 index 000000000000..6f2655e51233 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetEvaluationRequest.php @@ -0,0 +1,91 @@ +google.cloud.documentai.v1.GetEvaluationRequest + */ +class GetEvaluationRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the + * [Evaluation][google.cloud.documentai.v1.Evaluation] to get. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the + * [Evaluation][google.cloud.documentai.v1.Evaluation] to get. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}` + * Please see {@see DocumentProcessorServiceClient::evaluationName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\GetEvaluationRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the + * [Evaluation][google.cloud.documentai.v1.Evaluation] to get. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the + * [Evaluation][google.cloud.documentai.v1.Evaluation] to get. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the + * [Evaluation][google.cloud.documentai.v1.Evaluation] to get. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetProcessorRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetProcessorRequest.php new file mode 100644 index 000000000000..400d45124693 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetProcessorRequest.php @@ -0,0 +1,83 @@ +google.cloud.documentai.v1.GetProcessorRequest + */ +class GetProcessorRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The processor resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The processor resource name. Please see + * {@see DocumentProcessorServiceClient::processorName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\GetProcessorRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The processor resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The processor resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The processor resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetProcessorTypeRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetProcessorTypeRequest.php new file mode 100644 index 000000000000..3ff3084db365 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetProcessorTypeRequest.php @@ -0,0 +1,83 @@ +google.cloud.documentai.v1.GetProcessorTypeRequest + */ +class GetProcessorTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The processor type resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The processor type resource name. Please see + * {@see DocumentProcessorServiceClient::processorTypeName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\GetProcessorTypeRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The processor type resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The processor type resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The processor type resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetProcessorVersionRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetProcessorVersionRequest.php new file mode 100644 index 000000000000..626c849fa822 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/GetProcessorVersionRequest.php @@ -0,0 +1,83 @@ +google.cloud.documentai.v1.GetProcessorVersionRequest + */ +class GetProcessorVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The processor resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The processor resource name. Please see + * {@see DocumentProcessorServiceClient::processorVersionName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\GetProcessorVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The processor resource name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The processor resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The processor resource name. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/HumanReviewStatus.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/HumanReviewStatus.php new file mode 100644 index 000000000000..7c7e15d95aac --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/HumanReviewStatus.php @@ -0,0 +1,155 @@ +google.cloud.documentai.v1.HumanReviewStatus + */ +class HumanReviewStatus extends \Google\Protobuf\Internal\Message +{ + /** + * The state of human review on the processing request. + * + * Generated from protobuf field .google.cloud.documentai.v1.HumanReviewStatus.State state = 1; + */ + protected $state = 0; + /** + * A message providing more details about the human review state. + * + * Generated from protobuf field string state_message = 2; + */ + protected $state_message = ''; + /** + * The name of the operation triggered by the processed document. This field + * is populated only when the + * [state][google.cloud.documentai.v1.HumanReviewStatus.state] is + * `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as + * the long-running operation returned by + * [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]. + * + * Generated from protobuf field string human_review_operation = 3; + */ + protected $human_review_operation = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of human review on the processing request. + * @type string $state_message + * A message providing more details about the human review state. + * @type string $human_review_operation + * The name of the operation triggered by the processed document. This field + * is populated only when the + * [state][google.cloud.documentai.v1.HumanReviewStatus.state] is + * `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as + * the long-running operation returned by + * [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The state of human review on the processing request. + * + * Generated from protobuf field .google.cloud.documentai.v1.HumanReviewStatus.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of human review on the processing request. + * + * Generated from protobuf field .google.cloud.documentai.v1.HumanReviewStatus.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\HumanReviewStatus\State::class); + $this->state = $var; + + return $this; + } + + /** + * A message providing more details about the human review state. + * + * Generated from protobuf field string state_message = 2; + * @return string + */ + public function getStateMessage() + { + return $this->state_message; + } + + /** + * A message providing more details about the human review state. + * + * Generated from protobuf field string state_message = 2; + * @param string $var + * @return $this + */ + public function setStateMessage($var) + { + GPBUtil::checkString($var, True); + $this->state_message = $var; + + return $this; + } + + /** + * The name of the operation triggered by the processed document. This field + * is populated only when the + * [state][google.cloud.documentai.v1.HumanReviewStatus.state] is + * `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as + * the long-running operation returned by + * [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]. + * + * Generated from protobuf field string human_review_operation = 3; + * @return string + */ + public function getHumanReviewOperation() + { + return $this->human_review_operation; + } + + /** + * The name of the operation triggered by the processed document. This field + * is populated only when the + * [state][google.cloud.documentai.v1.HumanReviewStatus.state] is + * `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as + * the long-running operation returned by + * [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]. + * + * Generated from protobuf field string human_review_operation = 3; + * @param string $var + * @return $this + */ + public function setHumanReviewOperation($var) + { + GPBUtil::checkString($var, True); + $this->human_review_operation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/HumanReviewStatus/State.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/HumanReviewStatus/State.php new file mode 100644 index 000000000000..1c83b273fd8c --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/HumanReviewStatus/State.php @@ -0,0 +1,82 @@ +google.cloud.documentai.v1.HumanReviewStatus.State + */ +class State +{ + /** + * Human review state is unspecified. Most likely due to an internal error. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Human review is skipped for the document. This can happen because human + * review isn't enabled on the processor or the processing request has + * been set to skip this document. + * + * Generated from protobuf enum SKIPPED = 1; + */ + const SKIPPED = 1; + /** + * Human review validation is triggered and passed, so no review is needed. + * + * Generated from protobuf enum VALIDATION_PASSED = 2; + */ + const VALIDATION_PASSED = 2; + /** + * Human review validation is triggered and the document is under review. + * + * Generated from protobuf enum IN_PROGRESS = 3; + */ + const IN_PROGRESS = 3; + /** + * Some error happened during triggering human review, see the + * [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message] + * for details. + * + * Generated from protobuf enum ERROR = 4; + */ + const ERROR = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::SKIPPED => 'SKIPPED', + self::VALIDATION_PASSED => 'VALIDATION_PASSED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::ERROR => 'ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\DocumentAI\V1\HumanReviewStatus_State::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListEvaluationsRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListEvaluationsRequest.php new file mode 100644 index 000000000000..807389a4e80c --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListEvaluationsRequest.php @@ -0,0 +1,177 @@ +google.cloud.documentai.v1.ListEvaluationsRequest + */ +class ListEvaluationsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list + * evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The standard list page size. + * If unspecified, at most `5` evaluations are returned. + * The maximum value is `100`. Values above `100` are coerced to `100`. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListEvaluations` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list + * evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * Please see {@see DocumentProcessorServiceClient::processorVersionName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\ListEvaluationsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list + * evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @type int $page_size + * The standard list page size. + * If unspecified, at most `5` evaluations are returned. + * The maximum value is `100`. Values above `100` are coerced to `100`. + * @type string $page_token + * A page token, received from a previous `ListEvaluations` call. + * Provide this to retrieve the subsequent page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list + * evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list + * evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The standard list page size. + * If unspecified, at most `5` evaluations are returned. + * The maximum value is `100`. Values above `100` are coerced to `100`. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The standard list page size. + * If unspecified, at most `5` evaluations are returned. + * The maximum value is `100`. Values above `100` are coerced to `100`. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListEvaluations` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListEvaluations` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListEvaluationsResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListEvaluationsResponse.php new file mode 100644 index 000000000000..50718a220119 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListEvaluationsResponse.php @@ -0,0 +1,105 @@ +google.cloud.documentai.v1.ListEvaluationsResponse + */ +class ListEvaluationsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The evaluations requested. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Evaluation evaluations = 1; + */ + private $evaluations; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\Evaluation>|\Google\Protobuf\Internal\RepeatedField $evaluations + * The evaluations requested. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The evaluations requested. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Evaluation evaluations = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEvaluations() + { + return $this->evaluations; + } + + /** + * The evaluations requested. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Evaluation evaluations = 1; + * @param array<\Google\Cloud\DocumentAI\V1\Evaluation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEvaluations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Evaluation::class); + $this->evaluations = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorTypesRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorTypesRequest.php new file mode 100644 index 000000000000..8376d2a3fdbd --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorTypesRequest.php @@ -0,0 +1,165 @@ +google.cloud.documentai.v1.ListProcessorTypesRequest + */ +class ListProcessorTypesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of processor types to return. + * If unspecified, at most `100` processor types will be returned. + * The maximum value is `500`. Values above `500` will be coerced to `500`. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * Used to retrieve the next page of results, empty if at the end of the list. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. Please see + * {@see DocumentProcessorServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\ListProcessorTypesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * @type int $page_size + * The maximum number of processor types to return. + * If unspecified, at most `100` processor types will be returned. + * The maximum value is `500`. Values above `500` will be coerced to `500`. + * @type string $page_token + * Used to retrieve the next page of results, empty if at the end of the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of processor types to return. + * If unspecified, at most `100` processor types will be returned. + * The maximum value is `500`. Values above `500` will be coerced to `500`. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of processor types to return. + * If unspecified, at most `100` processor types will be returned. + * The maximum value is `500`. Values above `500` will be coerced to `500`. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Used to retrieve the next page of results, empty if at the end of the list. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Used to retrieve the next page of results, empty if at the end of the list. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorTypesResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorTypesResponse.php new file mode 100644 index 000000000000..2ab8fbb8ffa7 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorTypesResponse.php @@ -0,0 +1,103 @@ +google.cloud.documentai.v1.ListProcessorTypesResponse + */ +class ListProcessorTypesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The processor types. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorType processor_types = 1; + */ + private $processor_types; + /** + * Points to the next page, otherwise empty. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\ProcessorType>|\Google\Protobuf\Internal\RepeatedField $processor_types + * The processor types. + * @type string $next_page_token + * Points to the next page, otherwise empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The processor types. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorType processor_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProcessorTypes() + { + return $this->processor_types; + } + + /** + * The processor types. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorType processor_types = 1; + * @param array<\Google\Cloud\DocumentAI\V1\ProcessorType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProcessorTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\ProcessorType::class); + $this->processor_types = $arr; + + return $this; + } + + /** + * Points to the next page, otherwise empty. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Points to the next page, otherwise empty. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorVersionsRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorVersionsRequest.php new file mode 100644 index 000000000000..2eb32ebdb5cd --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorVersionsRequest.php @@ -0,0 +1,171 @@ +google.cloud.documentai.v1.ListProcessorVersionsRequest + */ +class ListProcessorVersionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent (project, location and processor) to list all + * versions. Format: + * `projects/{project}/locations/{location}/processors/{processor}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of processor versions to return. + * If unspecified, at most `10` processor versions will be returned. + * The maximum value is `20`. Values above `20` will be coerced to `20`. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent (project, location and processor) to list all + * versions. Format: + * `projects/{project}/locations/{location}/processors/{processor}` + * Please see {@see DocumentProcessorServiceClient::processorName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\ListProcessorVersionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent (project, location and processor) to list all + * versions. Format: + * `projects/{project}/locations/{location}/processors/{processor}` + * @type int $page_size + * The maximum number of processor versions to return. + * If unspecified, at most `10` processor versions will be returned. + * The maximum value is `20`. Values above `20` will be coerced to `20`. + * @type string $page_token + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent (project, location and processor) to list all + * versions. Format: + * `projects/{project}/locations/{location}/processors/{processor}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent (project, location and processor) to list all + * versions. Format: + * `projects/{project}/locations/{location}/processors/{processor}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of processor versions to return. + * If unspecified, at most `10` processor versions will be returned. + * The maximum value is `20`. Values above `20` will be coerced to `20`. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of processor versions to return. + * If unspecified, at most `10` processor versions will be returned. + * The maximum value is `20`. Values above `20` will be coerced to `20`. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorVersionsResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorVersionsResponse.php new file mode 100644 index 000000000000..b5b6b73704e1 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorVersionsResponse.php @@ -0,0 +1,103 @@ +google.cloud.documentai.v1.ListProcessorVersionsResponse + */ +class ListProcessorVersionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of processors. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorVersion processor_versions = 1; + */ + private $processor_versions; + /** + * Points to the next processor, otherwise empty. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\ProcessorVersion>|\Google\Protobuf\Internal\RepeatedField $processor_versions + * The list of processors. + * @type string $next_page_token + * Points to the next processor, otherwise empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The list of processors. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorVersion processor_versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProcessorVersions() + { + return $this->processor_versions; + } + + /** + * The list of processors. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorVersion processor_versions = 1; + * @param array<\Google\Cloud\DocumentAI\V1\ProcessorVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProcessorVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\ProcessorVersion::class); + $this->processor_versions = $arr; + + return $this; + } + + /** + * Points to the next processor, otherwise empty. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Points to the next processor, otherwise empty. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorsRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorsRequest.php new file mode 100644 index 000000000000..2b4335b85480 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorsRequest.php @@ -0,0 +1,166 @@ +google.cloud.documentai.v1.ListProcessorsRequest + */ +class ListProcessorsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent (project and location) which owns this collection of + * Processors. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * 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`. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent (project and location) which owns this collection of + * Processors. Format: `projects/{project}/locations/{location}` + * Please see {@see DocumentProcessorServiceClient::locationName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\ListProcessorsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent (project and location) which owns this collection of + * Processors. Format: `projects/{project}/locations/{location}` + * @type int $page_size + * 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`. + * @type string $page_token + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent (project and location) which owns this collection of + * Processors. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent (project and location) which owns this collection of + * Processors. Format: `projects/{project}/locations/{location}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * 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`. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * 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`. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorsResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorsResponse.php new file mode 100644 index 000000000000..c92d36758eb2 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ListProcessorsResponse.php @@ -0,0 +1,103 @@ +google.cloud.documentai.v1.ListProcessorsResponse + */ +class ListProcessorsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of processors. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Processor processors = 1; + */ + private $processors; + /** + * Points to the next processor, otherwise empty. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DocumentAI\V1\Processor>|\Google\Protobuf\Internal\RepeatedField $processors + * The list of processors. + * @type string $next_page_token + * Points to the next processor, otherwise empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The list of processors. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Processor processors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProcessors() + { + return $this->processors; + } + + /** + * The list of processors. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.Processor processors = 1; + * @param array<\Google\Cloud\DocumentAI\V1\Processor>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProcessors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\Processor::class); + $this->processors = $arr; + + return $this; + } + + /** + * Points to the next processor, otherwise empty. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Points to the next processor, otherwise empty. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/NormalizedVertex.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/NormalizedVertex.php new file mode 100644 index 000000000000..a283c6a9b7c2 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/NormalizedVertex.php @@ -0,0 +1,103 @@ +google.cloud.documentai.v1.NormalizedVertex + */ +class NormalizedVertex extends \Google\Protobuf\Internal\Message +{ + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + */ + protected $x = 0.0; + /** + * Y coordinate (starts from the top of the image). + * + * Generated from protobuf field float y = 2; + */ + protected $y = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $x + * X coordinate. + * @type float $y + * Y coordinate (starts from the top of the image). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @return float + */ + public function getX() + { + return $this->x; + } + + /** + * X coordinate. + * + * Generated from protobuf field float x = 1; + * @param float $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkFloat($var); + $this->x = $var; + + return $this; + } + + /** + * Y coordinate (starts from the top of the image). + * + * Generated from protobuf field float y = 2; + * @return float + */ + public function getY() + { + return $this->y; + } + + /** + * Y coordinate (starts from the top of the image). + * + * Generated from protobuf field float y = 2; + * @param float $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkFloat($var); + $this->y = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/OcrConfig.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/OcrConfig.php new file mode 100644 index 000000000000..1e66d8578938 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/OcrConfig.php @@ -0,0 +1,378 @@ +google.cloud.documentai.v1.OcrConfig + */ +class OcrConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Hints for the OCR model. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig.Hints hints = 2; + */ + protected $hints = null; + /** + * Enables special handling for PDFs with existing text information. Results + * in better text extraction quality in such PDF inputs. + * + * Generated from protobuf field bool enable_native_pdf_parsing = 3; + */ + protected $enable_native_pdf_parsing = false; + /** + * Enables intelligent document quality scores after OCR. Can help with + * diagnosing why OCR responses are of poor quality for a given input. + * Adds additional latency comparable to regular OCR to the process call. + * + * Generated from protobuf field bool enable_image_quality_scores = 4; + */ + protected $enable_image_quality_scores = false; + /** + * A list of advanced OCR options to further fine-tune OCR behavior. Current + * valid values are: + * - `legacy_layout`: a heuristics layout detection algorithm, which serves as + * an alternative to the current ML-based layout detection algorithm. + * Customers can choose the best suitable layout algorithm based on their + * situation. + * + * Generated from protobuf field repeated string advanced_ocr_options = 5; + */ + private $advanced_ocr_options; + /** + * Includes symbol level OCR information if set to true. + * + * Generated from protobuf field bool enable_symbol = 6; + */ + protected $enable_symbol = false; + /** + * Turn on font identification model and return font style information. + * Deprecated, use + * [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info] + * instead. + * + * Generated from protobuf field bool compute_style_info = 8 [deprecated = true]; + * @deprecated + */ + protected $compute_style_info = false; + /** + * Turn off character box detector in OCR engine. Character box detection is + * enabled by default in OCR 2.0+ processors. + * + * Generated from protobuf field bool disable_character_boxes_detection = 10; + */ + protected $disable_character_boxes_detection = false; + /** + * Configurations for premium OCR features. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig.PremiumFeatures premium_features = 11; + */ + protected $premium_features = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\OcrConfig\Hints $hints + * Hints for the OCR model. + * @type bool $enable_native_pdf_parsing + * Enables special handling for PDFs with existing text information. Results + * in better text extraction quality in such PDF inputs. + * @type bool $enable_image_quality_scores + * Enables intelligent document quality scores after OCR. Can help with + * diagnosing why OCR responses are of poor quality for a given input. + * Adds additional latency comparable to regular OCR to the process call. + * @type array|\Google\Protobuf\Internal\RepeatedField $advanced_ocr_options + * A list of advanced OCR options to further fine-tune OCR behavior. Current + * valid values are: + * - `legacy_layout`: a heuristics layout detection algorithm, which serves as + * an alternative to the current ML-based layout detection algorithm. + * Customers can choose the best suitable layout algorithm based on their + * situation. + * @type bool $enable_symbol + * Includes symbol level OCR information if set to true. + * @type bool $compute_style_info + * Turn on font identification model and return font style information. + * Deprecated, use + * [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info] + * instead. + * @type bool $disable_character_boxes_detection + * Turn off character box detector in OCR engine. Character box detection is + * enabled by default in OCR 2.0+ processors. + * @type \Google\Cloud\DocumentAI\V1\OcrConfig\PremiumFeatures $premium_features + * Configurations for premium OCR features. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * Hints for the OCR model. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig.Hints hints = 2; + * @return \Google\Cloud\DocumentAI\V1\OcrConfig\Hints|null + */ + public function getHints() + { + return $this->hints; + } + + public function hasHints() + { + return isset($this->hints); + } + + public function clearHints() + { + unset($this->hints); + } + + /** + * Hints for the OCR model. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig.Hints hints = 2; + * @param \Google\Cloud\DocumentAI\V1\OcrConfig\Hints $var + * @return $this + */ + public function setHints($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\OcrConfig\Hints::class); + $this->hints = $var; + + return $this; + } + + /** + * Enables special handling for PDFs with existing text information. Results + * in better text extraction quality in such PDF inputs. + * + * Generated from protobuf field bool enable_native_pdf_parsing = 3; + * @return bool + */ + public function getEnableNativePdfParsing() + { + return $this->enable_native_pdf_parsing; + } + + /** + * Enables special handling for PDFs with existing text information. Results + * in better text extraction quality in such PDF inputs. + * + * Generated from protobuf field bool enable_native_pdf_parsing = 3; + * @param bool $var + * @return $this + */ + public function setEnableNativePdfParsing($var) + { + GPBUtil::checkBool($var); + $this->enable_native_pdf_parsing = $var; + + return $this; + } + + /** + * Enables intelligent document quality scores after OCR. Can help with + * diagnosing why OCR responses are of poor quality for a given input. + * Adds additional latency comparable to regular OCR to the process call. + * + * Generated from protobuf field bool enable_image_quality_scores = 4; + * @return bool + */ + public function getEnableImageQualityScores() + { + return $this->enable_image_quality_scores; + } + + /** + * Enables intelligent document quality scores after OCR. Can help with + * diagnosing why OCR responses are of poor quality for a given input. + * Adds additional latency comparable to regular OCR to the process call. + * + * Generated from protobuf field bool enable_image_quality_scores = 4; + * @param bool $var + * @return $this + */ + public function setEnableImageQualityScores($var) + { + GPBUtil::checkBool($var); + $this->enable_image_quality_scores = $var; + + return $this; + } + + /** + * A list of advanced OCR options to further fine-tune OCR behavior. Current + * valid values are: + * - `legacy_layout`: a heuristics layout detection algorithm, which serves as + * an alternative to the current ML-based layout detection algorithm. + * Customers can choose the best suitable layout algorithm based on their + * situation. + * + * Generated from protobuf field repeated string advanced_ocr_options = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAdvancedOcrOptions() + { + return $this->advanced_ocr_options; + } + + /** + * A list of advanced OCR options to further fine-tune OCR behavior. Current + * valid values are: + * - `legacy_layout`: a heuristics layout detection algorithm, which serves as + * an alternative to the current ML-based layout detection algorithm. + * Customers can choose the best suitable layout algorithm based on their + * situation. + * + * Generated from protobuf field repeated string advanced_ocr_options = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAdvancedOcrOptions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->advanced_ocr_options = $arr; + + return $this; + } + + /** + * Includes symbol level OCR information if set to true. + * + * Generated from protobuf field bool enable_symbol = 6; + * @return bool + */ + public function getEnableSymbol() + { + return $this->enable_symbol; + } + + /** + * Includes symbol level OCR information if set to true. + * + * Generated from protobuf field bool enable_symbol = 6; + * @param bool $var + * @return $this + */ + public function setEnableSymbol($var) + { + GPBUtil::checkBool($var); + $this->enable_symbol = $var; + + return $this; + } + + /** + * Turn on font identification model and return font style information. + * Deprecated, use + * [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info] + * instead. + * + * Generated from protobuf field bool compute_style_info = 8 [deprecated = true]; + * @return bool + * @deprecated + */ + public function getComputeStyleInfo() + { + @trigger_error('compute_style_info is deprecated.', E_USER_DEPRECATED); + return $this->compute_style_info; + } + + /** + * Turn on font identification model and return font style information. + * Deprecated, use + * [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info] + * instead. + * + * Generated from protobuf field bool compute_style_info = 8 [deprecated = true]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setComputeStyleInfo($var) + { + @trigger_error('compute_style_info is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->compute_style_info = $var; + + return $this; + } + + /** + * Turn off character box detector in OCR engine. Character box detection is + * enabled by default in OCR 2.0+ processors. + * + * Generated from protobuf field bool disable_character_boxes_detection = 10; + * @return bool + */ + public function getDisableCharacterBoxesDetection() + { + return $this->disable_character_boxes_detection; + } + + /** + * Turn off character box detector in OCR engine. Character box detection is + * enabled by default in OCR 2.0+ processors. + * + * Generated from protobuf field bool disable_character_boxes_detection = 10; + * @param bool $var + * @return $this + */ + public function setDisableCharacterBoxesDetection($var) + { + GPBUtil::checkBool($var); + $this->disable_character_boxes_detection = $var; + + return $this; + } + + /** + * Configurations for premium OCR features. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig.PremiumFeatures premium_features = 11; + * @return \Google\Cloud\DocumentAI\V1\OcrConfig\PremiumFeatures|null + */ + public function getPremiumFeatures() + { + return $this->premium_features; + } + + public function hasPremiumFeatures() + { + return isset($this->premium_features); + } + + public function clearPremiumFeatures() + { + unset($this->premium_features); + } + + /** + * Configurations for premium OCR features. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig.PremiumFeatures premium_features = 11; + * @param \Google\Cloud\DocumentAI\V1\OcrConfig\PremiumFeatures $var + * @return $this + */ + public function setPremiumFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\OcrConfig\PremiumFeatures::class); + $this->premium_features = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/OcrConfig/Hints.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/OcrConfig/Hints.php new file mode 100644 index 000000000000..1e0be646e760 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/OcrConfig/Hints.php @@ -0,0 +1,90 @@ +google.cloud.documentai.v1.OcrConfig.Hints + */ +class Hints extends \Google\Protobuf\Internal\Message +{ + /** + * List of BCP-47 language codes to use for OCR. In most cases, not + * specifying it yields the best results since it enables automatic language + * detection. For languages based on the Latin alphabet, setting hints is + * not needed. In rare cases, when the language of the text in the + * image is known, setting a hint will help get better results (although it + * will be a significant hindrance if the hint is wrong). + * + * Generated from protobuf field repeated string language_hints = 1; + */ + private $language_hints; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $language_hints + * List of BCP-47 language codes to use for OCR. In most cases, not + * specifying it yields the best results since it enables automatic language + * detection. For languages based on the Latin alphabet, setting hints is + * not needed. In rare cases, when the language of the text in the + * image is known, setting a hint will help get better results (although it + * will be a significant hindrance if the hint is wrong). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * List of BCP-47 language codes to use for OCR. In most cases, not + * specifying it yields the best results since it enables automatic language + * detection. For languages based on the Latin alphabet, setting hints is + * not needed. In rare cases, when the language of the text in the + * image is known, setting a hint will help get better results (although it + * will be a significant hindrance if the hint is wrong). + * + * Generated from protobuf field repeated string language_hints = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLanguageHints() + { + return $this->language_hints; + } + + /** + * List of BCP-47 language codes to use for OCR. In most cases, not + * specifying it yields the best results since it enables automatic language + * detection. For languages based on the Latin alphabet, setting hints is + * not needed. In rare cases, when the language of the text in the + * image is known, setting a hint will help get better results (although it + * will be a significant hindrance if the hint is wrong). + * + * Generated from protobuf field repeated string language_hints = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLanguageHints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->language_hints = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Hints::class, \Google\Cloud\DocumentAI\V1\OcrConfig_Hints::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/OcrConfig/PremiumFeatures.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/OcrConfig/PremiumFeatures.php new file mode 100644 index 000000000000..fa113c66f0ab --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/OcrConfig/PremiumFeatures.php @@ -0,0 +1,142 @@ +google.cloud.documentai.v1.OcrConfig.PremiumFeatures + */ +class PremiumFeatures extends \Google\Protobuf\Internal\Message +{ + /** + * Turn on selection mark detector in OCR engine. Only available in OCR 2.0+ + * processors. + * + * Generated from protobuf field bool enable_selection_mark_detection = 3; + */ + protected $enable_selection_mark_detection = false; + /** + * Turn on font identification model and return font style information. + * + * Generated from protobuf field bool compute_style_info = 4; + */ + protected $compute_style_info = false; + /** + * Turn on the model that can extract LaTeX math formulas. + * + * Generated from protobuf field bool enable_math_ocr = 5; + */ + protected $enable_math_ocr = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enable_selection_mark_detection + * Turn on selection mark detector in OCR engine. Only available in OCR 2.0+ + * processors. + * @type bool $compute_style_info + * Turn on font identification model and return font style information. + * @type bool $enable_math_ocr + * Turn on the model that can extract LaTeX math formulas. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * Turn on selection mark detector in OCR engine. Only available in OCR 2.0+ + * processors. + * + * Generated from protobuf field bool enable_selection_mark_detection = 3; + * @return bool + */ + public function getEnableSelectionMarkDetection() + { + return $this->enable_selection_mark_detection; + } + + /** + * Turn on selection mark detector in OCR engine. Only available in OCR 2.0+ + * processors. + * + * Generated from protobuf field bool enable_selection_mark_detection = 3; + * @param bool $var + * @return $this + */ + public function setEnableSelectionMarkDetection($var) + { + GPBUtil::checkBool($var); + $this->enable_selection_mark_detection = $var; + + return $this; + } + + /** + * Turn on font identification model and return font style information. + * + * Generated from protobuf field bool compute_style_info = 4; + * @return bool + */ + public function getComputeStyleInfo() + { + return $this->compute_style_info; + } + + /** + * Turn on font identification model and return font style information. + * + * Generated from protobuf field bool compute_style_info = 4; + * @param bool $var + * @return $this + */ + public function setComputeStyleInfo($var) + { + GPBUtil::checkBool($var); + $this->compute_style_info = $var; + + return $this; + } + + /** + * Turn on the model that can extract LaTeX math formulas. + * + * Generated from protobuf field bool enable_math_ocr = 5; + * @return bool + */ + public function getEnableMathOcr() + { + return $this->enable_math_ocr; + } + + /** + * Turn on the model that can extract LaTeX math formulas. + * + * Generated from protobuf field bool enable_math_ocr = 5; + * @param bool $var + * @return $this + */ + public function setEnableMathOcr($var) + { + GPBUtil::checkBool($var); + $this->enable_math_ocr = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(PremiumFeatures::class, \Google\Cloud\DocumentAI\V1\OcrConfig_PremiumFeatures::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessOptions.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessOptions.php new file mode 100644 index 000000000000..76bc938ad9b3 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessOptions.php @@ -0,0 +1,192 @@ +google.cloud.documentai.v1.ProcessOptions + */ +class ProcessOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Only applicable to `OCR_PROCESSOR`. Returns error if set on other + * processor types. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig ocr_config = 1; + */ + protected $ocr_config = null; + protected $page_range; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\ProcessOptions\IndividualPageSelector $individual_page_selector + * Which pages to process (1-indexed). + * @type int $from_start + * Only process certain pages from the start. Process all if the document + * has fewer pages. + * @type int $from_end + * Only process certain pages from the end, same as above. + * @type \Google\Cloud\DocumentAI\V1\OcrConfig $ocr_config + * Only applicable to `OCR_PROCESSOR`. Returns error if set on other + * processor types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Which pages to process (1-indexed). + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector individual_page_selector = 5; + * @return \Google\Cloud\DocumentAI\V1\ProcessOptions\IndividualPageSelector|null + */ + public function getIndividualPageSelector() + { + return $this->readOneof(5); + } + + public function hasIndividualPageSelector() + { + return $this->hasOneof(5); + } + + /** + * Which pages to process (1-indexed). + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector individual_page_selector = 5; + * @param \Google\Cloud\DocumentAI\V1\ProcessOptions\IndividualPageSelector $var + * @return $this + */ + public function setIndividualPageSelector($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\ProcessOptions\IndividualPageSelector::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Only process certain pages from the start. Process all if the document + * has fewer pages. + * + * Generated from protobuf field int32 from_start = 6; + * @return int + */ + public function getFromStart() + { + return $this->readOneof(6); + } + + public function hasFromStart() + { + return $this->hasOneof(6); + } + + /** + * Only process certain pages from the start. Process all if the document + * has fewer pages. + * + * Generated from protobuf field int32 from_start = 6; + * @param int $var + * @return $this + */ + public function setFromStart($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Only process certain pages from the end, same as above. + * + * Generated from protobuf field int32 from_end = 7; + * @return int + */ + public function getFromEnd() + { + return $this->readOneof(7); + } + + public function hasFromEnd() + { + return $this->hasOneof(7); + } + + /** + * Only process certain pages from the end, same as above. + * + * Generated from protobuf field int32 from_end = 7; + * @param int $var + * @return $this + */ + public function setFromEnd($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Only applicable to `OCR_PROCESSOR`. Returns error if set on other + * processor types. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig ocr_config = 1; + * @return \Google\Cloud\DocumentAI\V1\OcrConfig|null + */ + public function getOcrConfig() + { + return $this->ocr_config; + } + + public function hasOcrConfig() + { + return isset($this->ocr_config); + } + + public function clearOcrConfig() + { + unset($this->ocr_config); + } + + /** + * Only applicable to `OCR_PROCESSOR`. Returns error if set on other + * processor types. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig ocr_config = 1; + * @param \Google\Cloud\DocumentAI\V1\OcrConfig $var + * @return $this + */ + public function setOcrConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\OcrConfig::class); + $this->ocr_config = $var; + + return $this; + } + + /** + * @return string + */ + public function getPageRange() + { + return $this->whichOneof("page_range"); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessOptions/IndividualPageSelector.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessOptions/IndividualPageSelector.php new file mode 100644 index 000000000000..40cdb2cac3df --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessOptions/IndividualPageSelector.php @@ -0,0 +1,70 @@ +google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector + */ +class IndividualPageSelector extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Indices of the pages (starting from 1). + * + * Generated from protobuf field repeated int32 pages = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $pages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $pages + * Optional. Indices of the pages (starting from 1). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Indices of the pages (starting from 1). + * + * Generated from protobuf field repeated int32 pages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPages() + { + return $this->pages; + } + + /** + * Optional. Indices of the pages (starting from 1). + * + * Generated from protobuf field repeated int32 pages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->pages = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IndividualPageSelector::class, \Google\Cloud\DocumentAI\V1\ProcessOptions_IndividualPageSelector::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessRequest.php new file mode 100644 index 000000000000..c68135e656e7 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessRequest.php @@ -0,0 +1,373 @@ +google.cloud.documentai.v1.ProcessRequest + */ +class ProcessRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] + * to use for processing. If a + * [Processor][google.cloud.documentai.v1.Processor] is specified, the server + * will use its [default + * version][google.cloud.documentai.v1.Processor.default_processor_version]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Whether human review should be skipped for this request. Default to + * `false`. + * + * Generated from protobuf field bool skip_human_review = 3; + */ + protected $skip_human_review = false; + /** + * Specifies which fields to include in the + * [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document] + * output. Only supports top-level document and pages field, so it must be in + * the form of `{document_field_name}` or `pages.{page_field_name}`. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 6; + */ + protected $field_mask = null; + /** + * Inference-time options for the process API + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions process_options = 7; + */ + protected $process_options = null; + protected $source; + + /** + * @param string $name Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] + * to use for processing. If a + * [Processor][google.cloud.documentai.v1.Processor] is specified, the server + * will use its [default + * version][google.cloud.documentai.v1.Processor.default_processor_version]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * @return \Google\Cloud\DocumentAI\V1\ProcessRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document $inline_document + * An inline document proto. + * @type \Google\Cloud\DocumentAI\V1\RawDocument $raw_document + * A raw document content (bytes). + * @type \Google\Cloud\DocumentAI\V1\GcsDocument $gcs_document + * A raw document on Google Cloud Storage. + * @type string $name + * Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] + * to use for processing. If a + * [Processor][google.cloud.documentai.v1.Processor] is specified, the server + * will use its [default + * version][google.cloud.documentai.v1.Processor.default_processor_version]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @type bool $skip_human_review + * Whether human review should be skipped for this request. Default to + * `false`. + * @type \Google\Protobuf\FieldMask $field_mask + * Specifies which fields to include in the + * [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document] + * output. Only supports top-level document and pages field, so it must be in + * the form of `{document_field_name}` or `pages.{page_field_name}`. + * @type \Google\Cloud\DocumentAI\V1\ProcessOptions $process_options + * Inference-time options for the process API + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * An inline document proto. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document inline_document = 4; + * @return \Google\Cloud\DocumentAI\V1\Document|null + */ + public function getInlineDocument() + { + return $this->readOneof(4); + } + + public function hasInlineDocument() + { + return $this->hasOneof(4); + } + + /** + * An inline document proto. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document inline_document = 4; + * @param \Google\Cloud\DocumentAI\V1\Document $var + * @return $this + */ + public function setInlineDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * A raw document content (bytes). + * + * Generated from protobuf field .google.cloud.documentai.v1.RawDocument raw_document = 5; + * @return \Google\Cloud\DocumentAI\V1\RawDocument|null + */ + public function getRawDocument() + { + return $this->readOneof(5); + } + + public function hasRawDocument() + { + return $this->hasOneof(5); + } + + /** + * A raw document content (bytes). + * + * Generated from protobuf field .google.cloud.documentai.v1.RawDocument raw_document = 5; + * @param \Google\Cloud\DocumentAI\V1\RawDocument $var + * @return $this + */ + public function setRawDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\RawDocument::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * A raw document on Google Cloud Storage. + * + * Generated from protobuf field .google.cloud.documentai.v1.GcsDocument gcs_document = 8; + * @return \Google\Cloud\DocumentAI\V1\GcsDocument|null + */ + public function getGcsDocument() + { + return $this->readOneof(8); + } + + public function hasGcsDocument() + { + return $this->hasOneof(8); + } + + /** + * A raw document on Google Cloud Storage. + * + * Generated from protobuf field .google.cloud.documentai.v1.GcsDocument gcs_document = 8; + * @param \Google\Cloud\DocumentAI\V1\GcsDocument $var + * @return $this + */ + public function setGcsDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\GcsDocument::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] + * to use for processing. If a + * [Processor][google.cloud.documentai.v1.Processor] is specified, the server + * will use its [default + * version][google.cloud.documentai.v1.Processor.default_processor_version]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] + * to use for processing. If a + * [Processor][google.cloud.documentai.v1.Processor] is specified, the server + * will use its [default + * version][google.cloud.documentai.v1.Processor.default_processor_version]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Whether human review should be skipped for this request. Default to + * `false`. + * + * Generated from protobuf field bool skip_human_review = 3; + * @return bool + */ + public function getSkipHumanReview() + { + return $this->skip_human_review; + } + + /** + * Whether human review should be skipped for this request. Default to + * `false`. + * + * Generated from protobuf field bool skip_human_review = 3; + * @param bool $var + * @return $this + */ + public function setSkipHumanReview($var) + { + GPBUtil::checkBool($var); + $this->skip_human_review = $var; + + return $this; + } + + /** + * Specifies which fields to include in the + * [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document] + * output. Only supports top-level document and pages field, so it must be in + * the form of `{document_field_name}` or `pages.{page_field_name}`. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 6; + * @return \Google\Protobuf\FieldMask|null + */ + public function getFieldMask() + { + return $this->field_mask; + } + + public function hasFieldMask() + { + return isset($this->field_mask); + } + + public function clearFieldMask() + { + unset($this->field_mask); + } + + /** + * Specifies which fields to include in the + * [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document] + * output. Only supports top-level document and pages field, so it must be in + * the form of `{document_field_name}` or `pages.{page_field_name}`. + * + * Generated from protobuf field .google.protobuf.FieldMask field_mask = 6; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setFieldMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->field_mask = $var; + + return $this; + } + + /** + * Inference-time options for the process API + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions process_options = 7; + * @return \Google\Cloud\DocumentAI\V1\ProcessOptions|null + */ + public function getProcessOptions() + { + return $this->process_options; + } + + public function hasProcessOptions() + { + return isset($this->process_options); + } + + public function clearProcessOptions() + { + unset($this->process_options); + } + + /** + * Inference-time options for the process API + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions process_options = 7; + * @param \Google\Cloud\DocumentAI\V1\ProcessOptions $var + * @return $this + */ + public function setProcessOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\ProcessOptions::class); + $this->process_options = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessResponse.php new file mode 100644 index 000000000000..cb8f9c7b8c36 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessResponse.php @@ -0,0 +1,127 @@ +google.cloud.documentai.v1.ProcessResponse + */ +class ProcessResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The document payload, will populate fields based on the processor's + * behavior. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document document = 1; + */ + protected $document = null; + /** + * The status of human review on the processed document. + * + * Generated from protobuf field .google.cloud.documentai.v1.HumanReviewStatus human_review_status = 3; + */ + protected $human_review_status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document $document + * The document payload, will populate fields based on the processor's + * behavior. + * @type \Google\Cloud\DocumentAI\V1\HumanReviewStatus $human_review_status + * The status of human review on the processed document. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The document payload, will populate fields based on the processor's + * behavior. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document document = 1; + * @return \Google\Cloud\DocumentAI\V1\Document|null + */ + public function getDocument() + { + return $this->document; + } + + public function hasDocument() + { + return isset($this->document); + } + + public function clearDocument() + { + unset($this->document); + } + + /** + * The document payload, will populate fields based on the processor's + * behavior. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document document = 1; + * @param \Google\Cloud\DocumentAI\V1\Document $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document::class); + $this->document = $var; + + return $this; + } + + /** + * The status of human review on the processed document. + * + * Generated from protobuf field .google.cloud.documentai.v1.HumanReviewStatus human_review_status = 3; + * @return \Google\Cloud\DocumentAI\V1\HumanReviewStatus|null + */ + public function getHumanReviewStatus() + { + return $this->human_review_status; + } + + public function hasHumanReviewStatus() + { + return isset($this->human_review_status); + } + + public function clearHumanReviewStatus() + { + unset($this->human_review_status); + } + + /** + * The status of human review on the processed document. + * + * Generated from protobuf field .google.cloud.documentai.v1.HumanReviewStatus human_review_status = 3; + * @param \Google\Cloud\DocumentAI\V1\HumanReviewStatus $var + * @return $this + */ + public function setHumanReviewStatus($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\HumanReviewStatus::class); + $this->human_review_status = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Processor.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Processor.php new file mode 100644 index 000000000000..4fc4778298be --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Processor.php @@ -0,0 +1,370 @@ +google.cloud.documentai.v1.Processor + */ +class Processor extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Immutable. The resource name of the processor. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`. + * To get a list of processor types, see + * [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]. + * + * Generated from protobuf field string type = 2; + */ + protected $type = ''; + /** + * The display name of the processor. + * + * Generated from protobuf field string display_name = 3; + */ + protected $display_name = ''; + /** + * Output only. The state of the processor. + * + * Generated from protobuf field .google.cloud.documentai.v1.Processor.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $state = 0; + /** + * The default processor version. + * + * Generated from protobuf field string default_processor_version = 9 [(.google.api.resource_reference) = { + */ + protected $default_processor_version = ''; + /** + * Output only. The processor version aliases. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorVersionAlias processor_version_aliases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $processor_version_aliases; + /** + * Output only. Immutable. The http endpoint that can be called to invoke + * processing. + * + * Generated from protobuf field string process_endpoint = 6 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $process_endpoint = ''; + /** + * The time the processor was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + */ + protected $create_time = null; + /** + * The [KMS key](https://cloud.google.com/security-key-management) used for + * encryption and decryption in CMEK scenarios. + * + * Generated from protobuf field string kms_key_name = 8; + */ + protected $kms_key_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Immutable. The resource name of the processor. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * @type string $type + * The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`. + * To get a list of processor types, see + * [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]. + * @type string $display_name + * The display name of the processor. + * @type int $state + * Output only. The state of the processor. + * @type string $default_processor_version + * The default processor version. + * @type array<\Google\Cloud\DocumentAI\V1\ProcessorVersionAlias>|\Google\Protobuf\Internal\RepeatedField $processor_version_aliases + * Output only. The processor version aliases. + * @type string $process_endpoint + * Output only. Immutable. The http endpoint that can be called to invoke + * processing. + * @type \Google\Protobuf\Timestamp $create_time + * The time the processor was created. + * @type string $kms_key_name + * The [KMS key](https://cloud.google.com/security-key-management) used for + * encryption and decryption in CMEK scenarios. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Processor::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Immutable. The resource name of the processor. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Immutable. The resource name of the processor. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`. + * To get a list of processor types, see + * [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]. + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`. + * To get a list of processor types, see + * [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]. + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The display name of the processor. + * + * Generated from protobuf field string display_name = 3; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The display name of the processor. + * + * Generated from protobuf field string display_name = 3; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. The state of the processor. + * + * Generated from protobuf field .google.cloud.documentai.v1.Processor.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Output only. The state of the processor. + * + * Generated from protobuf field .google.cloud.documentai.v1.Processor.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\Processor\State::class); + $this->state = $var; + + return $this; + } + + /** + * The default processor version. + * + * Generated from protobuf field string default_processor_version = 9 [(.google.api.resource_reference) = { + * @return string + */ + public function getDefaultProcessorVersion() + { + return $this->default_processor_version; + } + + /** + * The default processor version. + * + * Generated from protobuf field string default_processor_version = 9 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDefaultProcessorVersion($var) + { + GPBUtil::checkString($var, True); + $this->default_processor_version = $var; + + return $this; + } + + /** + * Output only. The processor version aliases. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorVersionAlias processor_version_aliases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProcessorVersionAliases() + { + return $this->processor_version_aliases; + } + + /** + * Output only. The processor version aliases. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorVersionAlias processor_version_aliases = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\DocumentAI\V1\ProcessorVersionAlias>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProcessorVersionAliases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\ProcessorVersionAlias::class); + $this->processor_version_aliases = $arr; + + return $this; + } + + /** + * Output only. Immutable. The http endpoint that can be called to invoke + * processing. + * + * Generated from protobuf field string process_endpoint = 6 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getProcessEndpoint() + { + return $this->process_endpoint; + } + + /** + * Output only. Immutable. The http endpoint that can be called to invoke + * processing. + * + * Generated from protobuf field string process_endpoint = 6 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setProcessEndpoint($var) + { + GPBUtil::checkString($var, True); + $this->process_endpoint = $var; + + return $this; + } + + /** + * The time the processor was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time the processor was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The [KMS key](https://cloud.google.com/security-key-management) used for + * encryption and decryption in CMEK scenarios. + * + * Generated from protobuf field string kms_key_name = 8; + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * The [KMS key](https://cloud.google.com/security-key-management) used for + * encryption and decryption in CMEK scenarios. + * + * Generated from protobuf field string kms_key_name = 8; + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Processor/State.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Processor/State.php new file mode 100644 index 000000000000..4b15938e4a46 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Processor/State.php @@ -0,0 +1,107 @@ +google.cloud.documentai.v1.Processor.State + */ +class State +{ + /** + * The processor is in an unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The processor is enabled, i.e., has an enabled version which can + * currently serve processing requests and all the feature dependencies have + * been successfully initialized. + * + * Generated from protobuf enum ENABLED = 1; + */ + const ENABLED = 1; + /** + * The processor is disabled. + * + * Generated from protobuf enum DISABLED = 2; + */ + const DISABLED = 2; + /** + * The processor is being enabled, will become `ENABLED` if successful. + * + * Generated from protobuf enum ENABLING = 3; + */ + const ENABLING = 3; + /** + * The processor is being disabled, will become `DISABLED` if successful. + * + * Generated from protobuf enum DISABLING = 4; + */ + const DISABLING = 4; + /** + * The processor is being created, will become either `ENABLED` (for + * successful creation) or `FAILED` (for failed ones). + * Once a processor is in this state, it can then be used for document + * processing, but the feature dependencies of the processor might not be + * fully created yet. + * + * Generated from protobuf enum CREATING = 5; + */ + const CREATING = 5; + /** + * The processor failed during creation or initialization of feature + * dependencies. The user should delete the processor and recreate one as + * all the functionalities of the processor are disabled. + * + * Generated from protobuf enum FAILED = 6; + */ + const FAILED = 6; + /** + * The processor is being deleted, will be removed if successful. + * + * Generated from protobuf enum DELETING = 7; + */ + const DELETING = 7; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::ENABLED => 'ENABLED', + self::DISABLED => 'DISABLED', + self::ENABLING => 'ENABLING', + self::DISABLING => 'DISABLING', + self::CREATING => 'CREATING', + self::FAILED => 'FAILED', + self::DELETING => 'DELETING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\DocumentAI\V1\Processor_State::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorType.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorType.php new file mode 100644 index 000000000000..2ee18d7a9f8a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorType.php @@ -0,0 +1,280 @@ +google.cloud.documentai.v1.ProcessorType + */ +class ProcessorType extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the processor type. + * Format: `projects/{project}/processorTypes/{processor_type}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`. + * + * Generated from protobuf field string type = 2; + */ + protected $type = ''; + /** + * The processor category, used by UI to group processor types. + * + * Generated from protobuf field string category = 3; + */ + protected $category = ''; + /** + * The locations in which this processor is available. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorType.LocationInfo available_locations = 4; + */ + private $available_locations; + /** + * Whether the processor type allows creation. If true, users can create a + * processor of this processor type. Otherwise, users need to request access. + * + * Generated from protobuf field bool allow_creation = 6; + */ + protected $allow_creation = false; + /** + * Launch stage of the processor type + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 8; + */ + protected $launch_stage = 0; + /** + * A set of Cloud Storage URIs of sample documents for this processor. + * + * Generated from protobuf field repeated string sample_document_uris = 9; + */ + private $sample_document_uris; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the processor type. + * Format: `projects/{project}/processorTypes/{processor_type}` + * @type string $type + * The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`. + * @type string $category + * The processor category, used by UI to group processor types. + * @type array<\Google\Cloud\DocumentAI\V1\ProcessorType\LocationInfo>|\Google\Protobuf\Internal\RepeatedField $available_locations + * The locations in which this processor is available. + * @type bool $allow_creation + * Whether the processor type allows creation. If true, users can create a + * processor of this processor type. Otherwise, users need to request access. + * @type int $launch_stage + * Launch stage of the processor type + * @type array|\Google\Protobuf\Internal\RepeatedField $sample_document_uris + * A set of Cloud Storage URIs of sample documents for this processor. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\ProcessorType::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the processor type. + * Format: `projects/{project}/processorTypes/{processor_type}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the processor type. + * Format: `projects/{project}/processorTypes/{processor_type}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`. + * + * Generated from protobuf field string type = 2; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`. + * + * Generated from protobuf field string type = 2; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The processor category, used by UI to group processor types. + * + * Generated from protobuf field string category = 3; + * @return string + */ + public function getCategory() + { + return $this->category; + } + + /** + * The processor category, used by UI to group processor types. + * + * Generated from protobuf field string category = 3; + * @param string $var + * @return $this + */ + public function setCategory($var) + { + GPBUtil::checkString($var, True); + $this->category = $var; + + return $this; + } + + /** + * The locations in which this processor is available. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorType.LocationInfo available_locations = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAvailableLocations() + { + return $this->available_locations; + } + + /** + * The locations in which this processor is available. + * + * Generated from protobuf field repeated .google.cloud.documentai.v1.ProcessorType.LocationInfo available_locations = 4; + * @param array<\Google\Cloud\DocumentAI\V1\ProcessorType\LocationInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAvailableLocations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DocumentAI\V1\ProcessorType\LocationInfo::class); + $this->available_locations = $arr; + + return $this; + } + + /** + * Whether the processor type allows creation. If true, users can create a + * processor of this processor type. Otherwise, users need to request access. + * + * Generated from protobuf field bool allow_creation = 6; + * @return bool + */ + public function getAllowCreation() + { + return $this->allow_creation; + } + + /** + * Whether the processor type allows creation. If true, users can create a + * processor of this processor type. Otherwise, users need to request access. + * + * Generated from protobuf field bool allow_creation = 6; + * @param bool $var + * @return $this + */ + public function setAllowCreation($var) + { + GPBUtil::checkBool($var); + $this->allow_creation = $var; + + return $this; + } + + /** + * Launch stage of the processor type + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 8; + * @return int + */ + public function getLaunchStage() + { + return $this->launch_stage; + } + + /** + * Launch stage of the processor type + * + * Generated from protobuf field .google.api.LaunchStage launch_stage = 8; + * @param int $var + * @return $this + */ + public function setLaunchStage($var) + { + GPBUtil::checkEnum($var, \Google\Api\LaunchStage::class); + $this->launch_stage = $var; + + return $this; + } + + /** + * A set of Cloud Storage URIs of sample documents for this processor. + * + * Generated from protobuf field repeated string sample_document_uris = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSampleDocumentUris() + { + return $this->sample_document_uris; + } + + /** + * A set of Cloud Storage URIs of sample documents for this processor. + * + * Generated from protobuf field repeated string sample_document_uris = 9; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSampleDocumentUris($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->sample_document_uris = $arr; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorType/LocationInfo.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorType/LocationInfo.php new file mode 100644 index 000000000000..aff1d4c1493b --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorType/LocationInfo.php @@ -0,0 +1,74 @@ +google.cloud.documentai.v1.ProcessorType.LocationInfo + */ +class LocationInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The location ID. For supported locations, refer to [regional and + * multi-regional support](/document-ai/docs/regions). + * + * Generated from protobuf field string location_id = 1; + */ + protected $location_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $location_id + * The location ID. For supported locations, refer to [regional and + * multi-regional support](/document-ai/docs/regions). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\ProcessorType::initOnce(); + parent::__construct($data); + } + + /** + * The location ID. For supported locations, refer to [regional and + * multi-regional support](/document-ai/docs/regions). + * + * Generated from protobuf field string location_id = 1; + * @return string + */ + public function getLocationId() + { + return $this->location_id; + } + + /** + * The location ID. For supported locations, refer to [regional and + * multi-regional support](/document-ai/docs/regions). + * + * Generated from protobuf field string location_id = 1; + * @param string $var + * @return $this + */ + public function setLocationId($var) + { + GPBUtil::checkString($var, True); + $this->location_id = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(LocationInfo::class, \Google\Cloud\DocumentAI\V1\ProcessorType_LocationInfo::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersion.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersion.php new file mode 100644 index 000000000000..688faae44cb7 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersion.php @@ -0,0 +1,424 @@ +google.cloud.documentai.v1.ProcessorVersion + */ +class ProcessorVersion extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the processor version. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}` + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The display name of the processor version. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * The schema of the processor version. Describes the output. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema document_schema = 12; + */ + protected $document_schema = null; + /** + * The state of the processor version. + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessorVersion.State state = 6; + */ + protected $state = 0; + /** + * The time the processor version was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + */ + protected $create_time = null; + /** + * The most recently invoked evaluation for the processor version. + * + * Generated from protobuf field .google.cloud.documentai.v1.EvaluationReference latest_evaluation = 8; + */ + protected $latest_evaluation = null; + /** + * The KMS key name used for encryption. + * + * Generated from protobuf field string kms_key_name = 9; + */ + protected $kms_key_name = ''; + /** + * The KMS key version with which data is encrypted. + * + * Generated from protobuf field string kms_key_version_name = 10; + */ + protected $kms_key_version_name = ''; + /** + * Output only. Denotes that this `ProcessorVersion` is managed by Google. + * + * Generated from protobuf field bool google_managed = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $google_managed = false; + /** + * If set, information about the eventual deprecation of this version. + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo deprecation_info = 13; + */ + protected $deprecation_info = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name of the processor version. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}` + * @type string $display_name + * The display name of the processor version. + * @type \Google\Cloud\DocumentAI\V1\DocumentSchema $document_schema + * The schema of the processor version. Describes the output. + * @type int $state + * The state of the processor version. + * @type \Google\Protobuf\Timestamp $create_time + * The time the processor version was created. + * @type \Google\Cloud\DocumentAI\V1\EvaluationReference $latest_evaluation + * The most recently invoked evaluation for the processor version. + * @type string $kms_key_name + * The KMS key name used for encryption. + * @type string $kms_key_version_name + * The KMS key version with which data is encrypted. + * @type bool $google_managed + * Output only. Denotes that this `ProcessorVersion` is managed by Google. + * @type \Google\Cloud\DocumentAI\V1\ProcessorVersion\DeprecationInfo $deprecation_info + * If set, information about the eventual deprecation of this version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Processor::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the processor version. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}` + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name of the processor version. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}` + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The display name of the processor version. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The display name of the processor version. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The schema of the processor version. Describes the output. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema document_schema = 12; + * @return \Google\Cloud\DocumentAI\V1\DocumentSchema|null + */ + public function getDocumentSchema() + { + return $this->document_schema; + } + + public function hasDocumentSchema() + { + return isset($this->document_schema); + } + + public function clearDocumentSchema() + { + unset($this->document_schema); + } + + /** + * The schema of the processor version. Describes the output. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema document_schema = 12; + * @param \Google\Cloud\DocumentAI\V1\DocumentSchema $var + * @return $this + */ + public function setDocumentSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\DocumentSchema::class); + $this->document_schema = $var; + + return $this; + } + + /** + * The state of the processor version. + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessorVersion.State state = 6; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the processor version. + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessorVersion.State state = 6; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\ProcessorVersion\State::class); + $this->state = $var; + + return $this; + } + + /** + * The time the processor version was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The time the processor version was created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * The most recently invoked evaluation for the processor version. + * + * Generated from protobuf field .google.cloud.documentai.v1.EvaluationReference latest_evaluation = 8; + * @return \Google\Cloud\DocumentAI\V1\EvaluationReference|null + */ + public function getLatestEvaluation() + { + return $this->latest_evaluation; + } + + public function hasLatestEvaluation() + { + return isset($this->latest_evaluation); + } + + public function clearLatestEvaluation() + { + unset($this->latest_evaluation); + } + + /** + * The most recently invoked evaluation for the processor version. + * + * Generated from protobuf field .google.cloud.documentai.v1.EvaluationReference latest_evaluation = 8; + * @param \Google\Cloud\DocumentAI\V1\EvaluationReference $var + * @return $this + */ + public function setLatestEvaluation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\EvaluationReference::class); + $this->latest_evaluation = $var; + + return $this; + } + + /** + * The KMS key name used for encryption. + * + * Generated from protobuf field string kms_key_name = 9; + * @return string + */ + public function getKmsKeyName() + { + return $this->kms_key_name; + } + + /** + * The KMS key name used for encryption. + * + * Generated from protobuf field string kms_key_name = 9; + * @param string $var + * @return $this + */ + public function setKmsKeyName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_name = $var; + + return $this; + } + + /** + * The KMS key version with which data is encrypted. + * + * Generated from protobuf field string kms_key_version_name = 10; + * @return string + */ + public function getKmsKeyVersionName() + { + return $this->kms_key_version_name; + } + + /** + * The KMS key version with which data is encrypted. + * + * Generated from protobuf field string kms_key_version_name = 10; + * @param string $var + * @return $this + */ + public function setKmsKeyVersionName($var) + { + GPBUtil::checkString($var, True); + $this->kms_key_version_name = $var; + + return $this; + } + + /** + * Output only. Denotes that this `ProcessorVersion` is managed by Google. + * + * Generated from protobuf field bool google_managed = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getGoogleManaged() + { + return $this->google_managed; + } + + /** + * Output only. Denotes that this `ProcessorVersion` is managed by Google. + * + * Generated from protobuf field bool google_managed = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setGoogleManaged($var) + { + GPBUtil::checkBool($var); + $this->google_managed = $var; + + return $this; + } + + /** + * If set, information about the eventual deprecation of this version. + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo deprecation_info = 13; + * @return \Google\Cloud\DocumentAI\V1\ProcessorVersion\DeprecationInfo|null + */ + public function getDeprecationInfo() + { + return $this->deprecation_info; + } + + public function hasDeprecationInfo() + { + return isset($this->deprecation_info); + } + + public function clearDeprecationInfo() + { + unset($this->deprecation_info); + } + + /** + * If set, information about the eventual deprecation of this version. + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo deprecation_info = 13; + * @param \Google\Cloud\DocumentAI\V1\ProcessorVersion\DeprecationInfo $var + * @return $this + */ + public function setDeprecationInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\ProcessorVersion\DeprecationInfo::class); + $this->deprecation_info = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersion/DeprecationInfo.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersion/DeprecationInfo.php new file mode 100644 index 000000000000..f6d07ebc1de2 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersion/DeprecationInfo.php @@ -0,0 +1,114 @@ +google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + */ +class DeprecationInfo extends \Google\Protobuf\Internal\Message +{ + /** + * The time at which this processor version will be deprecated. + * + * Generated from protobuf field .google.protobuf.Timestamp deprecation_time = 1; + */ + protected $deprecation_time = null; + /** + * If set, the processor version that will be used as a replacement. + * + * Generated from protobuf field string replacement_processor_version = 2 [(.google.api.resource_reference) = { + */ + protected $replacement_processor_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $deprecation_time + * The time at which this processor version will be deprecated. + * @type string $replacement_processor_version + * If set, the processor version that will be used as a replacement. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Processor::initOnce(); + parent::__construct($data); + } + + /** + * The time at which this processor version will be deprecated. + * + * Generated from protobuf field .google.protobuf.Timestamp deprecation_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeprecationTime() + { + return $this->deprecation_time; + } + + public function hasDeprecationTime() + { + return isset($this->deprecation_time); + } + + public function clearDeprecationTime() + { + unset($this->deprecation_time); + } + + /** + * The time at which this processor version will be deprecated. + * + * Generated from protobuf field .google.protobuf.Timestamp deprecation_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeprecationTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->deprecation_time = $var; + + return $this; + } + + /** + * If set, the processor version that will be used as a replacement. + * + * Generated from protobuf field string replacement_processor_version = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getReplacementProcessorVersion() + { + return $this->replacement_processor_version; + } + + /** + * If set, the processor version that will be used as a replacement. + * + * Generated from protobuf field string replacement_processor_version = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setReplacementProcessorVersion($var) + { + GPBUtil::checkString($var, True); + $this->replacement_processor_version = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DeprecationInfo::class, \Google\Cloud\DocumentAI\V1\ProcessorVersion_DeprecationInfo::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersion/State.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersion/State.php new file mode 100644 index 000000000000..3c740d1f1bb4 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersion/State.php @@ -0,0 +1,106 @@ +google.cloud.documentai.v1.ProcessorVersion.State + */ +class State +{ + /** + * The processor version is in an unspecified state. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The processor version is deployed and can be used for processing. + * + * Generated from protobuf enum DEPLOYED = 1; + */ + const DEPLOYED = 1; + /** + * The processor version is being deployed. + * + * Generated from protobuf enum DEPLOYING = 2; + */ + const DEPLOYING = 2; + /** + * The processor version is not deployed and cannot be used for processing. + * + * Generated from protobuf enum UNDEPLOYED = 3; + */ + const UNDEPLOYED = 3; + /** + * The processor version is being undeployed. + * + * Generated from protobuf enum UNDEPLOYING = 4; + */ + const UNDEPLOYING = 4; + /** + * The processor version is being created. + * + * Generated from protobuf enum CREATING = 5; + */ + const CREATING = 5; + /** + * The processor version is being deleted. + * + * Generated from protobuf enum DELETING = 6; + */ + const DELETING = 6; + /** + * The processor version failed and is in an indeterminate state. + * + * Generated from protobuf enum FAILED = 7; + */ + const FAILED = 7; + /** + * The processor version is being imported. + * + * Generated from protobuf enum IMPORTING = 8; + */ + const IMPORTING = 8; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::DEPLOYED => 'DEPLOYED', + self::DEPLOYING => 'DEPLOYING', + self::UNDEPLOYED => 'UNDEPLOYED', + self::UNDEPLOYING => 'UNDEPLOYING', + self::CREATING => 'CREATING', + self::DELETING => 'DELETING', + self::FAILED => 'FAILED', + self::IMPORTING => 'IMPORTING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\DocumentAI\V1\ProcessorVersion_State::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersionAlias.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersionAlias.php new file mode 100644 index 000000000000..704c750728bf --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ProcessorVersionAlias.php @@ -0,0 +1,101 @@ +google.cloud.documentai.v1.ProcessorVersionAlias + */ +class ProcessorVersionAlias extends \Google\Protobuf\Internal\Message +{ + /** + * The alias in the form of `processor_version` resource name. + * + * Generated from protobuf field string alias = 1; + */ + protected $alias = ''; + /** + * The resource name of aliased processor version. + * + * Generated from protobuf field string processor_version = 2 [(.google.api.resource_reference) = { + */ + protected $processor_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $alias + * The alias in the form of `processor_version` resource name. + * @type string $processor_version + * The resource name of aliased processor version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Processor::initOnce(); + parent::__construct($data); + } + + /** + * The alias in the form of `processor_version` resource name. + * + * Generated from protobuf field string alias = 1; + * @return string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * The alias in the form of `processor_version` resource name. + * + * Generated from protobuf field string alias = 1; + * @param string $var + * @return $this + */ + public function setAlias($var) + { + GPBUtil::checkString($var, True); + $this->alias = $var; + + return $this; + } + + /** + * The resource name of aliased processor version. + * + * Generated from protobuf field string processor_version = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getProcessorVersion() + { + return $this->processor_version; + } + + /** + * The resource name of aliased processor version. + * + * Generated from protobuf field string processor_version = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProcessorVersion($var) + { + GPBUtil::checkString($var, True); + $this->processor_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/RawDocument.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/RawDocument.php new file mode 100644 index 000000000000..efe1134b293f --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/RawDocument.php @@ -0,0 +1,155 @@ +google.cloud.documentai.v1.RawDocument + */ +class RawDocument extends \Google\Protobuf\Internal\Message +{ + /** + * Inline document content. + * + * Generated from protobuf field bytes content = 1; + */ + protected $content = ''; + /** + * An IANA MIME type (RFC6838) indicating the nature and format of the + * [content][google.cloud.documentai.v1.RawDocument.content]. + * + * Generated from protobuf field string mime_type = 2; + */ + protected $mime_type = ''; + /** + * The display name of the document, it supports all Unicode characters except + * the following: + * `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,` + * `~`, `=` and `:` are reserved. + * If not specified, a default ID is generated. + * + * Generated from protobuf field string display_name = 3; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * Inline document content. + * @type string $mime_type + * An IANA MIME type (RFC6838) indicating the nature and format of the + * [content][google.cloud.documentai.v1.RawDocument.content]. + * @type string $display_name + * The display name of the document, it supports all Unicode characters except + * the following: + * `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,` + * `~`, `=` and `:` are reserved. + * If not specified, a default ID is generated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * Inline document content. + * + * Generated from protobuf field bytes content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Inline document content. + * + * Generated from protobuf field bytes content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->content = $var; + + return $this; + } + + /** + * An IANA MIME type (RFC6838) indicating the nature and format of the + * [content][google.cloud.documentai.v1.RawDocument.content]. + * + * Generated from protobuf field string mime_type = 2; + * @return string + */ + public function getMimeType() + { + return $this->mime_type; + } + + /** + * An IANA MIME type (RFC6838) indicating the nature and format of the + * [content][google.cloud.documentai.v1.RawDocument.content]. + * + * Generated from protobuf field string mime_type = 2; + * @param string $var + * @return $this + */ + public function setMimeType($var) + { + GPBUtil::checkString($var, True); + $this->mime_type = $var; + + return $this; + } + + /** + * The display name of the document, it supports all Unicode characters except + * the following: + * `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,` + * `~`, `=` and `:` are reserved. + * If not specified, a default ID is generated. + * + * Generated from protobuf field string display_name = 3; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The display name of the document, it supports all Unicode characters except + * the following: + * `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,` + * `~`, `=` and `:` are reserved. + * If not specified, a default ID is generated. + * + * Generated from protobuf field string display_name = 3; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentOperationMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentOperationMetadata.php new file mode 100644 index 000000000000..e367e4513d12 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentOperationMetadata.php @@ -0,0 +1,113 @@ +google.cloud.documentai.v1.ReviewDocumentOperationMetadata + */ +class ReviewDocumentOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + */ + protected $common_metadata = null; + /** + * The Crowd Compute question ID. + * + * Generated from protobuf field string question_id = 6; + */ + protected $question_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * @type string $question_id + * The Crowd Compute question ID. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 5; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + + /** + * The Crowd Compute question ID. + * + * Generated from protobuf field string question_id = 6; + * @return string + */ + public function getQuestionId() + { + return $this->question_id; + } + + /** + * The Crowd Compute question ID. + * + * Generated from protobuf field string question_id = 6; + * @param string $var + * @return $this + */ + public function setQuestionId($var) + { + GPBUtil::checkString($var, True); + $this->question_id = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentRequest.php new file mode 100644 index 000000000000..9e4a1bf7c987 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentRequest.php @@ -0,0 +1,247 @@ +google.cloud.documentai.v1.ReviewDocumentRequest + */ +class ReviewDocumentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the + * [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the + * document will be reviewed with. + * + * Generated from protobuf field string human_review_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $human_review_config = ''; + /** + * Whether the validation should be performed on the ad-hoc review request. + * + * Generated from protobuf field bool enable_schema_validation = 3; + */ + protected $enable_schema_validation = false; + /** + * The priority of the human review task. + * + * Generated from protobuf field .google.cloud.documentai.v1.ReviewDocumentRequest.Priority priority = 5; + */ + protected $priority = 0; + /** + * The document schema of the human review task. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema document_schema = 6; + */ + protected $document_schema = null; + protected $source; + + /** + * @param string $humanReviewConfig Required. The resource name of the + * [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the + * document will be reviewed with. Please see + * {@see DocumentProcessorServiceClient::humanReviewConfigName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\ReviewDocumentRequest + * + * @experimental + */ + public static function build(string $humanReviewConfig): self + { + return (new self()) + ->setHumanReviewConfig($humanReviewConfig); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\Document $inline_document + * An inline document proto. + * @type string $human_review_config + * Required. The resource name of the + * [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the + * document will be reviewed with. + * @type bool $enable_schema_validation + * Whether the validation should be performed on the ad-hoc review request. + * @type int $priority + * The priority of the human review task. + * @type \Google\Cloud\DocumentAI\V1\DocumentSchema $document_schema + * The document schema of the human review task. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * An inline document proto. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document inline_document = 4; + * @return \Google\Cloud\DocumentAI\V1\Document|null + */ + public function getInlineDocument() + { + return $this->readOneof(4); + } + + public function hasInlineDocument() + { + return $this->hasOneof(4); + } + + /** + * An inline document proto. + * + * Generated from protobuf field .google.cloud.documentai.v1.Document inline_document = 4; + * @param \Google\Cloud\DocumentAI\V1\Document $var + * @return $this + */ + public function setInlineDocument($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\Document::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Required. The resource name of the + * [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the + * document will be reviewed with. + * + * Generated from protobuf field string human_review_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getHumanReviewConfig() + { + return $this->human_review_config; + } + + /** + * Required. The resource name of the + * [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the + * document will be reviewed with. + * + * Generated from protobuf field string human_review_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setHumanReviewConfig($var) + { + GPBUtil::checkString($var, True); + $this->human_review_config = $var; + + return $this; + } + + /** + * Whether the validation should be performed on the ad-hoc review request. + * + * Generated from protobuf field bool enable_schema_validation = 3; + * @return bool + */ + public function getEnableSchemaValidation() + { + return $this->enable_schema_validation; + } + + /** + * Whether the validation should be performed on the ad-hoc review request. + * + * Generated from protobuf field bool enable_schema_validation = 3; + * @param bool $var + * @return $this + */ + public function setEnableSchemaValidation($var) + { + GPBUtil::checkBool($var); + $this->enable_schema_validation = $var; + + return $this; + } + + /** + * The priority of the human review task. + * + * Generated from protobuf field .google.cloud.documentai.v1.ReviewDocumentRequest.Priority priority = 5; + * @return int + */ + public function getPriority() + { + return $this->priority; + } + + /** + * The priority of the human review task. + * + * Generated from protobuf field .google.cloud.documentai.v1.ReviewDocumentRequest.Priority priority = 5; + * @param int $var + * @return $this + */ + public function setPriority($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\ReviewDocumentRequest\Priority::class); + $this->priority = $var; + + return $this; + } + + /** + * The document schema of the human review task. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema document_schema = 6; + * @return \Google\Cloud\DocumentAI\V1\DocumentSchema|null + */ + public function getDocumentSchema() + { + return $this->document_schema; + } + + public function hasDocumentSchema() + { + return isset($this->document_schema); + } + + public function clearDocumentSchema() + { + unset($this->document_schema); + } + + /** + * The document schema of the human review task. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema document_schema = 6; + * @param \Google\Cloud\DocumentAI\V1\DocumentSchema $var + * @return $this + */ + public function setDocumentSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\DocumentSchema::class); + $this->document_schema = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentRequest/Priority.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentRequest/Priority.php new file mode 100644 index 000000000000..41929b863a9d --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentRequest/Priority.php @@ -0,0 +1,62 @@ +google.cloud.documentai.v1.ReviewDocumentRequest.Priority + */ +class Priority +{ + /** + * The default priority level. + * + * Generated from protobuf enum DEFAULT = 0; + */ + const PBDEFAULT = 0; + /** + * The urgent priority level. The labeling manager should allocate labeler + * resource to the urgent task queue to respect this priority level. + * + * Generated from protobuf enum URGENT = 1; + */ + const URGENT = 1; + + private static $valueToName = [ + self::PBDEFAULT => 'DEFAULT', + self::URGENT => 'URGENT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Priority::class, \Google\Cloud\DocumentAI\V1\ReviewDocumentRequest_Priority::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentResponse.php new file mode 100644 index 000000000000..660f9271b9a6 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentResponse.php @@ -0,0 +1,141 @@ +google.cloud.documentai.v1.ReviewDocumentResponse + */ +class ReviewDocumentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The Cloud Storage uri for the human reviewed document if the review is + * succeeded. + * + * Generated from protobuf field string gcs_destination = 1; + */ + protected $gcs_destination = ''; + /** + * The state of the review operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.ReviewDocumentResponse.State state = 2; + */ + protected $state = 0; + /** + * The reason why the review is rejected by reviewer. + * + * Generated from protobuf field string rejection_reason = 3; + */ + protected $rejection_reason = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcs_destination + * The Cloud Storage uri for the human reviewed document if the review is + * succeeded. + * @type int $state + * The state of the review operation. + * @type string $rejection_reason + * The reason why the review is rejected by reviewer. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The Cloud Storage uri for the human reviewed document if the review is + * succeeded. + * + * Generated from protobuf field string gcs_destination = 1; + * @return string + */ + public function getGcsDestination() + { + return $this->gcs_destination; + } + + /** + * The Cloud Storage uri for the human reviewed document if the review is + * succeeded. + * + * Generated from protobuf field string gcs_destination = 1; + * @param string $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkString($var, True); + $this->gcs_destination = $var; + + return $this; + } + + /** + * The state of the review operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.ReviewDocumentResponse.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the review operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.ReviewDocumentResponse.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\ReviewDocumentResponse\State::class); + $this->state = $var; + + return $this; + } + + /** + * The reason why the review is rejected by reviewer. + * + * Generated from protobuf field string rejection_reason = 3; + * @return string + */ + public function getRejectionReason() + { + return $this->rejection_reason; + } + + /** + * The reason why the review is rejected by reviewer. + * + * Generated from protobuf field string rejection_reason = 3; + * @param string $var + * @return $this + */ + public function setRejectionReason($var) + { + GPBUtil::checkString($var, True); + $this->rejection_reason = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentResponse/State.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentResponse/State.php new file mode 100644 index 000000000000..89dda0791451 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/ReviewDocumentResponse/State.php @@ -0,0 +1,64 @@ +google.cloud.documentai.v1.ReviewDocumentResponse.State + */ +class State +{ + /** + * The default value. This value is used if the state is omitted. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The review operation is rejected by the reviewer. + * + * Generated from protobuf enum REJECTED = 1; + */ + const REJECTED = 1; + /** + * The review operation is succeeded. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::REJECTED => 'REJECTED', + self::SUCCEEDED => 'SUCCEEDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(State::class, \Google\Cloud\DocumentAI\V1\ReviewDocumentResponse_State::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/SetDefaultProcessorVersionMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/SetDefaultProcessorVersionMetadata.php new file mode 100644 index 000000000000..6830b29e2510 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/SetDefaultProcessorVersionMetadata.php @@ -0,0 +1,79 @@ +google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + */ +class SetDefaultProcessorVersionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + */ + protected $common_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/SetDefaultProcessorVersionRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/SetDefaultProcessorVersionRequest.php new file mode 100644 index 000000000000..3ec67a74150a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/SetDefaultProcessorVersionRequest.php @@ -0,0 +1,123 @@ +google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + */ +class SetDefaultProcessorVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] to change default + * version. + * + * Generated from protobuf field string processor = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $processor = ''; + /** + * Required. The resource name of child + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as + * default. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + * + * Generated from protobuf field string default_processor_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $default_processor_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $processor + * Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] to change default + * version. + * @type string $default_processor_version + * Required. The resource name of child + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as + * default. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] to change default + * version. + * + * Generated from protobuf field string processor = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getProcessor() + { + return $this->processor; + } + + /** + * Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] to change default + * version. + * + * Generated from protobuf field string processor = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setProcessor($var) + { + GPBUtil::checkString($var, True); + $this->processor = $var; + + return $this; + } + + /** + * Required. The resource name of child + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as + * default. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + * + * Generated from protobuf field string default_processor_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDefaultProcessorVersion() + { + return $this->default_processor_version; + } + + /** + * Required. The resource name of child + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as + * default. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + * + * Generated from protobuf field string default_processor_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDefaultProcessorVersion($var) + { + GPBUtil::checkString($var, True); + $this->default_processor_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/SetDefaultProcessorVersionResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/SetDefaultProcessorVersionResponse.php new file mode 100644 index 000000000000..99dada608c4d --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/SetDefaultProcessorVersionResponse.php @@ -0,0 +1,35 @@ +google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + */ +class SetDefaultProcessorVersionResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionMetadata.php new file mode 100644 index 000000000000..b7ef781099da --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionMetadata.php @@ -0,0 +1,165 @@ +google.cloud.documentai.v1.TrainProcessorVersionMetadata + */ +class TrainProcessorVersionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + */ + protected $common_metadata = null; + /** + * The training dataset validation information. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation training_dataset_validation = 2; + */ + protected $training_dataset_validation = null; + /** + * The test dataset validation information. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation test_dataset_validation = 3; + */ + protected $test_dataset_validation = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * @type \Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata\DatasetValidation $training_dataset_validation + * The training dataset validation information. + * @type \Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata\DatasetValidation $test_dataset_validation + * The test dataset validation information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + + /** + * The training dataset validation information. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation training_dataset_validation = 2; + * @return \Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata\DatasetValidation|null + */ + public function getTrainingDatasetValidation() + { + return $this->training_dataset_validation; + } + + public function hasTrainingDatasetValidation() + { + return isset($this->training_dataset_validation); + } + + public function clearTrainingDatasetValidation() + { + unset($this->training_dataset_validation); + } + + /** + * The training dataset validation information. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation training_dataset_validation = 2; + * @param \Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata\DatasetValidation $var + * @return $this + */ + public function setTrainingDatasetValidation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata\DatasetValidation::class); + $this->training_dataset_validation = $var; + + return $this; + } + + /** + * The test dataset validation information. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation test_dataset_validation = 3; + * @return \Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata\DatasetValidation|null + */ + public function getTestDatasetValidation() + { + return $this->test_dataset_validation; + } + + public function hasTestDatasetValidation() + { + return isset($this->test_dataset_validation); + } + + public function clearTestDatasetValidation() + { + unset($this->test_dataset_validation); + } + + /** + * The test dataset validation information. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation test_dataset_validation = 3; + * @param \Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata\DatasetValidation $var + * @return $this + */ + public function setTestDatasetValidation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata\DatasetValidation::class); + $this->test_dataset_validation = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionMetadata/DatasetValidation.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionMetadata/DatasetValidation.php new file mode 100644 index 000000000000..c30b51c24dfe --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionMetadata/DatasetValidation.php @@ -0,0 +1,189 @@ +google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation + */ +class DatasetValidation extends \Google\Protobuf\Internal\Message +{ + /** + * The total number of document errors. + * + * Generated from protobuf field int32 document_error_count = 3; + */ + protected $document_error_count = 0; + /** + * The total number of dataset errors. + * + * Generated from protobuf field int32 dataset_error_count = 4; + */ + protected $dataset_error_count = 0; + /** + * Error information pertaining to specific documents. A maximum of 10 + * document errors will be returned. + * Any document with errors will not be used throughout training. + * + * Generated from protobuf field repeated .google.rpc.Status document_errors = 1; + */ + private $document_errors; + /** + * Error information for the dataset as a whole. A maximum of 10 dataset + * errors will be returned. + * A single dataset error is terminal for training. + * + * Generated from protobuf field repeated .google.rpc.Status dataset_errors = 2; + */ + private $dataset_errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $document_error_count + * The total number of document errors. + * @type int $dataset_error_count + * The total number of dataset errors. + * @type array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $document_errors + * Error information pertaining to specific documents. A maximum of 10 + * document errors will be returned. + * Any document with errors will not be used throughout training. + * @type array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $dataset_errors + * Error information for the dataset as a whole. A maximum of 10 dataset + * errors will be returned. + * A single dataset error is terminal for training. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The total number of document errors. + * + * Generated from protobuf field int32 document_error_count = 3; + * @return int + */ + public function getDocumentErrorCount() + { + return $this->document_error_count; + } + + /** + * The total number of document errors. + * + * Generated from protobuf field int32 document_error_count = 3; + * @param int $var + * @return $this + */ + public function setDocumentErrorCount($var) + { + GPBUtil::checkInt32($var); + $this->document_error_count = $var; + + return $this; + } + + /** + * The total number of dataset errors. + * + * Generated from protobuf field int32 dataset_error_count = 4; + * @return int + */ + public function getDatasetErrorCount() + { + return $this->dataset_error_count; + } + + /** + * The total number of dataset errors. + * + * Generated from protobuf field int32 dataset_error_count = 4; + * @param int $var + * @return $this + */ + public function setDatasetErrorCount($var) + { + GPBUtil::checkInt32($var); + $this->dataset_error_count = $var; + + return $this; + } + + /** + * Error information pertaining to specific documents. A maximum of 10 + * document errors will be returned. + * Any document with errors will not be used throughout training. + * + * Generated from protobuf field repeated .google.rpc.Status document_errors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDocumentErrors() + { + return $this->document_errors; + } + + /** + * Error information pertaining to specific documents. A maximum of 10 + * document errors will be returned. + * Any document with errors will not be used throughout training. + * + * Generated from protobuf field repeated .google.rpc.Status document_errors = 1; + * @param array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDocumentErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->document_errors = $arr; + + return $this; + } + + /** + * Error information for the dataset as a whole. A maximum of 10 dataset + * errors will be returned. + * A single dataset error is terminal for training. + * + * Generated from protobuf field repeated .google.rpc.Status dataset_errors = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDatasetErrors() + { + return $this->dataset_errors; + } + + /** + * Error information for the dataset as a whole. A maximum of 10 dataset + * errors will be returned. + * A single dataset error is terminal for training. + * + * Generated from protobuf field repeated .google.rpc.Status dataset_errors = 2; + * @param array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDatasetErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->dataset_errors = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DatasetValidation::class, \Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata_DatasetValidation::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest.php new file mode 100644 index 000000000000..258c7ec15ca4 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest.php @@ -0,0 +1,315 @@ +google.cloud.documentai.v1.TrainProcessorVersionRequest + */ +class TrainProcessorVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent (project, location and processor) to create the new + * version for. Format: + * `projects/{project}/locations/{location}/processors/{processor}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The processor version to be created. + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessorVersion processor_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $processor_version = null; + /** + * Optional. The schema the processor version will be trained with. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema document_schema = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $document_schema = null; + /** + * Optional. The input data used to train the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData input_data = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $input_data = null; + /** + * Optional. The processor version to use as a base for training. This + * processor version must be a child of `parent`. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`. + * + * Generated from protobuf field string base_processor_version = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $base_processor_version = ''; + protected $processor_flags; + + /** + * @param string $parent Required. The parent (project, location and processor) to create the new + * version for. Format: + * `projects/{project}/locations/{location}/processors/{processor}`. Please see + * {@see DocumentProcessorServiceClient::processorName()} for help formatting this field. + * @param \Google\Cloud\DocumentAI\V1\ProcessorVersion $processorVersion Required. The processor version to be created. + * + * @return \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\DocumentAI\V1\ProcessorVersion $processorVersion): self + { + return (new self()) + ->setParent($parent) + ->setProcessorVersion($processorVersion); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest\CustomDocumentExtractionOptions $custom_document_extraction_options + * Options to control Custom Document Extraction (CDE) Processor. + * @type string $parent + * Required. The parent (project, location and processor) to create the new + * version for. Format: + * `projects/{project}/locations/{location}/processors/{processor}`. + * @type \Google\Cloud\DocumentAI\V1\ProcessorVersion $processor_version + * Required. The processor version to be created. + * @type \Google\Cloud\DocumentAI\V1\DocumentSchema $document_schema + * Optional. The schema the processor version will be trained with. + * @type \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest\InputData $input_data + * Optional. The input data used to train the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * @type string $base_processor_version + * Optional. The processor version to use as a base for training. This + * processor version must be a child of `parent`. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Options to control Custom Document Extraction (CDE) Processor. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions custom_document_extraction_options = 5; + * @return \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest\CustomDocumentExtractionOptions|null + */ + public function getCustomDocumentExtractionOptions() + { + return $this->readOneof(5); + } + + public function hasCustomDocumentExtractionOptions() + { + return $this->hasOneof(5); + } + + /** + * Options to control Custom Document Extraction (CDE) Processor. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions custom_document_extraction_options = 5; + * @param \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest\CustomDocumentExtractionOptions $var + * @return $this + */ + public function setCustomDocumentExtractionOptions($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest\CustomDocumentExtractionOptions::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Required. The parent (project, location and processor) to create the new + * version for. Format: + * `projects/{project}/locations/{location}/processors/{processor}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent (project, location and processor) to create the new + * version for. Format: + * `projects/{project}/locations/{location}/processors/{processor}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The processor version to be created. + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessorVersion processor_version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\DocumentAI\V1\ProcessorVersion|null + */ + public function getProcessorVersion() + { + return $this->processor_version; + } + + public function hasProcessorVersion() + { + return isset($this->processor_version); + } + + public function clearProcessorVersion() + { + unset($this->processor_version); + } + + /** + * Required. The processor version to be created. + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessorVersion processor_version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\DocumentAI\V1\ProcessorVersion $var + * @return $this + */ + public function setProcessorVersion($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\ProcessorVersion::class); + $this->processor_version = $var; + + return $this; + } + + /** + * Optional. The schema the processor version will be trained with. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema document_schema = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\DocumentAI\V1\DocumentSchema|null + */ + public function getDocumentSchema() + { + return $this->document_schema; + } + + public function hasDocumentSchema() + { + return isset($this->document_schema); + } + + public function clearDocumentSchema() + { + unset($this->document_schema); + } + + /** + * Optional. The schema the processor version will be trained with. + * + * Generated from protobuf field .google.cloud.documentai.v1.DocumentSchema document_schema = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\DocumentAI\V1\DocumentSchema $var + * @return $this + */ + public function setDocumentSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\DocumentSchema::class); + $this->document_schema = $var; + + return $this; + } + + /** + * Optional. The input data used to train the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData input_data = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest\InputData|null + */ + public function getInputData() + { + return $this->input_data; + } + + public function hasInputData() + { + return isset($this->input_data); + } + + public function clearInputData() + { + unset($this->input_data); + } + + /** + * Optional. The input data used to train the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData input_data = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest\InputData $var + * @return $this + */ + public function setInputData($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest\InputData::class); + $this->input_data = $var; + + return $this; + } + + /** + * Optional. The processor version to use as a base for training. This + * processor version must be a child of `parent`. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`. + * + * Generated from protobuf field string base_processor_version = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getBaseProcessorVersion() + { + return $this->base_processor_version; + } + + /** + * Optional. The processor version to use as a base for training. This + * processor version must be a child of `parent`. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`. + * + * Generated from protobuf field string base_processor_version = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setBaseProcessorVersion($var) + { + GPBUtil::checkString($var, True); + $this->base_processor_version = $var; + + return $this; + } + + /** + * @return string + */ + public function getProcessorFlags() + { + return $this->whichOneof("processor_flags"); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest/CustomDocumentExtractionOptions.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest/CustomDocumentExtractionOptions.php new file mode 100644 index 000000000000..d3323c332634 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest/CustomDocumentExtractionOptions.php @@ -0,0 +1,71 @@ +google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions + */ +class CustomDocumentExtractionOptions extends \Google\Protobuf\Internal\Message +{ + /** + * Training method to use for CDE training. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod training_method = 3; + */ + protected $training_method = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $training_method + * Training method to use for CDE training. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Training method to use for CDE training. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod training_method = 3; + * @return int + */ + public function getTrainingMethod() + { + return $this->training_method; + } + + /** + * Training method to use for CDE training. + * + * Generated from protobuf field .google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod training_method = 3; + * @param int $var + * @return $this + */ + public function setTrainingMethod($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest\CustomDocumentExtractionOptions\TrainingMethod::class); + $this->training_method = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CustomDocumentExtractionOptions::class, \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest_CustomDocumentExtractionOptions::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest/CustomDocumentExtractionOptions/TrainingMethod.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest/CustomDocumentExtractionOptions/TrainingMethod.php new file mode 100644 index 000000000000..67f7b58ff0e9 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest/CustomDocumentExtractionOptions/TrainingMethod.php @@ -0,0 +1,59 @@ +google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod + */ +class TrainingMethod +{ + /** + * Generated from protobuf enum TRAINING_METHOD_UNSPECIFIED = 0; + */ + const TRAINING_METHOD_UNSPECIFIED = 0; + /** + * Generated from protobuf enum MODEL_BASED = 1; + */ + const MODEL_BASED = 1; + /** + * Generated from protobuf enum TEMPLATE_BASED = 2; + */ + const TEMPLATE_BASED = 2; + + private static $valueToName = [ + self::TRAINING_METHOD_UNSPECIFIED => 'TRAINING_METHOD_UNSPECIFIED', + self::MODEL_BASED => 'MODEL_BASED', + self::TEMPLATE_BASED => 'TEMPLATE_BASED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TrainingMethod::class, \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest_CustomDocumentExtractionOptions_TrainingMethod::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest/InputData.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest/InputData.php new file mode 100644 index 000000000000..c1a4db267951 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionRequest/InputData.php @@ -0,0 +1,125 @@ +google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData + */ +class InputData extends \Google\Protobuf\Internal\Message +{ + /** + * The documents used for training the new version. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig training_documents = 3; + */ + protected $training_documents = null; + /** + * The documents used for testing the trained version. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig test_documents = 4; + */ + protected $test_documents = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig $training_documents + * The documents used for training the new version. + * @type \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig $test_documents + * The documents used for testing the trained version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The documents used for training the new version. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig training_documents = 3; + * @return \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig|null + */ + public function getTrainingDocuments() + { + return $this->training_documents; + } + + public function hasTrainingDocuments() + { + return isset($this->training_documents); + } + + public function clearTrainingDocuments() + { + unset($this->training_documents); + } + + /** + * The documents used for training the new version. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig training_documents = 3; + * @param \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig $var + * @return $this + */ + public function setTrainingDocuments($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig::class); + $this->training_documents = $var; + + return $this; + } + + /** + * The documents used for testing the trained version. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig test_documents = 4; + * @return \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig|null + */ + public function getTestDocuments() + { + return $this->test_documents; + } + + public function hasTestDocuments() + { + return isset($this->test_documents); + } + + public function clearTestDocuments() + { + unset($this->test_documents); + } + + /** + * The documents used for testing the trained version. + * + * Generated from protobuf field .google.cloud.documentai.v1.BatchDocumentsInputConfig test_documents = 4; + * @param \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig $var + * @return $this + */ + public function setTestDocuments($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\BatchDocumentsInputConfig::class); + $this->test_documents = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(InputData::class, \Google\Cloud\DocumentAI\V1\TrainProcessorVersionRequest_InputData::class); + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionResponse.php new file mode 100644 index 000000000000..c46c6b822b85 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/TrainProcessorVersionResponse.php @@ -0,0 +1,68 @@ +google.cloud.documentai.v1.TrainProcessorVersionResponse + */ +class TrainProcessorVersionResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name of the processor version produced by training. + * + * Generated from protobuf field string processor_version = 1; + */ + protected $processor_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $processor_version + * The resource name of the processor version produced by training. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The resource name of the processor version produced by training. + * + * Generated from protobuf field string processor_version = 1; + * @return string + */ + public function getProcessorVersion() + { + return $this->processor_version; + } + + /** + * The resource name of the processor version produced by training. + * + * Generated from protobuf field string processor_version = 1; + * @param string $var + * @return $this + */ + public function setProcessorVersion($var) + { + GPBUtil::checkString($var, True); + $this->processor_version = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/UndeployProcessorVersionMetadata.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/UndeployProcessorVersionMetadata.php new file mode 100644 index 000000000000..7b046ed6c93b --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/UndeployProcessorVersionMetadata.php @@ -0,0 +1,79 @@ +google.cloud.documentai.v1.UndeployProcessorVersionMetadata + */ +class UndeployProcessorVersionMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + */ + protected $common_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $common_metadata + * The basic metadata of the long-running operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @return \Google\Cloud\DocumentAI\V1\CommonOperationMetadata|null + */ + public function getCommonMetadata() + { + return $this->common_metadata; + } + + public function hasCommonMetadata() + { + return isset($this->common_metadata); + } + + public function clearCommonMetadata() + { + unset($this->common_metadata); + } + + /** + * The basic metadata of the long-running operation. + * + * Generated from protobuf field .google.cloud.documentai.v1.CommonOperationMetadata common_metadata = 1; + * @param \Google\Cloud\DocumentAI\V1\CommonOperationMetadata $var + * @return $this + */ + public function setCommonMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\CommonOperationMetadata::class); + $this->common_metadata = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/UndeployProcessorVersionRequest.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/UndeployProcessorVersionRequest.php new file mode 100644 index 000000000000..1c5cb20ed5f8 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/UndeployProcessorVersionRequest.php @@ -0,0 +1,83 @@ +google.cloud.documentai.v1.UndeployProcessorVersionRequest + */ +class UndeployProcessorVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The processor version resource name to be undeployed. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The processor version resource name to be undeployed. Please see + * {@see DocumentProcessorServiceClient::processorVersionName()} for help formatting this field. + * + * @return \Google\Cloud\DocumentAI\V1\UndeployProcessorVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The processor version resource name to be undeployed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The processor version resource name to be undeployed. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The processor version resource name to be undeployed. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/UndeployProcessorVersionResponse.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/UndeployProcessorVersionResponse.php new file mode 100644 index 000000000000..e6d592d8b55a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/UndeployProcessorVersionResponse.php @@ -0,0 +1,35 @@ +google.cloud.documentai.v1.UndeployProcessorVersionResponse + */ +class UndeployProcessorVersionResponse extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Vertex.php b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Vertex.php new file mode 100644 index 000000000000..d56818347c95 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/proto/src/Google/Cloud/DocumentAI/V1/Vertex.php @@ -0,0 +1,102 @@ +google.cloud.documentai.v1.Vertex + */ +class Vertex extends \Google\Protobuf\Internal\Message +{ + /** + * X coordinate. + * + * Generated from protobuf field int32 x = 1; + */ + protected $x = 0; + /** + * Y coordinate (starts from the top of the image). + * + * Generated from protobuf field int32 y = 2; + */ + protected $y = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $x + * X coordinate. + * @type int $y + * Y coordinate (starts from the top of the image). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\Geometry::initOnce(); + parent::__construct($data); + } + + /** + * X coordinate. + * + * Generated from protobuf field int32 x = 1; + * @return int + */ + public function getX() + { + return $this->x; + } + + /** + * X coordinate. + * + * Generated from protobuf field int32 x = 1; + * @param int $var + * @return $this + */ + public function setX($var) + { + GPBUtil::checkInt32($var); + $this->x = $var; + + return $this; + } + + /** + * Y coordinate (starts from the top of the image). + * + * Generated from protobuf field int32 y = 2; + * @return int + */ + public function getY() + { + return $this->y; + } + + /** + * Y coordinate (starts from the top of the image). + * + * Generated from protobuf field int32 y = 2; + * @param int $var + * @return $this + */ + public function setY($var) + { + GPBUtil::checkInt32($var); + $this->y = $var; + + return $this; + } + +} + diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/batch_process_documents.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/batch_process_documents.php new file mode 100644 index 000000000000..538406285c02 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/batch_process_documents.php @@ -0,0 +1,83 @@ +batchProcessDocuments($name); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchProcessResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + batch_process_documents_sample($name); +} +// [END documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/create_processor.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/create_processor.php new file mode 100644 index 000000000000..117ecc06c05b --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/create_processor.php @@ -0,0 +1,72 @@ +createProcessor($formattedParent, $processor); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DocumentProcessorServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + create_processor_sample($formattedParent); +} +// [END documentai_v1_generated_DocumentProcessorService_CreateProcessor_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/delete_processor.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/delete_processor.php new file mode 100644 index 000000000000..3cf6a0bf7b72 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/delete_processor.php @@ -0,0 +1,80 @@ +deleteProcessor($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::processorName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]' + ); + + delete_processor_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_DeleteProcessor_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/delete_processor_version.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/delete_processor_version.php new file mode 100644 index 000000000000..234229f74011 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/delete_processor_version.php @@ -0,0 +1,81 @@ +deleteProcessorVersion($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::processorVersionName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]', + '[PROCESSOR_VERSION]' + ); + + delete_processor_version_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/deploy_processor_version.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/deploy_processor_version.php new file mode 100644 index 000000000000..75aad9a01e6c --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/deploy_processor_version.php @@ -0,0 +1,83 @@ +deployProcessorVersion($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DeployProcessorVersionResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::processorVersionName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]', + '[PROCESSOR_VERSION]' + ); + + deploy_processor_version_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/disable_processor.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/disable_processor.php new file mode 100644 index 000000000000..67bc92c18c05 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/disable_processor.php @@ -0,0 +1,82 @@ +disableProcessor($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DisableProcessorResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::processorName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]' + ); + + disable_processor_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_DisableProcessor_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/enable_processor.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/enable_processor.php new file mode 100644 index 000000000000..4b5a629fc315 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/enable_processor.php @@ -0,0 +1,82 @@ +enableProcessor($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var EnableProcessorResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::processorName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]' + ); + + enable_processor_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_EnableProcessor_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/evaluate_processor_version.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/evaluate_processor_version.php new file mode 100644 index 000000000000..cc7beccfeb25 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/evaluate_processor_version.php @@ -0,0 +1,87 @@ +evaluateProcessorVersion($formattedProcessorVersion); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var EvaluateProcessorVersionResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedProcessorVersion = DocumentProcessorServiceClient::processorVersionName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]', + '[PROCESSOR_VERSION]' + ); + + evaluate_processor_version_sample($formattedProcessorVersion); +} +// [END documentai_v1_generated_DocumentProcessorService_EvaluateProcessorVersion_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/fetch_processor_types.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/fetch_processor_types.php new file mode 100644 index 000000000000..643b269496d4 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/fetch_processor_types.php @@ -0,0 +1,69 @@ +fetchProcessorTypes($formattedParent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DocumentProcessorServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + fetch_processor_types_sample($formattedParent); +} +// [END documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_evaluation.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_evaluation.php new file mode 100644 index 000000000000..3d9d12483d4a --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_evaluation.php @@ -0,0 +1,74 @@ +getEvaluation($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::evaluationName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]', + '[PROCESSOR_VERSION]', + '[EVALUATION]' + ); + + get_evaluation_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_GetEvaluation_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_location.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_location.php new file mode 100644 index 000000000000..a02545025ae7 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END documentai_v1_generated_DocumentProcessorService_GetLocation_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_processor.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_processor.php new file mode 100644 index 000000000000..47c7e2eefeeb --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_processor.php @@ -0,0 +1,70 @@ +getProcessor($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::processorName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]' + ); + + get_processor_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_GetProcessor_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_processor_type.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_processor_type.php new file mode 100644 index 000000000000..ace7df93c99d --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_processor_type.php @@ -0,0 +1,70 @@ +getProcessorType($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::processorTypeName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR_TYPE]' + ); + + get_processor_type_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_GetProcessorType_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_processor_version.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_processor_version.php new file mode 100644 index 000000000000..4bbd31384746 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/get_processor_version.php @@ -0,0 +1,71 @@ +getProcessorVersion($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::processorVersionName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]', + '[PROCESSOR_VERSION]' + ); + + get_processor_version_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_evaluations.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_evaluations.php new file mode 100644 index 000000000000..a84d8c512055 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_evaluations.php @@ -0,0 +1,79 @@ +listEvaluations($formattedParent); + + /** @var Evaluation $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DocumentProcessorServiceClient::processorVersionName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]', + '[PROCESSOR_VERSION]' + ); + + list_evaluations_sample($formattedParent); +} +// [END documentai_v1_generated_DocumentProcessorService_ListEvaluations_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_locations.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_locations.php new file mode 100644 index 000000000000..717ad676319c --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END documentai_v1_generated_DocumentProcessorService_ListLocations_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_processor_types.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_processor_types.php new file mode 100644 index 000000000000..543e7f4208c0 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_processor_types.php @@ -0,0 +1,72 @@ +listProcessorTypes($formattedParent); + + /** @var ProcessorType $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DocumentProcessorServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_processor_types_sample($formattedParent); +} +// [END documentai_v1_generated_DocumentProcessorService_ListProcessorTypes_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_processor_versions.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_processor_versions.php new file mode 100644 index 000000000000..3857d4250ae8 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_processor_versions.php @@ -0,0 +1,77 @@ +listProcessorVersions($formattedParent); + + /** @var ProcessorVersion $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DocumentProcessorServiceClient::processorName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]' + ); + + list_processor_versions_sample($formattedParent); +} +// [END documentai_v1_generated_DocumentProcessorService_ListProcessorVersions_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_processors.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_processors.php new file mode 100644 index 000000000000..9755ebaa59e3 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/list_processors.php @@ -0,0 +1,72 @@ +listProcessors($formattedParent); + + /** @var Processor $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DocumentProcessorServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_processors_sample($formattedParent); +} +// [END documentai_v1_generated_DocumentProcessorService_ListProcessors_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/process_document.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/process_document.php new file mode 100644 index 000000000000..0b37c844d715 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/process_document.php @@ -0,0 +1,74 @@ +processDocument($name); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $name = '[NAME]'; + + process_document_sample($name); +} +// [END documentai_v1_generated_DocumentProcessorService_ProcessDocument_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/review_document.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/review_document.php new file mode 100644 index 000000000000..47418a23a96e --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/review_document.php @@ -0,0 +1,85 @@ +reviewDocument($formattedHumanReviewConfig); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ReviewDocumentResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedHumanReviewConfig = DocumentProcessorServiceClient::humanReviewConfigName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]' + ); + + review_document_sample($formattedHumanReviewConfig); +} +// [END documentai_v1_generated_DocumentProcessorService_ReviewDocument_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/set_default_processor_version.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/set_default_processor_version.php new file mode 100644 index 000000000000..ce983f7c32bb --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/set_default_processor_version.php @@ -0,0 +1,104 @@ +setDefaultProcessorVersion( + $formattedProcessor, + $formattedDefaultProcessorVersion + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var SetDefaultProcessorVersionResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedProcessor = DocumentProcessorServiceClient::processorName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]' + ); + $formattedDefaultProcessorVersion = DocumentProcessorServiceClient::processorVersionName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]', + '[PROCESSOR_VERSION]' + ); + + set_default_processor_version_sample($formattedProcessor, $formattedDefaultProcessorVersion); +} +// [END documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/train_processor_version.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/train_processor_version.php new file mode 100644 index 000000000000..89bf50f3c733 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/train_processor_version.php @@ -0,0 +1,93 @@ +trainProcessorVersion( + $formattedParent, + $processorVersion + ); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var TrainProcessorVersionResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DocumentProcessorServiceClient::processorName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]' + ); + + train_processor_version_sample($formattedParent); +} +// [END documentai_v1_generated_DocumentProcessorService_TrainProcessorVersion_sync] diff --git a/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/undeploy_processor_version.php b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/undeploy_processor_version.php new file mode 100644 index 000000000000..e5289343d854 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/samples/V1/DocumentProcessorServiceClient/undeploy_processor_version.php @@ -0,0 +1,83 @@ +undeployProcessorVersion($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var UndeployProcessorVersionResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DocumentProcessorServiceClient::processorVersionName( + '[PROJECT]', + '[LOCATION]', + '[PROCESSOR]', + '[PROCESSOR_VERSION]' + ); + + undeploy_processor_version_sample($formattedName); +} +// [END documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_sync] diff --git a/owl-bot-staging/DocumentAi/v1/src/V1/Client/BaseClient/DocumentProcessorServiceBaseClient.php b/owl-bot-staging/DocumentAi/v1/src/V1/Client/BaseClient/DocumentProcessorServiceBaseClient.php new file mode 100644 index 000000000000..d47b6852c198 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/src/V1/Client/BaseClient/DocumentProcessorServiceBaseClient.php @@ -0,0 +1,1001 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../../resources/document_processor_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../../resources/document_processor_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../../resources/document_processor_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../../resources/document_processor_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Formats a string containing the fully-qualified path to represent a evaluation + * resource. + * + * @param string $project + * @param string $location + * @param string $processor + * @param string $processorVersion + * @param string $evaluation + * + * @return string The formatted evaluation resource. + */ + public static function evaluationName(string $project, string $location, string $processor, string $processorVersion, string $evaluation): string + { + return self::getPathTemplate('evaluation')->render([ + 'project' => $project, + 'location' => $location, + 'processor' => $processor, + 'processor_version' => $processorVersion, + 'evaluation' => $evaluation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * human_review_config resource. + * + * @param string $project + * @param string $location + * @param string $processor + * + * @return string The formatted human_review_config resource. + */ + public static function humanReviewConfigName(string $project, string $location, string $processor): string + { + return self::getPathTemplate('humanReviewConfig')->render([ + 'project' => $project, + 'location' => $location, + 'processor' => $processor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName(string $project, string $location): string + { + return self::getPathTemplate('location')->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a processor + * resource. + * + * @param string $project + * @param string $location + * @param string $processor + * + * @return string The formatted processor resource. + */ + public static function processorName(string $project, string $location, string $processor): string + { + return self::getPathTemplate('processor')->render([ + 'project' => $project, + 'location' => $location, + 'processor' => $processor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * processor_type resource. + * + * @param string $project + * @param string $location + * @param string $processorType + * + * @return string The formatted processor_type resource. + */ + public static function processorTypeName(string $project, string $location, string $processorType): string + { + return self::getPathTemplate('processorType')->render([ + 'project' => $project, + 'location' => $location, + 'processor_type' => $processorType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * processor_version resource. + * + * @param string $project + * @param string $location + * @param string $processor + * @param string $processorVersion + * + * @return string The formatted processor_version resource. + */ + public static function processorVersionName(string $project, string $location, string $processor, string $processorVersion): string + { + return self::getPathTemplate('processorVersion')->render([ + 'project' => $project, + 'location' => $location, + 'processor' => $processor, + 'processor_version' => $processorVersion, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - evaluation: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation} + * - humanReviewConfig: projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig + * - location: projects/{project}/locations/{location} + * - processor: projects/{project}/locations/{location}/processors/{processor} + * - processorType: projects/{project}/locations/{location}/processorTypes/{processor_type} + * - processorVersion: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'documentai.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * The async variant is {@see self::batchProcessDocumentsAsync()} . + * + * @param BatchProcessRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function batchProcessDocuments(BatchProcessRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('BatchProcessDocuments', $request, $callOptions)->wait(); + } + + /** + * Creates a processor from the + * [ProcessorType][google.cloud.documentai.v1.ProcessorType] provided. The + * processor will be at `ENABLED` state by default after its creation. + * + * The async variant is {@see self::createProcessorAsync()} . + * + * @param CreateProcessorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Processor + * + * @throws ApiException Thrown if the API call fails. + */ + public function createProcessor(CreateProcessorRequest $request, array $callOptions = []): Processor + { + return $this->startApiCall('CreateProcessor', $request, $callOptions)->wait(); + } + + /** + * Deletes the processor, unloads all deployed model artifacts if it was + * enabled and then deletes all artifacts associated with this processor. + * + * The async variant is {@see self::deleteProcessorAsync()} . + * + * @param DeleteProcessorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteProcessor(DeleteProcessorRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteProcessor', $request, $callOptions)->wait(); + } + + /** + * Deletes the processor version, all artifacts under the processor version + * will be deleted. + * + * The async variant is {@see self::deleteProcessorVersionAsync()} . + * + * @param DeleteProcessorVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteProcessorVersion(DeleteProcessorVersionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteProcessorVersion', $request, $callOptions)->wait(); + } + + /** + * Deploys the processor version. + * + * The async variant is {@see self::deployProcessorVersionAsync()} . + * + * @param DeployProcessorVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function deployProcessorVersion(DeployProcessorVersionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeployProcessorVersion', $request, $callOptions)->wait(); + } + + /** + * Disables a processor + * + * The async variant is {@see self::disableProcessorAsync()} . + * + * @param DisableProcessorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function disableProcessor(DisableProcessorRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DisableProcessor', $request, $callOptions)->wait(); + } + + /** + * Enables a processor + * + * The async variant is {@see self::enableProcessorAsync()} . + * + * @param EnableProcessorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function enableProcessor(EnableProcessorRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('EnableProcessor', $request, $callOptions)->wait(); + } + + /** + * Evaluates a ProcessorVersion against annotated documents, producing an + * Evaluation. + * + * The async variant is {@see self::evaluateProcessorVersionAsync()} . + * + * @param EvaluateProcessorVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function evaluateProcessorVersion(EvaluateProcessorVersionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('EvaluateProcessorVersion', $request, $callOptions)->wait(); + } + + /** + * Fetches processor types. Note that we don't use + * [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes] + * here, because it isn't paginated. + * + * The async variant is {@see self::fetchProcessorTypesAsync()} . + * + * @param FetchProcessorTypesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return FetchProcessorTypesResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fetchProcessorTypes(FetchProcessorTypesRequest $request, array $callOptions = []): FetchProcessorTypesResponse + { + return $this->startApiCall('FetchProcessorTypes', $request, $callOptions)->wait(); + } + + /** + * Retrieves a specific evaluation. + * + * The async variant is {@see self::getEvaluationAsync()} . + * + * @param GetEvaluationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Evaluation + * + * @throws ApiException Thrown if the API call fails. + */ + public function getEvaluation(GetEvaluationRequest $request, array $callOptions = []): Evaluation + { + return $this->startApiCall('GetEvaluation', $request, $callOptions)->wait(); + } + + /** + * Gets a processor detail. + * + * The async variant is {@see self::getProcessorAsync()} . + * + * @param GetProcessorRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Processor + * + * @throws ApiException Thrown if the API call fails. + */ + public function getProcessor(GetProcessorRequest $request, array $callOptions = []): Processor + { + return $this->startApiCall('GetProcessor', $request, $callOptions)->wait(); + } + + /** + * Gets a processor type detail. + * + * The async variant is {@see self::getProcessorTypeAsync()} . + * + * @param GetProcessorTypeRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ProcessorType + * + * @throws ApiException Thrown if the API call fails. + */ + public function getProcessorType(GetProcessorTypeRequest $request, array $callOptions = []): ProcessorType + { + return $this->startApiCall('GetProcessorType', $request, $callOptions)->wait(); + } + + /** + * Gets a processor version detail. + * + * The async variant is {@see self::getProcessorVersionAsync()} . + * + * @param GetProcessorVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ProcessorVersion + * + * @throws ApiException Thrown if the API call fails. + */ + public function getProcessorVersion(GetProcessorVersionRequest $request, array $callOptions = []): ProcessorVersion + { + return $this->startApiCall('GetProcessorVersion', $request, $callOptions)->wait(); + } + + /** + * Retrieves a set of evaluations for a given processor version. + * + * The async variant is {@see self::listEvaluationsAsync()} . + * + * @param ListEvaluationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listEvaluations(ListEvaluationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListEvaluations', $request, $callOptions); + } + + /** + * Lists the processor types that exist. + * + * The async variant is {@see self::listProcessorTypesAsync()} . + * + * @param ListProcessorTypesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listProcessorTypes(ListProcessorTypesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListProcessorTypes', $request, $callOptions); + } + + /** + * Lists all versions of a processor. + * + * The async variant is {@see self::listProcessorVersionsAsync()} . + * + * @param ListProcessorVersionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listProcessorVersions(ListProcessorVersionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListProcessorVersions', $request, $callOptions); + } + + /** + * Lists all processors which belong to this project. + * + * The async variant is {@see self::listProcessorsAsync()} . + * + * @param ListProcessorsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listProcessors(ListProcessorsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListProcessors', $request, $callOptions); + } + + /** + * Processes a single document. + * + * The async variant is {@see self::processDocumentAsync()} . + * + * @param ProcessRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ProcessResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function processDocument(ProcessRequest $request, array $callOptions = []): ProcessResponse + { + return $this->startApiCall('ProcessDocument', $request, $callOptions)->wait(); + } + + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * The async variant is {@see self::reviewDocumentAsync()} . + * + * @param ReviewDocumentRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function reviewDocument(ReviewDocumentRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ReviewDocument', $request, $callOptions)->wait(); + } + + /** + * Set the default (active) version of a + * [Processor][google.cloud.documentai.v1.Processor] that will be used in + * [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument] + * and + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]. + * + * The async variant is {@see self::setDefaultProcessorVersionAsync()} . + * + * @param SetDefaultProcessorVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function setDefaultProcessorVersion(SetDefaultProcessorVersionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('SetDefaultProcessorVersion', $request, $callOptions)->wait(); + } + + /** + * Trains a new processor version. + * Operation metadata is returned as + * [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata]. + * + * The async variant is {@see self::trainProcessorVersionAsync()} . + * + * @param TrainProcessorVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function trainProcessorVersion(TrainProcessorVersionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('TrainProcessorVersion', $request, $callOptions)->wait(); + } + + /** + * Undeploys the processor version. + * + * The async variant is {@see self::undeployProcessorVersionAsync()} . + * + * @param UndeployProcessorVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function undeployProcessorVersion(UndeployProcessorVersionRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UndeployProcessorVersion', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see self::getLocationAsync()} . + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see self::listLocationsAsync()} . + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/owl-bot-staging/DocumentAi/v1/src/V1/Client/DocumentProcessorServiceClient.php b/owl-bot-staging/DocumentAi/v1/src/V1/Client/DocumentProcessorServiceClient.php new file mode 100644 index 000000000000..e20c3315dbff --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/src/V1/Client/DocumentProcessorServiceClient.php @@ -0,0 +1,40 @@ +batchProcessDocuments($name); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->batchProcessDocuments($name); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'batchProcessDocuments'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + * + * This service has a new (beta) implementation. See {@see + * \Google\Cloud\DocumentAI\V1\Client\DocumentProcessorServiceClient} to use the + * new surface. + */ +class DocumentProcessorServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.documentai.v1.DocumentProcessorService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'documentai.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static $evaluationNameTemplate; + + private static $humanReviewConfigNameTemplate; + + private static $locationNameTemplate; + + private static $processorNameTemplate; + + private static $processorTypeNameTemplate; + + private static $processorVersionNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/document_processor_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/document_processor_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/document_processor_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/document_processor_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getEvaluationNameTemplate() + { + if (self::$evaluationNameTemplate == null) { + self::$evaluationNameTemplate = new PathTemplate('projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}'); + } + + return self::$evaluationNameTemplate; + } + + private static function getHumanReviewConfigNameTemplate() + { + if (self::$humanReviewConfigNameTemplate == null) { + self::$humanReviewConfigNameTemplate = new PathTemplate('projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig'); + } + + return self::$humanReviewConfigNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getProcessorNameTemplate() + { + if (self::$processorNameTemplate == null) { + self::$processorNameTemplate = new PathTemplate('projects/{project}/locations/{location}/processors/{processor}'); + } + + return self::$processorNameTemplate; + } + + private static function getProcessorTypeNameTemplate() + { + if (self::$processorTypeNameTemplate == null) { + self::$processorTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/processorTypes/{processor_type}'); + } + + return self::$processorTypeNameTemplate; + } + + private static function getProcessorVersionNameTemplate() + { + if (self::$processorVersionNameTemplate == null) { + self::$processorVersionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}'); + } + + return self::$processorVersionNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'evaluation' => self::getEvaluationNameTemplate(), + 'humanReviewConfig' => self::getHumanReviewConfigNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'processor' => self::getProcessorNameTemplate(), + 'processorType' => self::getProcessorTypeNameTemplate(), + 'processorVersion' => self::getProcessorVersionNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a evaluation + * resource. + * + * @param string $project + * @param string $location + * @param string $processor + * @param string $processorVersion + * @param string $evaluation + * + * @return string The formatted evaluation resource. + */ + public static function evaluationName($project, $location, $processor, $processorVersion, $evaluation) + { + return self::getEvaluationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'processor' => $processor, + 'processor_version' => $processorVersion, + 'evaluation' => $evaluation, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * human_review_config resource. + * + * @param string $project + * @param string $location + * @param string $processor + * + * @return string The formatted human_review_config resource. + */ + public static function humanReviewConfigName($project, $location, $processor) + { + return self::getHumanReviewConfigNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'processor' => $processor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a processor + * resource. + * + * @param string $project + * @param string $location + * @param string $processor + * + * @return string The formatted processor resource. + */ + public static function processorName($project, $location, $processor) + { + return self::getProcessorNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'processor' => $processor, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * processor_type resource. + * + * @param string $project + * @param string $location + * @param string $processorType + * + * @return string The formatted processor_type resource. + */ + public static function processorTypeName($project, $location, $processorType) + { + return self::getProcessorTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'processor_type' => $processorType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * processor_version resource. + * + * @param string $project + * @param string $location + * @param string $processor + * @param string $processorVersion + * + * @return string The formatted processor_version resource. + */ + public static function processorVersionName($project, $location, $processor, $processorVersion) + { + return self::getProcessorVersionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'processor' => $processor, + 'processor_version' => $processorVersion, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - evaluation: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation} + * - humanReviewConfig: projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig + * - location: projects/{project}/locations/{location} + * - processor: projects/{project}/locations/{location}/processors/{processor} + * - processorType: projects/{project}/locations/{location}/processorTypes/{processor_type} + * - processorVersion: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'documentai.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $name = 'name'; + * $operationResponse = $documentProcessorServiceClient->batchProcessDocuments($name); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->batchProcessDocuments($name); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'batchProcessDocuments'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param array $optionalArgs { + * Optional. + * + * @type BatchDocumentsInputConfig $inputDocuments + * The input documents for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * @type DocumentOutputConfig $documentOutputConfig + * The output configuration for the + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments] + * method. + * @type bool $skipHumanReview + * Whether human review should be skipped for this request. Default to + * `false`. + * @type ProcessOptions $processOptions + * Inference-time options for the process API + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function batchProcessDocuments($name, array $optionalArgs = []) + { + $request = new BatchProcessRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['inputDocuments'])) { + $request->setInputDocuments($optionalArgs['inputDocuments']); + } + + if (isset($optionalArgs['documentOutputConfig'])) { + $request->setDocumentOutputConfig($optionalArgs['documentOutputConfig']); + } + + if (isset($optionalArgs['skipHumanReview'])) { + $request->setSkipHumanReview($optionalArgs['skipHumanReview']); + } + + if (isset($optionalArgs['processOptions'])) { + $request->setProcessOptions($optionalArgs['processOptions']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('BatchProcessDocuments', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Creates a processor from the + * [ProcessorType][google.cloud.documentai.v1.ProcessorType] provided. The + * processor will be at `ENABLED` state by default after its creation. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedParent = $documentProcessorServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $processor = new Processor(); + * $response = $documentProcessorServiceClient->createProcessor($formattedParent, $processor); + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent (project and location) under which to create the + * processor. Format: `projects/{project}/locations/{location}` + * @param Processor $processor Required. The processor to be created, requires + * [Processor.type][google.cloud.documentai.v1.Processor.type] and + * [Processor.display_name]][] to be set. Also, the + * [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] + * field must be set if the processor is under CMEK. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\DocumentAI\V1\Processor + * + * @throws ApiException if the remote call fails + */ + public function createProcessor($parent, $processor, array $optionalArgs = []) + { + $request = new CreateProcessorRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setProcessor($processor); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateProcessor', Processor::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the processor, unloads all deployed model artifacts if it was + * enabled and then deletes all artifacts associated with this processor. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + * $operationResponse = $documentProcessorServiceClient->deleteProcessor($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->deleteProcessor($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'deleteProcessor'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The processor resource name to be deleted. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteProcessor($name, array $optionalArgs = []) + { + $request = new DeleteProcessorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteProcessor', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the processor version, all artifacts under the processor version + * will be deleted. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + * $operationResponse = $documentProcessorServiceClient->deleteProcessorVersion($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->deleteProcessorVersion($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'deleteProcessorVersion'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The processor version resource name to be deleted. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deleteProcessorVersion($name, array $optionalArgs = []) + { + $request = new DeleteProcessorVersionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeleteProcessorVersion', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deploys the processor version. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + * $operationResponse = $documentProcessorServiceClient->deployProcessorVersion($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->deployProcessorVersion($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'deployProcessorVersion'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The processor version resource name to be deployed. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deployProcessorVersion($name, array $optionalArgs = []) + { + $request = new DeployProcessorVersionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeployProcessorVersion', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Disables a processor + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + * $operationResponse = $documentProcessorServiceClient->disableProcessor($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->disableProcessor($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'disableProcessor'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The processor resource name to be disabled. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function disableProcessor($name, array $optionalArgs = []) + { + $request = new DisableProcessorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DisableProcessor', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Enables a processor + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + * $operationResponse = $documentProcessorServiceClient->enableProcessor($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->enableProcessor($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'enableProcessor'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The processor resource name to be enabled. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function enableProcessor($name, array $optionalArgs = []) + { + $request = new EnableProcessorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('EnableProcessor', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Evaluates a ProcessorVersion against annotated documents, producing an + * Evaluation. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedProcessorVersion = $documentProcessorServiceClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + * $operationResponse = $documentProcessorServiceClient->evaluateProcessorVersion($formattedProcessorVersion); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->evaluateProcessorVersion($formattedProcessorVersion); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'evaluateProcessorVersion'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $processorVersion Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to + * evaluate. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param array $optionalArgs { + * Optional. + * + * @type BatchDocumentsInputConfig $evaluationDocuments + * Optional. The documents used in the evaluation. If unspecified, use the + * processor's dataset as evaluation input. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function evaluateProcessorVersion($processorVersion, array $optionalArgs = []) + { + $request = new EvaluateProcessorVersionRequest(); + $requestParamHeaders = []; + $request->setProcessorVersion($processorVersion); + $requestParamHeaders['processor_version'] = $processorVersion; + if (isset($optionalArgs['evaluationDocuments'])) { + $request->setEvaluationDocuments($optionalArgs['evaluationDocuments']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('EvaluateProcessorVersion', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Fetches processor types. Note that we don't use + * [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes] + * here, because it isn't paginated. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedParent = $documentProcessorServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $response = $documentProcessorServiceClient->fetchProcessorTypes($formattedParent); + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\DocumentAI\V1\FetchProcessorTypesResponse + * + * @throws ApiException if the remote call fails + */ + public function fetchProcessorTypes($parent, array $optionalArgs = []) + { + $request = new FetchProcessorTypesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('FetchProcessorTypes', FetchProcessorTypesResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a specific evaluation. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->evaluationName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]', '[EVALUATION]'); + * $response = $documentProcessorServiceClient->getEvaluation($formattedName); + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the + * [Evaluation][google.cloud.documentai.v1.Evaluation] to get. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\DocumentAI\V1\Evaluation + * + * @throws ApiException if the remote call fails + */ + public function getEvaluation($name, array $optionalArgs = []) + { + $request = new GetEvaluationRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetEvaluation', Evaluation::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a processor detail. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + * $response = $documentProcessorServiceClient->getProcessor($formattedName); + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The processor resource name. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\DocumentAI\V1\Processor + * + * @throws ApiException if the remote call fails + */ + public function getProcessor($name, array $optionalArgs = []) + { + $request = new GetProcessorRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetProcessor', Processor::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a processor type detail. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->processorTypeName('[PROJECT]', '[LOCATION]', '[PROCESSOR_TYPE]'); + * $response = $documentProcessorServiceClient->getProcessorType($formattedName); + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The processor type resource name. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\DocumentAI\V1\ProcessorType + * + * @throws ApiException if the remote call fails + */ + public function getProcessorType($name, array $optionalArgs = []) + { + $request = new GetProcessorTypeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetProcessorType', ProcessorType::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a processor version detail. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + * $response = $documentProcessorServiceClient->getProcessorVersion($formattedName); + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The processor resource name. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\DocumentAI\V1\ProcessorVersion + * + * @throws ApiException if the remote call fails + */ + public function getProcessorVersion($name, array $optionalArgs = []) + { + $request = new GetProcessorVersionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetProcessorVersion', ProcessorVersion::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves a set of evaluations for a given processor version. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedParent = $documentProcessorServiceClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + * // Iterate over pages of elements + * $pagedResponse = $documentProcessorServiceClient->listEvaluations($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $documentProcessorServiceClient->listEvaluations($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The resource name of the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list + * evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listEvaluations($parent, array $optionalArgs = []) + { + $request = new ListEvaluationsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListEvaluations', $optionalArgs, ListEvaluationsResponse::class, $request); + } + + /** + * Lists the processor types that exist. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedParent = $documentProcessorServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $documentProcessorServiceClient->listProcessorTypes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $documentProcessorServiceClient->listProcessorTypes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The location of processor types to list. + * Format: `projects/{project}/locations/{location}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listProcessorTypes($parent, array $optionalArgs = []) + { + $request = new ListProcessorTypesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListProcessorTypes', $optionalArgs, ListProcessorTypesResponse::class, $request); + } + + /** + * Lists all versions of a processor. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedParent = $documentProcessorServiceClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + * // Iterate over pages of elements + * $pagedResponse = $documentProcessorServiceClient->listProcessorVersions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $documentProcessorServiceClient->listProcessorVersions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent (project, location and processor) to list all + * versions. Format: + * `projects/{project}/locations/{location}/processors/{processor}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listProcessorVersions($parent, array $optionalArgs = []) + { + $request = new ListProcessorVersionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListProcessorVersions', $optionalArgs, ListProcessorVersionsResponse::class, $request); + } + + /** + * Lists all processors which belong to this project. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedParent = $documentProcessorServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $documentProcessorServiceClient->listProcessors($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $documentProcessorServiceClient->listProcessors($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent (project and location) which owns this collection of + * Processors. Format: `projects/{project}/locations/{location}` + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listProcessors($parent, array $optionalArgs = []) + { + $request = new ListProcessorsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListProcessors', $optionalArgs, ListProcessorsResponse::class, $request); + } + + /** + * Processes a single document. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $name = 'name'; + * $response = $documentProcessorServiceClient->processDocument($name); + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] or + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] + * to use for processing. If a + * [Processor][google.cloud.documentai.v1.Processor] is specified, the server + * will use its [default + * version][google.cloud.documentai.v1.Processor.default_processor_version]. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param array $optionalArgs { + * Optional. + * + * @type Document $inlineDocument + * An inline document proto. + * @type RawDocument $rawDocument + * A raw document content (bytes). + * @type GcsDocument $gcsDocument + * A raw document on Google Cloud Storage. + * @type bool $skipHumanReview + * Whether human review should be skipped for this request. Default to + * `false`. + * @type FieldMask $fieldMask + * Specifies which fields to include in the + * [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document] + * output. Only supports top-level document and pages field, so it must be in + * the form of `{document_field_name}` or `pages.{page_field_name}`. + * @type ProcessOptions $processOptions + * Inference-time options for the process API + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\DocumentAI\V1\ProcessResponse + * + * @throws ApiException if the remote call fails + */ + public function processDocument($name, array $optionalArgs = []) + { + $request = new ProcessRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['inlineDocument'])) { + $request->setInlineDocument($optionalArgs['inlineDocument']); + } + + if (isset($optionalArgs['rawDocument'])) { + $request->setRawDocument($optionalArgs['rawDocument']); + } + + if (isset($optionalArgs['gcsDocument'])) { + $request->setGcsDocument($optionalArgs['gcsDocument']); + } + + if (isset($optionalArgs['skipHumanReview'])) { + $request->setSkipHumanReview($optionalArgs['skipHumanReview']); + } + + if (isset($optionalArgs['fieldMask'])) { + $request->setFieldMask($optionalArgs['fieldMask']); + } + + if (isset($optionalArgs['processOptions'])) { + $request->setProcessOptions($optionalArgs['processOptions']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ProcessDocument', ProcessResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedHumanReviewConfig = $documentProcessorServiceClient->humanReviewConfigName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + * $operationResponse = $documentProcessorServiceClient->reviewDocument($formattedHumanReviewConfig); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->reviewDocument($formattedHumanReviewConfig); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'reviewDocument'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $humanReviewConfig Required. The resource name of the + * [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the + * document will be reviewed with. + * @param array $optionalArgs { + * Optional. + * + * @type Document $inlineDocument + * An inline document proto. + * @type bool $enableSchemaValidation + * Whether the validation should be performed on the ad-hoc review request. + * @type int $priority + * The priority of the human review task. + * For allowed values, use constants defined on {@see \Google\Cloud\DocumentAI\V1\ReviewDocumentRequest\Priority} + * @type DocumentSchema $documentSchema + * The document schema of the human review task. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function reviewDocument($humanReviewConfig, array $optionalArgs = []) + { + $request = new ReviewDocumentRequest(); + $requestParamHeaders = []; + $request->setHumanReviewConfig($humanReviewConfig); + $requestParamHeaders['human_review_config'] = $humanReviewConfig; + if (isset($optionalArgs['inlineDocument'])) { + $request->setInlineDocument($optionalArgs['inlineDocument']); + } + + if (isset($optionalArgs['enableSchemaValidation'])) { + $request->setEnableSchemaValidation($optionalArgs['enableSchemaValidation']); + } + + if (isset($optionalArgs['priority'])) { + $request->setPriority($optionalArgs['priority']); + } + + if (isset($optionalArgs['documentSchema'])) { + $request->setDocumentSchema($optionalArgs['documentSchema']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ReviewDocument', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Set the default (active) version of a + * [Processor][google.cloud.documentai.v1.Processor] that will be used in + * [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument] + * and + * [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedProcessor = $documentProcessorServiceClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + * $formattedDefaultProcessorVersion = $documentProcessorServiceClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + * $operationResponse = $documentProcessorServiceClient->setDefaultProcessorVersion($formattedProcessor, $formattedDefaultProcessorVersion); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->setDefaultProcessorVersion($formattedProcessor, $formattedDefaultProcessorVersion); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'setDefaultProcessorVersion'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $processor Required. The resource name of the + * [Processor][google.cloud.documentai.v1.Processor] to change default + * version. + * @param string $defaultProcessorVersion Required. The resource name of child + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as + * default. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function setDefaultProcessorVersion($processor, $defaultProcessorVersion, array $optionalArgs = []) + { + $request = new SetDefaultProcessorVersionRequest(); + $requestParamHeaders = []; + $request->setProcessor($processor); + $request->setDefaultProcessorVersion($defaultProcessorVersion); + $requestParamHeaders['processor'] = $processor; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('SetDefaultProcessorVersion', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Trains a new processor version. + * Operation metadata is returned as + * [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata]. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedParent = $documentProcessorServiceClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + * $processorVersion = new ProcessorVersion(); + * $operationResponse = $documentProcessorServiceClient->trainProcessorVersion($formattedParent, $processorVersion); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->trainProcessorVersion($formattedParent, $processorVersion); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'trainProcessorVersion'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The parent (project, location and processor) to create the new + * version for. Format: + * `projects/{project}/locations/{location}/processors/{processor}`. + * @param ProcessorVersion $processorVersion Required. The processor version to be created. + * @param array $optionalArgs { + * Optional. + * + * @type CustomDocumentExtractionOptions $customDocumentExtractionOptions + * Options to control Custom Document Extraction (CDE) Processor. + * @type DocumentSchema $documentSchema + * Optional. The schema the processor version will be trained with. + * @type InputData $inputData + * Optional. The input data used to train the + * [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + * @type string $baseProcessorVersion + * Optional. The processor version to use as a base for training. This + * processor version must be a child of `parent`. Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function trainProcessorVersion($parent, $processorVersion, array $optionalArgs = []) + { + $request = new TrainProcessorVersionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setProcessorVersion($processorVersion); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['customDocumentExtractionOptions'])) { + $request->setCustomDocumentExtractionOptions($optionalArgs['customDocumentExtractionOptions']); + } + + if (isset($optionalArgs['documentSchema'])) { + $request->setDocumentSchema($optionalArgs['documentSchema']); + } + + if (isset($optionalArgs['inputData'])) { + $request->setInputData($optionalArgs['inputData']); + } + + if (isset($optionalArgs['baseProcessorVersion'])) { + $request->setBaseProcessorVersion($optionalArgs['baseProcessorVersion']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('TrainProcessorVersion', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Undeploys the processor version. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $formattedName = $documentProcessorServiceClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + * $operationResponse = $documentProcessorServiceClient->undeployProcessorVersion($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $documentProcessorServiceClient->undeployProcessorVersion($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentProcessorServiceClient->resumeOperation($operationName, 'undeployProcessorVersion'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The processor version resource name to be undeployed. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function undeployProcessorVersion($name, array $optionalArgs = []) + { + $request = new UndeployProcessorVersionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UndeployProcessorVersion', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * $response = $documentProcessorServiceClient->getLocation(); + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $documentProcessorServiceClient = new DocumentProcessorServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $documentProcessorServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $documentProcessorServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $documentProcessorServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/owl-bot-staging/DocumentAi/v1/src/V1/gapic_metadata.json b/owl-bot-staging/DocumentAi/v1/src/V1/gapic_metadata.json new file mode 100644 index 000000000000..b6a28df90b49 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/src/V1/gapic_metadata.json @@ -0,0 +1,138 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.documentai.v1", + "libraryPackage": "Google\\Cloud\\DocumentAI\\V1", + "services": { + "DocumentProcessorService": { + "clients": { + "grpc": { + "libraryClient": "DocumentProcessorServiceGapicClient", + "rpcs": { + "BatchProcessDocuments": { + "methods": [ + "batchProcessDocuments" + ] + }, + "CreateProcessor": { + "methods": [ + "createProcessor" + ] + }, + "DeleteProcessor": { + "methods": [ + "deleteProcessor" + ] + }, + "DeleteProcessorVersion": { + "methods": [ + "deleteProcessorVersion" + ] + }, + "DeployProcessorVersion": { + "methods": [ + "deployProcessorVersion" + ] + }, + "DisableProcessor": { + "methods": [ + "disableProcessor" + ] + }, + "EnableProcessor": { + "methods": [ + "enableProcessor" + ] + }, + "EvaluateProcessorVersion": { + "methods": [ + "evaluateProcessorVersion" + ] + }, + "FetchProcessorTypes": { + "methods": [ + "fetchProcessorTypes" + ] + }, + "GetEvaluation": { + "methods": [ + "getEvaluation" + ] + }, + "GetProcessor": { + "methods": [ + "getProcessor" + ] + }, + "GetProcessorType": { + "methods": [ + "getProcessorType" + ] + }, + "GetProcessorVersion": { + "methods": [ + "getProcessorVersion" + ] + }, + "ListEvaluations": { + "methods": [ + "listEvaluations" + ] + }, + "ListProcessorTypes": { + "methods": [ + "listProcessorTypes" + ] + }, + "ListProcessorVersions": { + "methods": [ + "listProcessorVersions" + ] + }, + "ListProcessors": { + "methods": [ + "listProcessors" + ] + }, + "ProcessDocument": { + "methods": [ + "processDocument" + ] + }, + "ReviewDocument": { + "methods": [ + "reviewDocument" + ] + }, + "SetDefaultProcessorVersion": { + "methods": [ + "setDefaultProcessorVersion" + ] + }, + "TrainProcessorVersion": { + "methods": [ + "trainProcessorVersion" + ] + }, + "UndeployProcessorVersion": { + "methods": [ + "undeployProcessorVersion" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/DocumentAi/v1/src/V1/resources/document_processor_service_client_config.json b/owl-bot-staging/DocumentAi/v1/src/V1/resources/document_processor_service_client_config.json new file mode 100644 index 000000000000..30f1e5961a04 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/src/V1/resources/document_processor_service_client_config.json @@ -0,0 +1,168 @@ +{ + "interfaces": { + "google.cloud.documentai.v1.DocumentProcessorService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "retry_policy_2_codes": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 300000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 300000, + "total_timeout_millis": 300000 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 120000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 120000, + "total_timeout_millis": 120000 + } + }, + "methods": { + "BatchProcessDocuments": { + "timeout_millis": 120000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "CreateProcessor": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteProcessor": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeleteProcessorVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DeployProcessorVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "DisableProcessor": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "EnableProcessor": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "EvaluateProcessorVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "FetchProcessorTypes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetEvaluation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetProcessor": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetProcessorType": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetProcessorVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListEvaluations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListProcessorTypes": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListProcessorVersions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListProcessors": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ProcessDocument": { + "timeout_millis": 300000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ReviewDocument": { + "timeout_millis": 120000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "SetDefaultProcessorVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "TrainProcessorVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "UndeployProcessorVersion": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + } + } + } + } +} diff --git a/owl-bot-staging/DocumentAi/v1/src/V1/resources/document_processor_service_descriptor_config.php b/owl-bot-staging/DocumentAi/v1/src/V1/resources/document_processor_service_descriptor_config.php new file mode 100644 index 000000000000..02419d079216 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/src/V1/resources/document_processor_service_descriptor_config.php @@ -0,0 +1,423 @@ + [ + 'google.cloud.documentai.v1.DocumentProcessorService' => [ + 'BatchProcessDocuments' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DocumentAI\V1\BatchProcessResponse', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\BatchProcessMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteProcessor' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\DeleteProcessorMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteProcessorVersion' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\DeleteProcessorVersionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeployProcessorVersion' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DocumentAI\V1\DeployProcessorVersionResponse', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\DeployProcessorVersionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DisableProcessor' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DocumentAI\V1\DisableProcessorResponse', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\DisableProcessorMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'EnableProcessor' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DocumentAI\V1\EnableProcessorResponse', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\EnableProcessorMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'EvaluateProcessorVersion' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DocumentAI\V1\EvaluateProcessorVersionResponse', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\EvaluateProcessorVersionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'processor_version', + 'fieldAccessors' => [ + 'getProcessorVersion', + ], + ], + ], + ], + 'ReviewDocument' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DocumentAI\V1\ReviewDocumentResponse', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\ReviewDocumentOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'human_review_config', + 'fieldAccessors' => [ + 'getHumanReviewConfig', + ], + ], + ], + ], + 'SetDefaultProcessorVersion' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DocumentAI\V1\SetDefaultProcessorVersionResponse', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\SetDefaultProcessorVersionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'processor', + 'fieldAccessors' => [ + 'getProcessor', + ], + ], + ], + ], + 'TrainProcessorVersion' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DocumentAI\V1\TrainProcessorVersionResponse', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\TrainProcessorVersionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UndeployProcessorVersion' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DocumentAI\V1\UndeployProcessorVersionResponse', + 'metadataReturnType' => '\Google\Cloud\DocumentAI\V1\UndeployProcessorVersionMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'CreateProcessor' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\Processor', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'FetchProcessorTypes' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\FetchProcessorTypesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'GetEvaluation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\Evaluation', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetProcessor' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\Processor', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetProcessorType' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\ProcessorType', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetProcessorVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\ProcessorVersion', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListEvaluations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getEvaluations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\ListEvaluationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListProcessorTypes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProcessorTypes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\ListProcessorTypesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListProcessorVersions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProcessorVersions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\ListProcessorVersionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListProcessors' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProcessors', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\ListProcessorsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ProcessDocument' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DocumentAI\V1\ProcessResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'evaluation' => 'projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}', + 'humanReviewConfig' => 'projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig', + 'location' => 'projects/{project}/locations/{location}', + 'processor' => 'projects/{project}/locations/{location}/processors/{processor}', + 'processorType' => 'projects/{project}/locations/{location}/processorTypes/{processor_type}', + 'processorVersion' => 'projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}', + ], + ], + ], +]; diff --git a/owl-bot-staging/DocumentAi/v1/src/V1/resources/document_processor_service_rest_client_config.php b/owl-bot-staging/DocumentAi/v1/src/V1/resources/document_processor_service_rest_client_config.php new file mode 100644 index 000000000000..3d47d46a5bc8 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/src/V1/resources/document_processor_service_rest_client_config.php @@ -0,0 +1,369 @@ + [ + 'google.cloud.documentai.v1.DocumentProcessorService' => [ + 'BatchProcessDocuments' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*}:batchProcess', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'CreateProcessor' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/processors', + 'body' => 'processor', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteProcessor' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteProcessorVersion' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeployProcessorVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DisableProcessor' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*}:disable', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'EnableProcessor' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*}:enable', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'EvaluateProcessorVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{processor_version=projects/*/locations/*/processors/*/processorVersions/*}:evaluateProcessorVersion', + 'body' => '*', + 'placeholders' => [ + 'processor_version' => [ + 'getters' => [ + 'getProcessorVersion', + ], + ], + ], + ], + 'FetchProcessorTypes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}:fetchProcessorTypes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'GetEvaluation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*/processorVersions/*/evaluations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetProcessor' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetProcessorType' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processorTypes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetProcessorVersion' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListEvaluations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/processors/*/processorVersions/*}/evaluations', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProcessorTypes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/processorTypes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProcessorVersions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/processors/*}/processorVersions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListProcessors' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/processors', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ProcessDocument' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*}:process', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:process', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ReviewDocument' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument', + 'body' => '*', + 'placeholders' => [ + 'human_review_config' => [ + 'getters' => [ + 'getHumanReviewConfig', + ], + ], + ], + ], + 'SetDefaultProcessorVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion', + 'body' => '*', + 'placeholders' => [ + 'processor' => [ + 'getters' => [ + 'getProcessor', + ], + ], + ], + ], + 'TrainProcessorVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/processors/*}/processorVersions:train', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UndeployProcessorVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/uiv1beta3/{name=projects/*/locations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/locations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/uiv1beta3/{name=projects/*}/locations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}:cancel', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/uiv1beta3/{name=projects/*/locations/*/operations/*}:cancel', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/uiv1beta3/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/uiv1beta3/{name=projects/*/locations/*/operations}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/owl-bot-staging/DocumentAi/v1/tests/Unit/V1/Client/DocumentProcessorServiceClientTest.php b/owl-bot-staging/DocumentAi/v1/tests/Unit/V1/Client/DocumentProcessorServiceClientTest.php new file mode 100644 index 000000000000..dca152cb8451 --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/tests/Unit/V1/Client/DocumentProcessorServiceClientTest.php @@ -0,0 +1,2425 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DocumentProcessorServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DocumentProcessorServiceClient($options); + } + + /** @test */ + public function batchProcessDocumentsTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/batchProcessDocumentsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchProcessResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchProcessDocumentsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $name = 'name3373707'; + $request = (new BatchProcessRequest()) + ->setName($name); + $response = $gapicClient->batchProcessDocuments($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/BatchProcessDocuments', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchProcessDocumentsTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function batchProcessDocumentsExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/batchProcessDocumentsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new BatchProcessRequest()) + ->setName($name); + $response = $gapicClient->batchProcessDocuments($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchProcessDocumentsTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createProcessorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $type = 'type3575610'; + $displayName = 'displayName1615086568'; + $defaultProcessorVersion = 'defaultProcessorVersion1185902509'; + $processEndpoint = 'processEndpoint-178717339'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new Processor(); + $expectedResponse->setName($name); + $expectedResponse->setType($type); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDefaultProcessorVersion($defaultProcessorVersion); + $expectedResponse->setProcessEndpoint($processEndpoint); + $expectedResponse->setKmsKeyName($kmsKeyName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $processor = new Processor(); + $request = (new CreateProcessorRequest()) + ->setParent($formattedParent) + ->setProcessor($processor); + $response = $gapicClient->createProcessor($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/CreateProcessor', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getProcessor(); + $this->assertProtobufEquals($processor, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createProcessorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $processor = new Processor(); + $request = (new CreateProcessorRequest()) + ->setParent($formattedParent) + ->setProcessor($processor); + try { + $gapicClient->createProcessor($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteProcessorTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteProcessorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new DeleteProcessorRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteProcessor($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/DeleteProcessor', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteProcessorTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteProcessorExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new DeleteProcessorRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteProcessor($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteProcessorTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new DeleteProcessorVersionRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/DeleteProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new DeleteProcessorVersionRequest()) + ->setName($formattedName); + $response = $gapicClient->deleteProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deployProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deployProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new DeployProcessorVersionResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deployProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new DeployProcessorVersionRequest()) + ->setName($formattedName); + $response = $gapicClient->deployProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/DeployProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deployProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deployProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deployProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new DeployProcessorVersionRequest()) + ->setName($formattedName); + $response = $gapicClient->deployProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deployProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function disableProcessorTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/disableProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new DisableProcessorResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/disableProcessorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new DisableProcessorRequest()) + ->setName($formattedName); + $response = $gapicClient->disableProcessor($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/DisableProcessor', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/disableProcessorTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function disableProcessorExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/disableProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new DisableProcessorRequest()) + ->setName($formattedName); + $response = $gapicClient->disableProcessor($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/disableProcessorTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function enableProcessorTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/enableProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new EnableProcessorResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/enableProcessorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new EnableProcessorRequest()) + ->setName($formattedName); + $response = $gapicClient->enableProcessor($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/EnableProcessor', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/enableProcessorTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function enableProcessorExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/enableProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new EnableProcessorRequest()) + ->setName($formattedName); + $response = $gapicClient->enableProcessor($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/enableProcessorTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function evaluateProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/evaluateProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $evaluation = 'evaluation858523452'; + $expectedResponse = new EvaluateProcessorVersionResponse(); + $expectedResponse->setEvaluation($evaluation); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/evaluateProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedProcessorVersion = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new EvaluateProcessorVersionRequest()) + ->setProcessorVersion($formattedProcessorVersion); + $response = $gapicClient->evaluateProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/EvaluateProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getProcessorVersion(); + $this->assertProtobufEquals($formattedProcessorVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/evaluateProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function evaluateProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/evaluateProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedProcessorVersion = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new EvaluateProcessorVersionRequest()) + ->setProcessorVersion($formattedProcessorVersion); + $response = $gapicClient->evaluateProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/evaluateProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function fetchProcessorTypesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchProcessorTypesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new FetchProcessorTypesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->fetchProcessorTypes($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/FetchProcessorTypes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchProcessorTypesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new FetchProcessorTypesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->fetchProcessorTypes($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEvaluationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $kmsKeyName = 'kmsKeyName2094986649'; + $kmsKeyVersionName = 'kmsKeyVersionName-1734350176'; + $expectedResponse = new Evaluation(); + $expectedResponse->setName($name2); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setKmsKeyVersionName($kmsKeyVersionName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->evaluationName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]', '[EVALUATION]'); + $request = (new GetEvaluationRequest()) + ->setName($formattedName); + $response = $gapicClient->getEvaluation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/GetEvaluation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEvaluationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->evaluationName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]', '[EVALUATION]'); + $request = (new GetEvaluationRequest()) + ->setName($formattedName); + try { + $gapicClient->getEvaluation($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $displayName = 'displayName1615086568'; + $defaultProcessorVersion = 'defaultProcessorVersion1185902509'; + $processEndpoint = 'processEndpoint-178717339'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new Processor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDefaultProcessorVersion($defaultProcessorVersion); + $expectedResponse->setProcessEndpoint($processEndpoint); + $expectedResponse->setKmsKeyName($kmsKeyName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new GetProcessorRequest()) + ->setName($formattedName); + $response = $gapicClient->getProcessor($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/GetProcessor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new GetProcessorRequest()) + ->setName($formattedName); + try { + $gapicClient->getProcessor($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorTypeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $category = 'category50511102'; + $allowCreation = false; + $expectedResponse = new ProcessorType(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setCategory($category); + $expectedResponse->setAllowCreation($allowCreation); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->processorTypeName('[PROJECT]', '[LOCATION]', '[PROCESSOR_TYPE]'); + $request = (new GetProcessorTypeRequest()) + ->setName($formattedName); + $response = $gapicClient->getProcessorType($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/GetProcessorType', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorTypeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorTypeName('[PROJECT]', '[LOCATION]', '[PROCESSOR_TYPE]'); + $request = (new GetProcessorTypeRequest()) + ->setName($formattedName); + try { + $gapicClient->getProcessorType($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $kmsKeyName = 'kmsKeyName2094986649'; + $kmsKeyVersionName = 'kmsKeyVersionName-1734350176'; + $googleManaged = false; + $expectedResponse = new ProcessorVersion(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setKmsKeyVersionName($kmsKeyVersionName); + $expectedResponse->setGoogleManaged($googleManaged); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new GetProcessorVersionRequest()) + ->setName($formattedName); + $response = $gapicClient->getProcessorVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/GetProcessorVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new GetProcessorVersionRequest()) + ->setName($formattedName); + try { + $gapicClient->getProcessorVersion($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEvaluationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $evaluationsElement = new Evaluation(); + $evaluations = [ + $evaluationsElement, + ]; + $expectedResponse = new ListEvaluationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setEvaluations($evaluations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new ListEvaluationsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listEvaluations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getEvaluations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ListEvaluations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEvaluationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new ListEvaluationsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listEvaluations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorTypesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $processorTypesElement = new ProcessorType(); + $processorTypes = [ + $processorTypesElement, + ]; + $expectedResponse = new ListProcessorTypesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProcessorTypes($processorTypes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListProcessorTypesRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listProcessorTypes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProcessorTypes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ListProcessorTypes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorTypesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListProcessorTypesRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listProcessorTypes($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorVersionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $processorVersionsElement = new ProcessorVersion(); + $processorVersions = [ + $processorVersionsElement, + ]; + $expectedResponse = new ListProcessorVersionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProcessorVersions($processorVersions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new ListProcessorVersionsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listProcessorVersions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProcessorVersions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ListProcessorVersions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorVersionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new ListProcessorVersionsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listProcessorVersions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $processorsElement = new Processor(); + $processors = [ + $processorsElement, + ]; + $expectedResponse = new ListProcessorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProcessors($processors); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListProcessorsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listProcessors($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProcessors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ListProcessors', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListProcessorsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listProcessors($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function processDocumentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ProcessResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $request = (new ProcessRequest()) + ->setName($name); + $response = $gapicClient->processDocument($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ProcessDocument', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function processDocumentExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $request = (new ProcessRequest()) + ->setName($name); + try { + $gapicClient->processDocument($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function reviewDocumentTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/reviewDocumentTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $gcsDestination = 'gcsDestination714819302'; + $rejectionReason = 'rejectionReason2141394746'; + $expectedResponse = new ReviewDocumentResponse(); + $expectedResponse->setGcsDestination($gcsDestination); + $expectedResponse->setRejectionReason($rejectionReason); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/reviewDocumentTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedHumanReviewConfig = $gapicClient->humanReviewConfigName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new ReviewDocumentRequest()) + ->setHumanReviewConfig($formattedHumanReviewConfig); + $response = $gapicClient->reviewDocument($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ReviewDocument', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getHumanReviewConfig(); + $this->assertProtobufEquals($formattedHumanReviewConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/reviewDocumentTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function reviewDocumentExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/reviewDocumentTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedHumanReviewConfig = $gapicClient->humanReviewConfigName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $request = (new ReviewDocumentRequest()) + ->setHumanReviewConfig($formattedHumanReviewConfig); + $response = $gapicClient->reviewDocument($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/reviewDocumentTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function setDefaultProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/setDefaultProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new SetDefaultProcessorVersionResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/setDefaultProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedProcessor = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $formattedDefaultProcessorVersion = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new SetDefaultProcessorVersionRequest()) + ->setProcessor($formattedProcessor) + ->setDefaultProcessorVersion($formattedDefaultProcessorVersion); + $response = $gapicClient->setDefaultProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/SetDefaultProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getProcessor(); + $this->assertProtobufEquals($formattedProcessor, $actualValue); + $actualValue = $actualApiRequestObject->getDefaultProcessorVersion(); + $this->assertProtobufEquals($formattedDefaultProcessorVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/setDefaultProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function setDefaultProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/setDefaultProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedProcessor = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $formattedDefaultProcessorVersion = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new SetDefaultProcessorVersionRequest()) + ->setProcessor($formattedProcessor) + ->setDefaultProcessorVersion($formattedDefaultProcessorVersion); + $response = $gapicClient->setDefaultProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/setDefaultProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function trainProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/trainProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $processorVersion2 = 'processorVersion2-1092580578'; + $expectedResponse = new TrainProcessorVersionResponse(); + $expectedResponse->setProcessorVersion($processorVersion2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/trainProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $processorVersion = new ProcessorVersion(); + $request = (new TrainProcessorVersionRequest()) + ->setParent($formattedParent) + ->setProcessorVersion($processorVersion); + $response = $gapicClient->trainProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/TrainProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getProcessorVersion(); + $this->assertProtobufEquals($processorVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/trainProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function trainProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/trainProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $processorVersion = new ProcessorVersion(); + $request = (new TrainProcessorVersionRequest()) + ->setParent($formattedParent) + ->setProcessorVersion($processorVersion); + $response = $gapicClient->trainProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/trainProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function undeployProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/undeployProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new UndeployProcessorVersionResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/undeployProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new UndeployProcessorVersionRequest()) + ->setName($formattedName); + $response = $gapicClient->undeployProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/UndeployProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/undeployProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function undeployProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/undeployProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $request = (new UndeployProcessorVersionRequest()) + ->setName($formattedName); + $response = $gapicClient->undeployProcessorVersion($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/undeployProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function batchProcessDocumentsAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/batchProcessDocumentsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchProcessResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchProcessDocumentsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $name = 'name3373707'; + $request = (new BatchProcessRequest()) + ->setName($name); + $response = $gapicClient->batchProcessDocumentsAsync($request)->wait(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/BatchProcessDocuments', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchProcessDocumentsTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/owl-bot-staging/DocumentAi/v1/tests/Unit/V1/DocumentProcessorServiceClientTest.php b/owl-bot-staging/DocumentAi/v1/tests/Unit/V1/DocumentProcessorServiceClientTest.php new file mode 100644 index 000000000000..0b4d77a1555d --- /dev/null +++ b/owl-bot-staging/DocumentAi/v1/tests/Unit/V1/DocumentProcessorServiceClientTest.php @@ -0,0 +1,2239 @@ +getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + } + + /** @return DocumentProcessorServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DocumentProcessorServiceClient($options); + } + + /** @test */ + public function batchProcessDocumentsTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/batchProcessDocumentsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new BatchProcessResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/batchProcessDocumentsTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->batchProcessDocuments($name); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/BatchProcessDocuments', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchProcessDocumentsTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function batchProcessDocumentsExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/batchProcessDocumentsTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->batchProcessDocuments($name); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/batchProcessDocumentsTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createProcessorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $type = 'type3575610'; + $displayName = 'displayName1615086568'; + $defaultProcessorVersion = 'defaultProcessorVersion1185902509'; + $processEndpoint = 'processEndpoint-178717339'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new Processor(); + $expectedResponse->setName($name); + $expectedResponse->setType($type); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDefaultProcessorVersion($defaultProcessorVersion); + $expectedResponse->setProcessEndpoint($processEndpoint); + $expectedResponse->setKmsKeyName($kmsKeyName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $processor = new Processor(); + $response = $gapicClient->createProcessor($formattedParent, $processor); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/CreateProcessor', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getProcessor(); + $this->assertProtobufEquals($processor, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createProcessorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $processor = new Processor(); + try { + $gapicClient->createProcessor($formattedParent, $processor); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteProcessorTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteProcessorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->deleteProcessor($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/DeleteProcessor', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteProcessorTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteProcessorExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->deleteProcessor($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteProcessorTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->deleteProcessorVersion($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/DeleteProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deleteProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deleteProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->deleteProcessorVersion($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deployProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deployProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new DeployProcessorVersionResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deployProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->deployProcessorVersion($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/DeployProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deployProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function deployProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/deployProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->deployProcessorVersion($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deployProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function disableProcessorTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/disableProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new DisableProcessorResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/disableProcessorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->disableProcessor($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/DisableProcessor', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/disableProcessorTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function disableProcessorExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/disableProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->disableProcessor($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/disableProcessorTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function enableProcessorTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/enableProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new EnableProcessorResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/enableProcessorTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->enableProcessor($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/EnableProcessor', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/enableProcessorTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function enableProcessorExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/enableProcessorTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->enableProcessor($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/enableProcessorTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function evaluateProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/evaluateProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $evaluation = 'evaluation858523452'; + $expectedResponse = new EvaluateProcessorVersionResponse(); + $expectedResponse->setEvaluation($evaluation); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/evaluateProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedProcessorVersion = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->evaluateProcessorVersion($formattedProcessorVersion); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/EvaluateProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getProcessorVersion(); + $this->assertProtobufEquals($formattedProcessorVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/evaluateProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function evaluateProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/evaluateProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedProcessorVersion = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->evaluateProcessorVersion($formattedProcessorVersion); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/evaluateProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function fetchProcessorTypesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchProcessorTypesResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->fetchProcessorTypes($formattedParent); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/FetchProcessorTypes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchProcessorTypesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->fetchProcessorTypes($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEvaluationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $kmsKeyName = 'kmsKeyName2094986649'; + $kmsKeyVersionName = 'kmsKeyVersionName-1734350176'; + $expectedResponse = new Evaluation(); + $expectedResponse->setName($name2); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setKmsKeyVersionName($kmsKeyVersionName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->evaluationName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]', '[EVALUATION]'); + $response = $gapicClient->getEvaluation($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/GetEvaluation', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getEvaluationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->evaluationName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]', '[EVALUATION]'); + try { + $gapicClient->getEvaluation($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $displayName = 'displayName1615086568'; + $defaultProcessorVersion = 'defaultProcessorVersion1185902509'; + $processEndpoint = 'processEndpoint-178717339'; + $kmsKeyName = 'kmsKeyName2094986649'; + $expectedResponse = new Processor(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDefaultProcessorVersion($defaultProcessorVersion); + $expectedResponse->setProcessEndpoint($processEndpoint); + $expectedResponse->setKmsKeyName($kmsKeyName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->getProcessor($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/GetProcessor', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + try { + $gapicClient->getProcessor($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorTypeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $type = 'type3575610'; + $category = 'category50511102'; + $allowCreation = false; + $expectedResponse = new ProcessorType(); + $expectedResponse->setName($name2); + $expectedResponse->setType($type); + $expectedResponse->setCategory($category); + $expectedResponse->setAllowCreation($allowCreation); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->processorTypeName('[PROJECT]', '[LOCATION]', '[PROCESSOR_TYPE]'); + $response = $gapicClient->getProcessorType($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/GetProcessorType', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorTypeExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorTypeName('[PROJECT]', '[LOCATION]', '[PROCESSOR_TYPE]'); + try { + $gapicClient->getProcessorType($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $kmsKeyName = 'kmsKeyName2094986649'; + $kmsKeyVersionName = 'kmsKeyVersionName-1734350176'; + $googleManaged = false; + $expectedResponse = new ProcessorVersion(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setKmsKeyName($kmsKeyName); + $expectedResponse->setKmsKeyVersionName($kmsKeyVersionName); + $expectedResponse->setGoogleManaged($googleManaged); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->getProcessorVersion($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/GetProcessorVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getProcessorVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + try { + $gapicClient->getProcessorVersion($formattedName); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEvaluationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $evaluationsElement = new Evaluation(); + $evaluations = [ + $evaluationsElement, + ]; + $expectedResponse = new ListEvaluationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setEvaluations($evaluations); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->listEvaluations($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getEvaluations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ListEvaluations', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listEvaluationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + try { + $gapicClient->listEvaluations($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorTypesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $processorTypesElement = new ProcessorType(); + $processorTypes = [ + $processorTypesElement, + ]; + $expectedResponse = new ListProcessorTypesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProcessorTypes($processorTypes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listProcessorTypes($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProcessorTypes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ListProcessorTypes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorTypesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listProcessorTypes($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorVersionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $processorVersionsElement = new ProcessorVersion(); + $processorVersions = [ + $processorVersionsElement, + ]; + $expectedResponse = new ListProcessorVersionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProcessorVersions($processorVersions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->listProcessorVersions($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProcessorVersions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ListProcessorVersions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorVersionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + try { + $gapicClient->listProcessorVersions($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $processorsElement = new Processor(); + $processors = [ + $processorsElement, + ]; + $expectedResponse = new ListProcessorsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProcessors($processors); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $response = $gapicClient->listProcessors($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProcessors()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ListProcessors', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listProcessorsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + try { + $gapicClient->listProcessors($formattedParent); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function processDocumentTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ProcessResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $name = 'name3373707'; + $response = $gapicClient->processDocument($name); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ProcessDocument', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($name, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function processDocumentExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + // Mock request + $name = 'name3373707'; + try { + $gapicClient->processDocument($name); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function reviewDocumentTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/reviewDocumentTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $gcsDestination = 'gcsDestination714819302'; + $rejectionReason = 'rejectionReason2141394746'; + $expectedResponse = new ReviewDocumentResponse(); + $expectedResponse->setGcsDestination($gcsDestination); + $expectedResponse->setRejectionReason($rejectionReason); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/reviewDocumentTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedHumanReviewConfig = $gapicClient->humanReviewConfigName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->reviewDocument($formattedHumanReviewConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/ReviewDocument', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getHumanReviewConfig(); + $this->assertProtobufEquals($formattedHumanReviewConfig, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/reviewDocumentTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function reviewDocumentExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/reviewDocumentTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedHumanReviewConfig = $gapicClient->humanReviewConfigName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $response = $gapicClient->reviewDocument($formattedHumanReviewConfig); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/reviewDocumentTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function setDefaultProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/setDefaultProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new SetDefaultProcessorVersionResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/setDefaultProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedProcessor = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $formattedDefaultProcessorVersion = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->setDefaultProcessorVersion($formattedProcessor, $formattedDefaultProcessorVersion); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/SetDefaultProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getProcessor(); + $this->assertProtobufEquals($formattedProcessor, $actualValue); + $actualValue = $actualApiRequestObject->getDefaultProcessorVersion(); + $this->assertProtobufEquals($formattedDefaultProcessorVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/setDefaultProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function setDefaultProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/setDefaultProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedProcessor = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $formattedDefaultProcessorVersion = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->setDefaultProcessorVersion($formattedProcessor, $formattedDefaultProcessorVersion); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/setDefaultProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function trainProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/trainProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $processorVersion2 = 'processorVersion2-1092580578'; + $expectedResponse = new TrainProcessorVersionResponse(); + $expectedResponse->setProcessorVersion($processorVersion2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/trainProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $processorVersion = new ProcessorVersion(); + $response = $gapicClient->trainProcessorVersion($formattedParent, $processorVersion); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/TrainProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getProcessorVersion(); + $this->assertProtobufEquals($processorVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/trainProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function trainProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/trainProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->processorName('[PROJECT]', '[LOCATION]', '[PROCESSOR]'); + $processorVersion = new ProcessorVersion(); + $response = $gapicClient->trainProcessorVersion($formattedParent, $processorVersion); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/trainProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function undeployProcessorVersionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/undeployProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new UndeployProcessorVersionResponse(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/undeployProcessorVersionTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->undeployProcessorVersion($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.documentai.v1.DocumentProcessorService/UndeployProcessorVersion', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/undeployProcessorVersionTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function undeployProcessorVersionExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/undeployProcessorVersionTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->processorVersionName('[PROJECT]', '[LOCATION]', '[PROCESSOR]', '[PROCESSOR_VERSION]'); + $response = $gapicClient->undeployProcessorVersion($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/undeployProcessorVersionTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $response = $gapicClient->getLocation(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->getLocation(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [ + $locationsElement, + ]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $response = $gapicClient->listLocations(); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $transport->addResponse(null, $status); + try { + $gapicClient->listLocations(); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } +}