diff --git a/packages/google-cloud-documentai/README.md b/packages/google-cloud-documentai/README.md index 58ebf7d8167..cf6211fa336 100644 --- a/packages/google-cloud-documentai/README.md +++ b/packages/google-cloud-documentai/README.md @@ -162,15 +162,19 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Document_processor_service.deploy_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.deploy_processor_version.js,samples/README.md) | | Document_processor_service.disable_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.disable_processor.js,samples/README.md) | | Document_processor_service.enable_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.enable_processor.js,samples/README.md) | +| Document_processor_service.evaluate_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js,samples/README.md) | | Document_processor_service.fetch_processor_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js,samples/README.md) | +| Document_processor_service.get_evaluation | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_evaluation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_evaluation.js,samples/README.md) | | Document_processor_service.get_processor | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js,samples/README.md) | | Document_processor_service.get_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor_version.js,samples/README.md) | +| Document_processor_service.list_evaluations | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_evaluations.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_evaluations.js,samples/README.md) | | Document_processor_service.list_processor_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js,samples/README.md) | | Document_processor_service.list_processor_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_versions.js,samples/README.md) | | Document_processor_service.list_processors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processors.js,samples/README.md) | | Document_processor_service.process_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js,samples/README.md) | | Document_processor_service.review_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.review_document.js,samples/README.md) | | Document_processor_service.set_default_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.set_default_processor_version.js,samples/README.md) | +| Document_processor_service.train_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.train_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.train_processor_version.js,samples/README.md) | | Document_processor_service.undeploy_processor_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js,samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/quickstart.js,samples/README.md) | | Quickstart.test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/test/quickstart.test.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/test/quickstart.test.js,samples/README.md) | diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/barcode.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/barcode.proto index 7c7050a868b..9b063faf287 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/barcode.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/barcode.proto @@ -28,40 +28,42 @@ option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; message Barcode { // 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. + // + // - `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. string format = 1; // 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. + // + // - `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. string value_format = 2; // Raw value encoded in the barcode. - // For example, 'MEBKM:TITLE:Google;URL:https://www.google.com;;'. + // For example: `'MEBKM:TITLE:Google;URL:https://www.google.com;;'`. string raw_value = 3; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto index 809a64ea4c7..2ae46db8e24 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document.proto @@ -91,6 +91,10 @@ message Document { // Font size. FontSize font_size = 7; + + // Font family such as `Arial`, `Times New Roman`. + // https://www.w3schools.com/cssref/pr_font_font-family.asp + string font_family = 8; } // A page in a [Document][google.cloud.documentai.v1beta3.Document]. @@ -169,7 +173,7 @@ message Document { // Confidence of the current [Layout][google.cloud.documentai.v1beta3.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]. + // a visual element, etc. depending on context. Range `[0, 1]`. float confidence = 2; // The bounding polygon for the [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. @@ -189,7 +193,7 @@ message Document { repeated DetectedLanguage detected_languages = 2; // The history of this annotation. - Provenance provenance = 3; + Provenance provenance = 3 [deprecated = true]; } // A collection of lines that a human would perceive as a paragraph. @@ -201,7 +205,7 @@ message Document { repeated DetectedLanguage detected_languages = 2; // The history of this annotation. - Provenance provenance = 3; + Provenance provenance = 3 [deprecated = true]; } // A collection of tokens that a human would perceive as a line. @@ -214,7 +218,7 @@ message Document { repeated DetectedLanguage detected_languages = 2; // The history of this annotation. - Provenance provenance = 3; + Provenance provenance = 3 [deprecated = true]; } // A detected token. @@ -249,8 +253,8 @@ message Document { // A list of detected languages together with confidence. repeated DetectedLanguage detected_languages = 3; - // The history of this annotation. - Provenance provenance = 4; + // The history of this annotation. + Provenance provenance = 4 [deprecated = true]; } // A detected symbol. @@ -309,6 +313,9 @@ message Document { // A list of detected languages together with confidence. repeated DetectedLanguage detected_languages = 4; + + // The history of this table. + Provenance provenance = 5; } // A form field detected on the page. @@ -358,15 +365,43 @@ message Document { // Detected language for a structural component. message DetectedLanguage { - // The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // The BCP-47 language code, such as `en-US` or `sr-Latn`. For more // information, see // https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. string language_code = 1; - // Confidence of detected language. Range [0, 1]. + // Confidence of detected language. Range `[0, 1]`. float confidence = 2; } + // Image Quality Scores for the page image + message ImageQualityScores { + // Image Quality Defects + message DetectedDefect { + // 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` + string type = 1; + + // Confidence of detected defect. Range `[0, 1]` where 1 indicates + // strong confidence of that the defect exists. + float confidence = 2; + } + + // The overall quality score. Range `[0, 1]` where 1 is perfect quality. + float quality_score = 1; + + // A list of detected defects. + repeated DetectedDefect detected_defects = 2; + } + // 1-based index for current [Page][google.cloud.documentai.v1beta3.Document.Page] in a parent [Document][google.cloud.documentai.v1beta3.Document]. // Useful when a page is taken out of a [Document][google.cloud.documentai.v1beta3.Document] for individual // processing. @@ -422,8 +457,11 @@ message Document { // A list of detected barcodes. repeated DetectedBarcode detected_barcodes = 15; + // Image Quality Scores. + ImageQualityScores image_quality_scores = 17; + // The history of this page. - Provenance provenance = 16; + Provenance provenance = 16 [deprecated = true]; } // An entity that could be a phrase in the text or a property that belongs to @@ -471,6 +509,7 @@ message Document { // or int 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. @@ -484,14 +523,13 @@ message Document { // Required. Entity type from a schema e.g. `Address`. string type = 2 [(google.api.field_behavior) = REQUIRED]; - // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If the entity - // is not present in the document, this field will be empty. + // Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`. string mention_text = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Deprecated. Use `id` field instead. string mention_id = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Confidence of detected Schema entity. Range [0, 1]. + // Optional. Confidence of detected Schema entity. Range `[0, 1]`. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; // Optional. Represents the provenance of this entity wrt. the location on the @@ -605,7 +643,7 @@ message Document { // Optional. Identifies the bounding polygon of a layout element on the page. BoundingPoly bounding_poly = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Confidence of detected page element, if applicable. Range [0, 1]. + // Optional. Confidence of detected page element, if applicable. Range `[0, 1]`. float confidence = 5 [(google.api.field_behavior) = OPTIONAL]; } @@ -726,7 +764,7 @@ message Document { string changed_text = 2; // The history of this annotation. - repeated Provenance provenance = 3; + repeated Provenance provenance = 3 [deprecated = true]; } // Original source document from the user. @@ -765,9 +803,9 @@ message Document { // Placeholder. Relationship among [Document.entities][google.cloud.documentai.v1beta3.Document.entities]. repeated EntityRelation entity_relations = 8; - // Placeholder. A list of text corrections made to [Document.text]. This is - // usually used for annotating corrections to OCR mistakes. Text changes for - // a given revision may not overlap with each other. + // Placeholder. A list of text corrections made to [Document.text][google.cloud.documentai.v1beta3.Document.text]. This + // is usually used for annotating corrections to OCR mistakes. Text changes + // for a given revision may not overlap with each other. repeated TextChange text_changes = 14; // Information about the sharding if this document is sharded part of a larger diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto index a0d410c8cb4..e41458e0a24 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto @@ -16,6 +16,8 @@ syntax = "proto3"; package google.cloud.documentai.v1beta3; +import "google/protobuf/field_mask.proto"; + option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; option java_multiple_files = true; @@ -30,7 +32,7 @@ message RawDocument { bytes content = 1; // An IANA MIME type (RFC6838) indicating the nature and format of the - // [content]. + // [content][google.cloud.documentai.v1beta3.RawDocument.content]. string mime_type = 2; } @@ -59,7 +61,7 @@ message GcsPrefix { message BatchDocumentsInputConfig { // The source. oneof source { - // The set of documents that match the specified Cloud Storage [gcs_prefix]. + // The set of documents that match the specified Cloud Storage `gcs_prefix`. GcsPrefix gcs_prefix = 1; // The set of documents individually specified on Cloud Storage. @@ -74,6 +76,11 @@ message DocumentOutputConfig { message GcsOutputConfig { // The Cloud Storage uri (a directory) of the output. string gcs_uri = 1; + + // 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}`. + google.protobuf.FieldMask field_mask = 2; } // The destination of the results. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto index 952db5904d5..34e3380413b 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_processor_service.proto @@ -23,6 +23,7 @@ import "google/api/resource.proto"; import "google/cloud/documentai/v1beta3/document.proto"; import "google/cloud/documentai/v1beta3/document_io.proto"; import "google/cloud/documentai/v1beta3/document_schema.proto"; +import "google/cloud/documentai/v1beta3/evaluation.proto"; import "google/cloud/documentai/v1beta3/operation_metadata.proto"; import "google/cloud/documentai/v1beta3/processor.proto"; import "google/cloud/documentai/v1beta3/processor_type.proto"; @@ -119,6 +120,21 @@ service DocumentProcessorService { option (google.api.method_signature) = "name"; } + // Trains a new processor version. + // Operation metadata is returned as + // cloud_documentai_core.TrainProcessorVersionMetadata. + rpc TrainProcessorVersion(TrainProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta3/{parent=projects/*/locations/*/processors/*}/processorVersions:train" + body: "*" + }; + option (google.api.method_signature) = "parent,processor_version"; + option (google.longrunning.operation_info) = { + response_type: "TrainProcessorVersionResponse" + metadata_type: "TrainProcessorVersionMetadata" + }; + } + // Gets a processor version detail. rpc GetProcessorVersion(GetProcessorVersionRequest) returns (ProcessorVersion) { option (google.api.http) = { @@ -248,6 +264,36 @@ service DocumentProcessorService { metadata_type: "ReviewDocumentOperationMetadata" }; } + + // Evaluates a ProcessorVersion against annotated documents, producing an + // Evaluation. + rpc EvaluateProcessorVersion(EvaluateProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1beta3/{processor_version=projects/*/locations/*/processors/*/processorVersions/*}:evaluateProcessorVersion" + body: "*" + }; + option (google.api.method_signature) = "processor_version"; + option (google.longrunning.operation_info) = { + response_type: "EvaluateProcessorVersionResponse" + metadata_type: "EvaluateProcessorVersionMetadata" + }; + } + + // Retrieves a specific evaluation. + rpc GetEvaluation(GetEvaluationRequest) returns (Evaluation) { + option (google.api.http) = { + get: "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*/evaluations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Retrieves a set of evaluations for a given processor version. + rpc ListEvaluations(ListEvaluationsRequest) returns (ListEvaluationsResponse) { + option (google.api.http) = { + get: "/v1beta3/{parent=projects/*/locations/*/processors/*/processorVersions/*}/evaluations" + }; + option (google.api.method_signature) = "parent"; + } } // Request message for the process document method. @@ -282,6 +328,8 @@ message ProcessRequest { bool skip_human_review = 3; // Specifies which fields to include in ProcessResponse's document. + // Only supports top level document and pages field so it must be in the form + // of `{document_field_name}` or `pages.{page_field_name}`. google.protobuf.FieldMask field_mask = 6; } @@ -769,6 +817,79 @@ message SetDefaultProcessorVersionMetadata { CommonOperationMetadata common_metadata = 1; } +// Request message for the create processor version method. +message TrainProcessorVersionRequest { + // The input data used to train a new `ProcessorVersion`. + message InputData { + // The documents used for training the new version. + BatchDocumentsInputConfig training_documents = 3; + + // The documents used for testing the trained version. + BatchDocumentsInputConfig test_documents = 4; + } + + // Required. The parent (project, location and processor) to create the new version for. + // Format: `projects/{project}/locations/{location}/processors/{processor}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/ProcessorVersion" + } + ]; + + // Required. The processor version to be created. + ProcessorVersion processor_version = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The schema the processor version will be trained with. + DocumentSchema document_schema = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The input data used to train the `ProcessorVersion`. + InputData input_data = 4 [(google.api.field_behavior) = OPTIONAL]; + + // 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}`. + string base_processor_version = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response for the TrainProcessorVersion method. +message TrainProcessorVersionResponse { + // The resource name of the processor version produced by training. + string processor_version = 1; +} + +// The metadata that represents a processor version being created. +message TrainProcessorVersionMetadata { + // The dataset validation information. + // This includes any and all errors with documents and the dataset. + message DatasetValidation { + // The total number of document errors. + int32 document_error_count = 3; + + // The total number of dataset errors. + int32 dataset_error_count = 4; + + // 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. + repeated google.rpc.Status document_errors = 1; + + // 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. + repeated google.rpc.Status dataset_errors = 2; + } + + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; + + // The training dataset validation information. + DatasetValidation training_dataset_validation = 2; + + // The test dataset validation information. + DatasetValidation test_dataset_validation = 3; +} + // Request message for review document method. message ReviewDocumentRequest { // The priority level of the human review task. @@ -876,3 +997,74 @@ message ReviewDocumentOperationMetadata { // The Crowd Compute question ID. string question_id = 6; } + +// Evaluates the given ProcessorVersion against the supplied documents. +message EvaluateProcessorVersionRequest { + // Required. The resource name of the [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion] to evaluate. + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + string processor_version = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; + + // Optional. The documents used in the evaluation. If unspecified, use the processor's + // dataset as evaluation input. + BatchDocumentsInputConfig evaluation_documents = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Metadata of the EvaluateProcessorVersion method. +message EvaluateProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + +// Metadata of the EvaluateProcessorVersion method. +message EvaluateProcessorVersionResponse { + // The resource name of the created evaluation. + string evaluation = 2; +} + +// Retrieves a specific Evaluation. +message GetEvaluationRequest { + // Required. The resource name of the [Evaluation][google.cloud.documentai.v1beta3.Evaluation] to get. + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Evaluation" + } + ]; +} + +// Retrieves a list of evaluations for a given ProcessorVersion. +message ListEvaluationsRequest { + // Required. The resource name of the [ProcessorVersion][google.cloud.documentai.v1beta3.ProcessorVersion] to list evaluations for. + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; + + // The standard list page size. + // If unspecified, at most 5 evaluations will be returned. + // The maximum value is 100; values above 100 will be coerced to 100. + int32 page_size = 2; + + // A page token, received from a previous `ListEvaluations` call. + // Provide this to retrieve the subsequent page. + string page_token = 3; +} + +// The response from ListEvaluations. +message ListEvaluationsResponse { + // The evaluations requested. + repeated Evaluation evaluations = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_schema.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_schema.proto index 214e56864de..1e29f7c89d9 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_schema.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_schema.proto @@ -86,15 +86,16 @@ message DocumentSchema { // Name of the type. It must be unique within the schema file and // cannot be a 'Common Type'. Besides that we use the following naming // conventions: - // - *use snake_casing* + // + // - *use `snake_casing`* // - name matching is case-insensitive // - 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 + // - 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. string name = 1; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/evaluation.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/evaluation.proto new file mode 100644 index 00000000000..c6aa30e7ab4 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/evaluation.proto @@ -0,0 +1,164 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.documentai.v1beta3; + +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiEvaluation"; +option java_package = "com.google.cloud.documentai.v1beta3"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3"; +option ruby_package = "Google::Cloud::DocumentAI::V1beta3"; + +// An evaluation of a ProcessorVersion's performance. +message Evaluation { + option (google.api.resource) = { + type: "documentai.googleapis.com/Evaluation" + pattern: "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}" + }; + + // Evaluation counters for the documents that were used. + message Counters { + // How many documents were sent for evaluation. + int32 input_documents_count = 1; + + // How many documents were not included in the evaluation as they didn't + // pass validation. + int32 invalid_documents_count = 2; + + // How many documents were not included in the evaluation as Document AI + // failed to process them. + int32 failed_documents_count = 3; + + // How many documents were used in the evaluation. + int32 evaluated_documents_count = 4; + } + + // Evaluation metrics, either in aggregate or about a specific entity. + message Metrics { + // The calculated precision. + float precision = 1; + + // The calculated recall. + float recall = 2; + + // The calculated f1 score. + float f1_score = 3; + + // The amount of occurrences in predicted documents. + int32 predicted_occurrences_count = 4; + + // The amount of occurrences in ground truth documents. + int32 ground_truth_occurrences_count = 5; + + // The amount of documents with a predicted occurrence. + int32 predicted_document_count = 10; + + // The amount of documents with a ground truth occurrence. + int32 ground_truth_document_count = 11; + + // The amount of true positives. + int32 true_positives_count = 6; + + // The amount of false positives. + int32 false_positives_count = 7; + + // The amount of false negatives. + int32 false_negatives_count = 8; + + // The amount of documents that had an occurrence of this label. + int32 total_documents_count = 9; + } + + // Evaluations metrics, at a specific confidence level. + message ConfidenceLevelMetrics { + // The confidence level. + float confidence_level = 1; + + // The metrics at the specific confidence level. + Metrics metrics = 2; + } + + // Metrics across multiple confidence levels. + message MultiConfidenceMetrics { + // A type that determines how metrics should be interpreted. + enum 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). + 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. + AGGREGATE = 1; + } + + // Metrics across confidence levels with fuzzy matching enabled. + repeated ConfidenceLevelMetrics confidence_level_metrics = 1; + + // Metrics across confidence levels with only exact matching. + repeated ConfidenceLevelMetrics confidence_level_metrics_exact = 4; + + // The calculated area under the precision recall curve (AUPRC), computed by + // integrating over all confidence thresholds. + float auprc = 2; + + // The Estimated Calibration Error (ECE) of the confidence of the predicted + // entities. + float estimated_calibration_error = 3; + + // The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching + // only. + float auprc_exact = 5; + + // The ECE for the predicted entities with fuzzy matching disabled, i.e., + // exact matching only. + float estimated_calibration_error_exact = 6; + + // The metrics type for the label. + MetricsType metrics_type = 7; + } + + // The resource name of the evaluation. + // Format: + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}` + string name = 1; + + // The time that the evaluation was created. + google.protobuf.Timestamp create_time = 2; + + // Counters for the documents used in the evaluation. + Counters document_counters = 5; + + // Metrics for all the entities in aggregate. + MultiConfidenceMetrics all_entities_metrics = 3; + + // Metrics across confidence levels, for different entities. + map entity_metrics = 4; + + // The KMS key name used for encryption. + string kms_key_name = 6; + + // The KMS key version with which data is encrypted. + string kms_key_version_name = 7; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto index b7019bf4d12..db13e89defa 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor.proto @@ -18,6 +18,7 @@ package google.cloud.documentai.v1beta3; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; +import "google/cloud/documentai/v1beta3/document_schema.proto"; import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; @@ -85,6 +86,9 @@ message ProcessorVersion { // The display name of the processor version. string display_name = 2; + // The schema of the processor version. Describes the output. + DocumentSchema document_schema = 12; + // The state of the processor version. State state = 6; @@ -125,14 +129,14 @@ message Processor { // The processor is disabled. DISABLED = 2; - // The processor is being enabled, will become ENABLED if successful. + // The processor is being enabled, will become `ENABLED` if successful. ENABLING = 3; - // The processor is being disabled, will become DISABLED if successful. + // The processor is being disabled, will become `DISABLED` if successful. DISABLING = 4; - // The processor is being created, will become either ENABLED (for - // successful creation) or FAILED (for failed ones). + // 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. @@ -154,7 +158,7 @@ message Processor { (google.api.field_behavior) = OUTPUT_ONLY ]; - // The processor type, e.g., OCR_PROCESSOR, INVOICE_PROCESSOR, etc. + // The processor type, e.g., `OCR_PROCESSOR`, `INVOICE_PROCESSOR`, etc. // To get a list of processors types, see // [FetchProcessorTypes][google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes]. string type = 2; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto index a2799e301a9..9afbf04d481 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/processor_type.proto @@ -42,10 +42,10 @@ message ProcessorType { } // The resource name of the processor type. - // Format: projects/{project}/processorTypes/{processor_type} + // Format: `projects/{project}/processorTypes/{processor_type}` string name = 1; - // The type of the processor, e.g., "invoice_parsing". + // The processor type, e.g., `OCR_PROCESSOR`, `INVOICE_PROCESSOR`, etc. string type = 2; // The processor category, used by UI to group processor types. diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index af6c5eac483..4c85bb63f92 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -21168,6 +21168,9 @@ export namespace google { /** Style fontSize */ fontSize?: (google.cloud.documentai.v1beta3.Document.Style.IFontSize|null); + + /** Style fontFamily */ + fontFamily?: (string|null); } /** Represents a Style. */ @@ -21200,6 +21203,9 @@ export namespace google { /** Style fontSize. */ public fontSize?: (google.cloud.documentai.v1beta3.Document.Style.IFontSize|null); + /** Style fontFamily. */ + public fontFamily: string; + /** * Creates a new Style instance using the specified properties. * @param [properties] Properties to set @@ -21432,6 +21438,9 @@ export namespace google { /** Page detectedBarcodes */ detectedBarcodes?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode[]|null); + /** Page imageQualityScores */ + imageQualityScores?: (google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores|null); + /** Page provenance */ provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); } @@ -21490,6 +21499,9 @@ export namespace google { /** Page detectedBarcodes. */ public detectedBarcodes: google.cloud.documentai.v1beta3.Document.Page.IDetectedBarcode[]; + /** Page imageQualityScores. */ + public imageQualityScores?: (google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores|null); + /** Page provenance. */ public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); @@ -22818,6 +22830,9 @@ export namespace google { /** Table detectedLanguages */ detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + + /** Table provenance */ + provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); } /** Represents a Table. */ @@ -22841,6 +22856,9 @@ export namespace google { /** Table detectedLanguages. */ public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + /** Table provenance. */ + public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); + /** * Creates a new Table instance using the specified properties. * @param [properties] Properties to set @@ -23478,6 +23496,215 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of an ImageQualityScores. */ + interface IImageQualityScores { + + /** ImageQualityScores qualityScore */ + qualityScore?: (number|null); + + /** ImageQualityScores detectedDefects */ + detectedDefects?: (google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect[]|null); + } + + /** Represents an ImageQualityScores. */ + class ImageQualityScores implements IImageQualityScores { + + /** + * Constructs a new ImageQualityScores. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores); + + /** ImageQualityScores qualityScore. */ + public qualityScore: number; + + /** ImageQualityScores detectedDefects. */ + public detectedDefects: google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect[]; + + /** + * Creates a new ImageQualityScores instance using the specified properties. + * @param [properties] Properties to set + * @returns ImageQualityScores instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores): google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores; + + /** + * Encodes the specified ImageQualityScores message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.verify|verify} messages. + * @param message ImageQualityScores message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImageQualityScores message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.verify|verify} messages. + * @param message ImageQualityScores message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImageQualityScores message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImageQualityScores + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores; + + /** + * Decodes an ImageQualityScores message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImageQualityScores + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores; + + /** + * Verifies an ImageQualityScores message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImageQualityScores message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImageQualityScores + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores; + + /** + * Creates a plain object from an ImageQualityScores message. Also converts values to other types if specified. + * @param message ImageQualityScores + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImageQualityScores to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImageQualityScores + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ImageQualityScores { + + /** Properties of a DetectedDefect. */ + interface IDetectedDefect { + + /** DetectedDefect type */ + type?: (string|null); + + /** DetectedDefect confidence */ + confidence?: (number|null); + } + + /** Represents a DetectedDefect. */ + class DetectedDefect implements IDetectedDefect { + + /** + * Constructs a new DetectedDefect. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect); + + /** DetectedDefect type. */ + public type: string; + + /** DetectedDefect confidence. */ + public confidence: number; + + /** + * Creates a new DetectedDefect instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedDefect instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect): google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect; + + /** + * Encodes the specified DetectedDefect message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect.verify|verify} messages. + * @param message DetectedDefect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedDefect message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect.verify|verify} messages. + * @param message DetectedDefect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedDefect message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedDefect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect; + + /** + * Decodes a DetectedDefect message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedDefect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect; + + /** + * Verifies a DetectedDefect message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectedDefect message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedDefect + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect; + + /** + * Creates a plain object from a DetectedDefect message. Also converts values to other types if specified. + * @param message DetectedDefect + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedDefect to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectedDefect + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } } /** Properties of an Entity. */ @@ -25848,6 +26075,9 @@ export namespace google { /** GcsOutputConfig gcsUri */ gcsUri?: (string|null); + + /** GcsOutputConfig fieldMask */ + fieldMask?: (google.protobuf.IFieldMask|null); } /** Represents a GcsOutputConfig. */ @@ -25862,6 +26092,9 @@ export namespace google { /** GcsOutputConfig gcsUri. */ public gcsUri: string; + /** GcsOutputConfig fieldMask. */ + public fieldMask?: (google.protobuf.IFieldMask|null); + /** * Creates a new GcsOutputConfig instance using the specified properties. * @param [properties] Properties to set @@ -26045,6 +26278,20 @@ export namespace google { */ public getProcessor(request: google.cloud.documentai.v1beta3.IGetProcessorRequest): Promise; + /** + * Calls TrainProcessorVersion. + * @param request TrainProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public trainProcessorVersion(request: google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.TrainProcessorVersionCallback): void; + + /** + * Calls TrainProcessorVersion. + * @param request TrainProcessorVersionRequest message or plain object + * @returns Promise + */ + public trainProcessorVersion(request: google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest): Promise; + /** * Calls GetProcessorVersion. * @param request GetProcessorVersionRequest message or plain object @@ -26198,6 +26445,48 @@ export namespace google { * @returns Promise */ public reviewDocument(request: google.cloud.documentai.v1beta3.IReviewDocumentRequest): Promise; + + /** + * Calls EvaluateProcessorVersion. + * @param request EvaluateProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public evaluateProcessorVersion(request: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.EvaluateProcessorVersionCallback): void; + + /** + * Calls EvaluateProcessorVersion. + * @param request EvaluateProcessorVersionRequest message or plain object + * @returns Promise + */ + public evaluateProcessorVersion(request: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest): Promise; + + /** + * Calls GetEvaluation. + * @param request GetEvaluationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Evaluation + */ + public getEvaluation(request: google.cloud.documentai.v1beta3.IGetEvaluationRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.GetEvaluationCallback): void; + + /** + * Calls GetEvaluation. + * @param request GetEvaluationRequest message or plain object + * @returns Promise + */ + public getEvaluation(request: google.cloud.documentai.v1beta3.IGetEvaluationRequest): Promise; + + /** + * Calls ListEvaluations. + * @param request ListEvaluationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListEvaluationsResponse + */ + public listEvaluations(request: google.cloud.documentai.v1beta3.IListEvaluationsRequest, callback: google.cloud.documentai.v1beta3.DocumentProcessorService.ListEvaluationsCallback): void; + + /** + * Calls ListEvaluations. + * @param request ListEvaluationsRequest message or plain object + * @returns Promise + */ + public listEvaluations(request: google.cloud.documentai.v1beta3.IListEvaluationsRequest): Promise; } namespace DocumentProcessorService { @@ -26244,6 +26533,13 @@ export namespace google { */ type GetProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.Processor) => void; + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|trainProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type TrainProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + /** * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|getProcessorVersion}. * @param error Error, if any @@ -26320,13 +26616,34 @@ export namespace google { * @param [response] Operation */ type ReviewDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - /** Properties of a ProcessRequest. */ - interface IProcessRequest { + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|evaluateProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type EvaluateProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - /** ProcessRequest inlineDocument */ - inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|getEvaluation}. + * @param error Error, if any + * @param [response] Evaluation + */ + type GetEvaluationCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.Evaluation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|listEvaluations}. + * @param error Error, if any + * @param [response] ListEvaluationsResponse + */ + type ListEvaluationsCallback = (error: (Error|null), response?: google.cloud.documentai.v1beta3.ListEvaluationsResponse) => void; + } + + /** Properties of a ProcessRequest. */ + interface IProcessRequest { + + /** ProcessRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); /** ProcessRequest rawDocument */ rawDocument?: (google.cloud.documentai.v1beta3.IRawDocument|null); @@ -30305,980 +30622,2790 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a ReviewDocumentRequest. */ - interface IReviewDocumentRequest { - - /** ReviewDocumentRequest inlineDocument */ - inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + /** Properties of a TrainProcessorVersionRequest. */ + interface ITrainProcessorVersionRequest { - /** ReviewDocumentRequest humanReviewConfig */ - humanReviewConfig?: (string|null); + /** TrainProcessorVersionRequest parent */ + parent?: (string|null); - /** ReviewDocumentRequest document */ - document?: (google.cloud.documentai.v1beta3.IDocument|null); + /** TrainProcessorVersionRequest processorVersion */ + processorVersion?: (google.cloud.documentai.v1beta3.IProcessorVersion|null); - /** ReviewDocumentRequest enableSchemaValidation */ - enableSchemaValidation?: (boolean|null); + /** TrainProcessorVersionRequest documentSchema */ + documentSchema?: (google.cloud.documentai.v1beta3.IDocumentSchema|null); - /** ReviewDocumentRequest priority */ - priority?: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null); + /** TrainProcessorVersionRequest inputData */ + inputData?: (google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData|null); - /** ReviewDocumentRequest documentSchema */ - documentSchema?: (google.cloud.documentai.v1beta3.IDocumentSchema|null); + /** TrainProcessorVersionRequest baseProcessorVersion */ + baseProcessorVersion?: (string|null); } - /** Represents a ReviewDocumentRequest. */ - class ReviewDocumentRequest implements IReviewDocumentRequest { + /** Represents a TrainProcessorVersionRequest. */ + class TrainProcessorVersionRequest implements ITrainProcessorVersionRequest { /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new TrainProcessorVersionRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest); + constructor(properties?: google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest); - /** ReviewDocumentRequest inlineDocument. */ - public inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); - - /** ReviewDocumentRequest humanReviewConfig. */ - public humanReviewConfig: string; - - /** ReviewDocumentRequest document. */ - public document?: (google.cloud.documentai.v1beta3.IDocument|null); - - /** ReviewDocumentRequest enableSchemaValidation. */ - public enableSchemaValidation: boolean; + /** TrainProcessorVersionRequest parent. */ + public parent: string; - /** ReviewDocumentRequest priority. */ - public priority: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority); + /** TrainProcessorVersionRequest processorVersion. */ + public processorVersion?: (google.cloud.documentai.v1beta3.IProcessorVersion|null); - /** ReviewDocumentRequest documentSchema. */ + /** TrainProcessorVersionRequest documentSchema. */ public documentSchema?: (google.cloud.documentai.v1beta3.IDocumentSchema|null); - /** ReviewDocumentRequest source. */ - public source?: "inlineDocument"; + /** TrainProcessorVersionRequest inputData. */ + public inputData?: (google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData|null); + + /** TrainProcessorVersionRequest baseProcessorVersion. */ + public baseProcessorVersion: string; /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new TrainProcessorVersionRequest instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentRequest instance + * @returns TrainProcessorVersionRequest instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static create(properties?: google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest): google.cloud.documentai.v1beta3.TrainProcessorVersionRequest; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified TrainProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.verify|verify} messages. + * @param message TrainProcessorVersionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified TrainProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.verify|verify} messages. + * @param message TrainProcessorVersionRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a TrainProcessorVersionRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentRequest + * @returns TrainProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.TrainProcessorVersionRequest; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a TrainProcessorVersionRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentRequest + * @returns TrainProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.TrainProcessorVersionRequest; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a TrainProcessorVersionRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a TrainProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentRequest + * @returns TrainProcessorVersionRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.TrainProcessorVersionRequest; /** - * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. - * @param message ReviewDocumentRequest + * Creates a plain object from a TrainProcessorVersionRequest message. Also converts values to other types if specified. + * @param message TrainProcessorVersionRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.TrainProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this TrainProcessorVersionRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ReviewDocumentRequest + * Gets the default type url for TrainProcessorVersionRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace ReviewDocumentRequest { + namespace TrainProcessorVersionRequest { - /** Priority enum. */ - enum Priority { - DEFAULT = 0, - URGENT = 1 + /** Properties of an InputData. */ + interface IInputData { + + /** InputData trainingDocuments */ + trainingDocuments?: (google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null); + + /** InputData testDocuments */ + testDocuments?: (google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null); } - } - /** Properties of a ReviewDocumentResponse. */ - interface IReviewDocumentResponse { + /** Represents an InputData. */ + class InputData implements IInputData { - /** ReviewDocumentResponse gcsDestination */ - gcsDestination?: (string|null); + /** + * Constructs a new InputData. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData); - /** ReviewDocumentResponse state */ - state?: (google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|null); + /** InputData trainingDocuments. */ + public trainingDocuments?: (google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null); - /** ReviewDocumentResponse rejectionReason */ - rejectionReason?: (string|null); + /** InputData testDocuments. */ + public testDocuments?: (google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null); + + /** + * Creates a new InputData instance using the specified properties. + * @param [properties] Properties to set + * @returns InputData instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData): google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData; + + /** + * Encodes the specified InputData message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.verify|verify} messages. + * @param message InputData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputData message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.verify|verify} messages. + * @param message InputData message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InputData message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InputData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData; + + /** + * Decodes an InputData message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InputData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData; + + /** + * Verifies an InputData message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InputData message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InputData + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData; + + /** + * Creates a plain object from an InputData message. Also converts values to other types if specified. + * @param message InputData + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputData to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InputData + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } - /** Represents a ReviewDocumentResponse. */ - class ReviewDocumentResponse implements IReviewDocumentResponse { + /** Properties of a TrainProcessorVersionResponse. */ + interface ITrainProcessorVersionResponse { + + /** TrainProcessorVersionResponse processorVersion */ + processorVersion?: (string|null); + } + + /** Represents a TrainProcessorVersionResponse. */ + class TrainProcessorVersionResponse implements ITrainProcessorVersionResponse { /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new TrainProcessorVersionResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse); - - /** ReviewDocumentResponse gcsDestination. */ - public gcsDestination: string; - - /** ReviewDocumentResponse state. */ - public state: (google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentResponse.State); + constructor(properties?: google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse); - /** ReviewDocumentResponse rejectionReason. */ - public rejectionReason: string; + /** TrainProcessorVersionResponse processorVersion. */ + public processorVersion: string; /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new TrainProcessorVersionResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentResponse instance + * @returns TrainProcessorVersionResponse instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static create(properties?: google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse): google.cloud.documentai.v1beta3.TrainProcessorVersionResponse; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified TrainProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionResponse.verify|verify} messages. + * @param message TrainProcessorVersionResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified TrainProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionResponse.verify|verify} messages. + * @param message TrainProcessorVersionResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a TrainProcessorVersionResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentResponse + * @returns TrainProcessorVersionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.TrainProcessorVersionResponse; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a TrainProcessorVersionResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentResponse + * @returns TrainProcessorVersionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.TrainProcessorVersionResponse; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a TrainProcessorVersionResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a TrainProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentResponse + * @returns TrainProcessorVersionResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.TrainProcessorVersionResponse; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. - * @param message ReviewDocumentResponse + * Creates a plain object from a TrainProcessorVersionResponse message. Also converts values to other types if specified. + * @param message TrainProcessorVersionResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.TrainProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this TrainProcessorVersionResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for ReviewDocumentResponse + * Gets the default type url for TrainProcessorVersionResponse * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace ReviewDocumentResponse { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - REJECTED = 1, - SUCCEEDED = 2 - } - } - - /** Properties of a ReviewDocumentOperationMetadata. */ - interface IReviewDocumentOperationMetadata { - - /** ReviewDocumentOperationMetadata state */ - state?: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null); - - /** ReviewDocumentOperationMetadata stateMessage */ - stateMessage?: (string|null); - - /** ReviewDocumentOperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** ReviewDocumentOperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** Properties of a TrainProcessorVersionMetadata. */ + interface ITrainProcessorVersionMetadata { - /** ReviewDocumentOperationMetadata commonMetadata */ + /** TrainProcessorVersionMetadata commonMetadata */ commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); - /** ReviewDocumentOperationMetadata questionId */ - questionId?: (string|null); + /** TrainProcessorVersionMetadata trainingDatasetValidation */ + trainingDatasetValidation?: (google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation|null); + + /** TrainProcessorVersionMetadata testDatasetValidation */ + testDatasetValidation?: (google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation|null); } - /** Represents a ReviewDocumentOperationMetadata. */ - class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + /** Represents a TrainProcessorVersionMetadata. */ + class TrainProcessorVersionMetadata implements ITrainProcessorVersionMetadata { /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new TrainProcessorVersionMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata); - - /** ReviewDocumentOperationMetadata state. */ - public state: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State); - - /** ReviewDocumentOperationMetadata stateMessage. */ - public stateMessage: string; + constructor(properties?: google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata); - /** ReviewDocumentOperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** ReviewDocumentOperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); - - /** ReviewDocumentOperationMetadata commonMetadata. */ + /** TrainProcessorVersionMetadata commonMetadata. */ public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); - /** ReviewDocumentOperationMetadata questionId. */ - public questionId: string; + /** TrainProcessorVersionMetadata trainingDatasetValidation. */ + public trainingDatasetValidation?: (google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation|null); + + /** TrainProcessorVersionMetadata testDatasetValidation. */ + public testDatasetValidation?: (google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation|null); /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * Creates a new TrainProcessorVersionMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentOperationMetadata instance + * @returns TrainProcessorVersionMetadata instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static create(properties?: google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata): google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified TrainProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.verify|verify} messages. + * @param message TrainProcessorVersionMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified TrainProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.verify|verify} messages. + * @param message TrainProcessorVersionMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a TrainProcessorVersionMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ReviewDocumentOperationMetadata + * @returns TrainProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a TrainProcessorVersionMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentOperationMetadata + * @returns TrainProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a TrainProcessorVersionMetadata message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a TrainProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentOperationMetadata + * @returns TrainProcessorVersionMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata; /** - * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. - * @param message ReviewDocumentOperationMetadata + * Creates a plain object from a TrainProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message TrainProcessorVersionMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentOperationMetadata to JSON. + * Converts this TrainProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TrainProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TrainProcessorVersionMetadata { + + /** Properties of a DatasetValidation. */ + interface IDatasetValidation { + + /** DatasetValidation documentErrorCount */ + documentErrorCount?: (number|null); + + /** DatasetValidation datasetErrorCount */ + datasetErrorCount?: (number|null); + + /** DatasetValidation documentErrors */ + documentErrors?: (google.rpc.IStatus[]|null); + + /** DatasetValidation datasetErrors */ + datasetErrors?: (google.rpc.IStatus[]|null); + } + + /** Represents a DatasetValidation. */ + class DatasetValidation implements IDatasetValidation { + + /** + * Constructs a new DatasetValidation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation); + + /** DatasetValidation documentErrorCount. */ + public documentErrorCount: number; + + /** DatasetValidation datasetErrorCount. */ + public datasetErrorCount: number; + + /** DatasetValidation documentErrors. */ + public documentErrors: google.rpc.IStatus[]; + + /** DatasetValidation datasetErrors. */ + public datasetErrors: google.rpc.IStatus[]; + + /** + * Creates a new DatasetValidation instance using the specified properties. + * @param [properties] Properties to set + * @returns DatasetValidation instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation): google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation; + + /** + * Encodes the specified DatasetValidation message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.verify|verify} messages. + * @param message DatasetValidation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DatasetValidation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.verify|verify} messages. + * @param message DatasetValidation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DatasetValidation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DatasetValidation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation; + + /** + * Decodes a DatasetValidation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DatasetValidation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation; + + /** + * Verifies a DatasetValidation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DatasetValidation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DatasetValidation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation; + + /** + * Creates a plain object from a DatasetValidation message. Also converts values to other types if specified. + * @param message DatasetValidation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DatasetValidation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DatasetValidation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ReviewDocumentRequest. */ + interface IReviewDocumentRequest { + + /** ReviewDocumentRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig */ + humanReviewConfig?: (string|null); + + /** ReviewDocumentRequest document */ + document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest enableSchemaValidation */ + enableSchemaValidation?: (boolean|null); + + /** ReviewDocumentRequest priority */ + priority?: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null); + + /** ReviewDocumentRequest documentSchema */ + documentSchema?: (google.cloud.documentai.v1beta3.IDocumentSchema|null); + } + + /** Represents a ReviewDocumentRequest. */ + class ReviewDocumentRequest implements IReviewDocumentRequest { + + /** + * Constructs a new ReviewDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest); + + /** ReviewDocumentRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig. */ + public humanReviewConfig: string; + + /** ReviewDocumentRequest document. */ + public document?: (google.cloud.documentai.v1beta3.IDocument|null); + + /** ReviewDocumentRequest enableSchemaValidation. */ + public enableSchemaValidation: boolean; + + /** ReviewDocumentRequest priority. */ + public priority: (google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority); + + /** ReviewDocumentRequest documentSchema. */ + public documentSchema?: (google.cloud.documentai.v1beta3.IDocumentSchema|null); + + /** ReviewDocumentRequest source. */ + public source?: "inlineDocument"; + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentRequest): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @param message ReviewDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Verifies a ReviewDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentRequest; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @param message ReviewDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; - /** - * Gets the default type url for ReviewDocumentOperationMetadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** + * Gets the default type url for ReviewDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ReviewDocumentRequest { + + /** Priority enum. */ + enum Priority { + DEFAULT = 0, + URGENT = 1 + } + } + + /** Properties of a ReviewDocumentResponse. */ + interface IReviewDocumentResponse { + + /** ReviewDocumentResponse gcsDestination */ + gcsDestination?: (string|null); + + /** ReviewDocumentResponse state */ + state?: (google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|null); + + /** ReviewDocumentResponse rejectionReason */ + rejectionReason?: (string|null); + } + + /** Represents a ReviewDocumentResponse. */ + class ReviewDocumentResponse implements IReviewDocumentResponse { + + /** + * Constructs a new ReviewDocumentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse); + + /** ReviewDocumentResponse gcsDestination. */ + public gcsDestination: string; + + /** ReviewDocumentResponse state. */ + public state: (google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentResponse.State); + + /** ReviewDocumentResponse rejectionReason. */ + public rejectionReason: string; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentResponse): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @param message ReviewDocumentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Verifies a ReviewDocumentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentResponse; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @param message ReviewDocumentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReviewDocumentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ReviewDocumentResponse { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + REJECTED = 1, + SUCCEEDED = 2 + } + } + + /** Properties of a ReviewDocumentOperationMetadata. */ + interface IReviewDocumentOperationMetadata { + + /** ReviewDocumentOperationMetadata state */ + state?: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null); + + /** ReviewDocumentOperationMetadata stateMessage */ + stateMessage?: (string|null); + + /** ReviewDocumentOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** ReviewDocumentOperationMetadata questionId */ + questionId?: (string|null); + } + + /** Represents a ReviewDocumentOperationMetadata. */ + class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata); + + /** ReviewDocumentOperationMetadata state. */ + public state: (google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|keyof typeof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State); + + /** ReviewDocumentOperationMetadata stateMessage. */ + public stateMessage: string; + + /** ReviewDocumentOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ReviewDocumentOperationMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** ReviewDocumentOperationMetadata questionId. */ + public questionId: string; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ReviewDocumentOperationMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @param message ReviewDocumentOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReviewDocumentOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @param message ReviewDocumentOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReviewDocumentOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ReviewDocumentOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 + } + } + + /** Properties of an EvaluateProcessorVersionRequest. */ + interface IEvaluateProcessorVersionRequest { + + /** EvaluateProcessorVersionRequest processorVersion */ + processorVersion?: (string|null); + + /** EvaluateProcessorVersionRequest evaluationDocuments */ + evaluationDocuments?: (google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null); + } + + /** Represents an EvaluateProcessorVersionRequest. */ + class EvaluateProcessorVersionRequest implements IEvaluateProcessorVersionRequest { + + /** + * Constructs a new EvaluateProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest); + + /** EvaluateProcessorVersionRequest processorVersion. */ + public processorVersion: string; + + /** EvaluateProcessorVersionRequest evaluationDocuments. */ + public evaluationDocuments?: (google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null); + + /** + * Creates a new EvaluateProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns EvaluateProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest): google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest; + + /** + * Encodes the specified EvaluateProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest.verify|verify} messages. + * @param message EvaluateProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EvaluateProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest.verify|verify} messages. + * @param message EvaluateProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EvaluateProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EvaluateProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest; + + /** + * Decodes an EvaluateProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EvaluateProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest; + + /** + * Verifies an EvaluateProcessorVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EvaluateProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EvaluateProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest; + + /** + * Creates a plain object from an EvaluateProcessorVersionRequest message. Also converts values to other types if specified. + * @param message EvaluateProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EvaluateProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EvaluateProcessorVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EvaluateProcessorVersionMetadata. */ + interface IEvaluateProcessorVersionMetadata { + + /** EvaluateProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + } + + /** Represents an EvaluateProcessorVersionMetadata. */ + class EvaluateProcessorVersionMetadata implements IEvaluateProcessorVersionMetadata { + + /** + * Constructs a new EvaluateProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata); + + /** EvaluateProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1beta3.ICommonOperationMetadata|null); + + /** + * Creates a new EvaluateProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns EvaluateProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata): google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata; + + /** + * Encodes the specified EvaluateProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata.verify|verify} messages. + * @param message EvaluateProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EvaluateProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata.verify|verify} messages. + * @param message EvaluateProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EvaluateProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EvaluateProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata; + + /** + * Decodes an EvaluateProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EvaluateProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata; + + /** + * Verifies an EvaluateProcessorVersionMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EvaluateProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EvaluateProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata; + + /** + * Creates a plain object from an EvaluateProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message EvaluateProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EvaluateProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EvaluateProcessorVersionMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EvaluateProcessorVersionResponse. */ + interface IEvaluateProcessorVersionResponse { + + /** EvaluateProcessorVersionResponse evaluation */ + evaluation?: (string|null); + } + + /** Represents an EvaluateProcessorVersionResponse. */ + class EvaluateProcessorVersionResponse implements IEvaluateProcessorVersionResponse { + + /** + * Constructs a new EvaluateProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse); + + /** EvaluateProcessorVersionResponse evaluation. */ + public evaluation: string; + + /** + * Creates a new EvaluateProcessorVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns EvaluateProcessorVersionResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse): google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse; + + /** + * Encodes the specified EvaluateProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse.verify|verify} messages. + * @param message EvaluateProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EvaluateProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse.verify|verify} messages. + * @param message EvaluateProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EvaluateProcessorVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EvaluateProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse; + + /** + * Decodes an EvaluateProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EvaluateProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse; + + /** + * Verifies an EvaluateProcessorVersionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EvaluateProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EvaluateProcessorVersionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse; + + /** + * Creates a plain object from an EvaluateProcessorVersionResponse message. Also converts values to other types if specified. + * @param message EvaluateProcessorVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EvaluateProcessorVersionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EvaluateProcessorVersionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetEvaluationRequest. */ + interface IGetEvaluationRequest { + + /** GetEvaluationRequest name */ + name?: (string|null); + } + + /** Represents a GetEvaluationRequest. */ + class GetEvaluationRequest implements IGetEvaluationRequest { + + /** + * Constructs a new GetEvaluationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IGetEvaluationRequest); + + /** GetEvaluationRequest name. */ + public name: string; + + /** + * Creates a new GetEvaluationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEvaluationRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IGetEvaluationRequest): google.cloud.documentai.v1beta3.GetEvaluationRequest; + + /** + * Encodes the specified GetEvaluationRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.GetEvaluationRequest.verify|verify} messages. + * @param message GetEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IGetEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GetEvaluationRequest.verify|verify} messages. + * @param message GetEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IGetEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEvaluationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.GetEvaluationRequest; + + /** + * Decodes a GetEvaluationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.GetEvaluationRequest; + + /** + * Verifies a GetEvaluationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEvaluationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.GetEvaluationRequest; + + /** + * Creates a plain object from a GetEvaluationRequest message. Also converts values to other types if specified. + * @param message GetEvaluationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.GetEvaluationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEvaluationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetEvaluationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEvaluationsRequest. */ + interface IListEvaluationsRequest { + + /** ListEvaluationsRequest parent */ + parent?: (string|null); + + /** ListEvaluationsRequest pageSize */ + pageSize?: (number|null); + + /** ListEvaluationsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListEvaluationsRequest. */ + class ListEvaluationsRequest implements IListEvaluationsRequest { + + /** + * Constructs a new ListEvaluationsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IListEvaluationsRequest); + + /** ListEvaluationsRequest parent. */ + public parent: string; + + /** ListEvaluationsRequest pageSize. */ + public pageSize: number; + + /** ListEvaluationsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListEvaluationsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEvaluationsRequest instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IListEvaluationsRequest): google.cloud.documentai.v1beta3.ListEvaluationsRequest; + + /** + * Encodes the specified ListEvaluationsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListEvaluationsRequest.verify|verify} messages. + * @param message ListEvaluationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IListEvaluationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEvaluationsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListEvaluationsRequest.verify|verify} messages. + * @param message ListEvaluationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListEvaluationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEvaluationsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEvaluationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListEvaluationsRequest; + + /** + * Decodes a ListEvaluationsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEvaluationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListEvaluationsRequest; + + /** + * Verifies a ListEvaluationsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEvaluationsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEvaluationsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListEvaluationsRequest; + + /** + * Creates a plain object from a ListEvaluationsRequest message. Also converts values to other types if specified. + * @param message ListEvaluationsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ListEvaluationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEvaluationsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEvaluationsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEvaluationsResponse. */ + interface IListEvaluationsResponse { + + /** ListEvaluationsResponse evaluations */ + evaluations?: (google.cloud.documentai.v1beta3.IEvaluation[]|null); + + /** ListEvaluationsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListEvaluationsResponse. */ + class ListEvaluationsResponse implements IListEvaluationsResponse { + + /** + * Constructs a new ListEvaluationsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IListEvaluationsResponse); + + /** ListEvaluationsResponse evaluations. */ + public evaluations: google.cloud.documentai.v1beta3.IEvaluation[]; + + /** ListEvaluationsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListEvaluationsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEvaluationsResponse instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IListEvaluationsResponse): google.cloud.documentai.v1beta3.ListEvaluationsResponse; + + /** + * Encodes the specified ListEvaluationsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListEvaluationsResponse.verify|verify} messages. + * @param message ListEvaluationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IListEvaluationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEvaluationsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListEvaluationsResponse.verify|verify} messages. + * @param message ListEvaluationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IListEvaluationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEvaluationsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEvaluationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.ListEvaluationsResponse; + + /** + * Decodes a ListEvaluationsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEvaluationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.ListEvaluationsResponse; + + /** + * Verifies a ListEvaluationsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEvaluationsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEvaluationsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.ListEvaluationsResponse; + + /** + * Creates a plain object from a ListEvaluationsResponse message. Also converts values to other types if specified. + * @param message ListEvaluationsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.ListEvaluationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEvaluationsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEvaluationsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentSchema. */ + interface IDocumentSchema { + + /** DocumentSchema displayName */ + displayName?: (string|null); + + /** DocumentSchema description */ + description?: (string|null); + + /** DocumentSchema entityTypes */ + entityTypes?: (google.cloud.documentai.v1beta3.DocumentSchema.IEntityType[]|null); + + /** DocumentSchema metadata */ + metadata?: (google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null); + } + + /** Represents a DocumentSchema. */ + class DocumentSchema implements IDocumentSchema { + + /** + * Constructs a new DocumentSchema. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.IDocumentSchema); + + /** DocumentSchema displayName. */ + public displayName: string; + + /** DocumentSchema description. */ + public description: string; + + /** DocumentSchema entityTypes. */ + public entityTypes: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType[]; + + /** DocumentSchema metadata. */ + public metadata?: (google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null); + + /** + * Creates a new DocumentSchema instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentSchema instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.IDocumentSchema): google.cloud.documentai.v1beta3.DocumentSchema; + + /** + * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * @param message DocumentSchema message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentSchema message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * @param message DocumentSchema message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema; + + /** + * Verifies a DocumentSchema message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentSchema message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentSchema + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema; + + /** + * Creates a plain object from a DocumentSchema message. Also converts values to other types if specified. + * @param message DocumentSchema + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentSchema to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentSchema + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DocumentSchema { + + /** Properties of an EntityType. */ + interface IEntityType { + + /** EntityType enumValues */ + enumValues?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null); + + /** EntityType displayName */ + displayName?: (string|null); + + /** EntityType name */ + name?: (string|null); + + /** EntityType baseTypes */ + baseTypes?: (string[]|null); + + /** EntityType properties */ + properties?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty[]|null); + } + + /** Represents an EntityType. */ + class EntityType implements IEntityType { + + /** + * Constructs a new EntityType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType); + + /** EntityType enumValues. */ + public enumValues?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null); + + /** EntityType displayName. */ + public displayName: string; + + /** EntityType name. */ + public name: string; + + /** EntityType baseTypes. */ + public baseTypes: string[]; + + /** EntityType properties. */ + public properties: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty[]; + + /** EntityType valueSource. */ + public valueSource?: "enumValues"; + + /** + * Creates a new EntityType instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityType instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + + /** + * Verifies an EntityType message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EntityType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @param message EntityType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EntityType { + + /** Properties of an EnumValues. */ + interface IEnumValues { + + /** EnumValues values */ + values?: (string[]|null); + } + + /** Represents an EnumValues. */ + class EnumValues implements IEnumValues { + + /** + * Constructs a new EnumValues. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues); + + /** EnumValues values. */ + public values: string[]; + + /** + * Creates a new EnumValues instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValues instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + + /** + * Encodes the specified EnumValues message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @param message EnumValues message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValues message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @param message EnumValues message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValues message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + + /** + * Decodes an EnumValues message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + + /** + * Verifies an EnumValues message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValues message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValues + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + + /** + * Creates a plain object from an EnumValues message. Also converts values to other types if specified. + * @param message EnumValues + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValues to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValues + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Property. */ + interface IProperty { + + /** Property name */ + name?: (string|null); + + /** Property valueType */ + valueType?: (string|null); + + /** Property occurrenceType */ + occurrenceType?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|null); + } + + /** Represents a Property. */ + class Property implements IProperty { + + /** + * Constructs a new Property. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty); + + /** Property name. */ + public name: string; + + /** Property valueType. */ + public valueType: string; + + /** Property occurrenceType. */ + public occurrenceType: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType); + + /** + * Creates a new Property instance using the specified properties. + * @param [properties] Properties to set + * @returns Property instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + + /** + * Encodes the specified Property message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. + * @param message Property message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. + * @param message Property message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Property message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + + /** + * Decodes a Property message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + + /** + * Verifies a Property message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Property message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Property + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + + /** + * Creates a plain object from a Property message. Also converts values to other types if specified. + * @param message Property + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Property to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Property + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Property { + + /** OccurrenceType enum. */ + enum OccurrenceType { + OCCURRENCE_TYPE_UNSPECIFIED = 0, + OPTIONAL_ONCE = 1, + OPTIONAL_MULTIPLE = 2, + REQUIRED_ONCE = 3, + REQUIRED_MULTIPLE = 4 + } + } + } + + /** Properties of a Metadata. */ + interface IMetadata { + + /** Metadata documentSplitter */ + documentSplitter?: (boolean|null); + + /** Metadata documentAllowMultipleLabels */ + documentAllowMultipleLabels?: (boolean|null); + + /** Metadata prefixedNamingOnProperties */ + prefixedNamingOnProperties?: (boolean|null); + + /** Metadata skipNamingValidation */ + skipNamingValidation?: (boolean|null); + } + + /** Represents a Metadata. */ + class Metadata implements IMetadata { + + /** + * Constructs a new Metadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata); + + /** Metadata documentSplitter. */ + public documentSplitter: boolean; + + /** Metadata documentAllowMultipleLabels. */ + public documentAllowMultipleLabels: boolean; + + /** Metadata prefixedNamingOnProperties. */ + public prefixedNamingOnProperties: boolean; + + /** Metadata skipNamingValidation. */ + public skipNamingValidation: boolean; + + /** + * Creates a new Metadata instance using the specified properties. + * @param [properties] Properties to set + * @returns Metadata instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + + /** + * Verifies a Metadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Metadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @param message Metadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - namespace ReviewDocumentOperationMetadata { + /** + * Converts this Metadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - RUNNING = 1, - CANCELLING = 2, - SUCCEEDED = 3, - FAILED = 4, - CANCELLED = 5 + /** + * Gets the default type url for Metadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; } } - /** Properties of a DocumentSchema. */ - interface IDocumentSchema { + /** Properties of an Evaluation. */ + interface IEvaluation { - /** DocumentSchema displayName */ - displayName?: (string|null); + /** Evaluation name */ + name?: (string|null); - /** DocumentSchema description */ - description?: (string|null); + /** Evaluation createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** DocumentSchema entityTypes */ - entityTypes?: (google.cloud.documentai.v1beta3.DocumentSchema.IEntityType[]|null); + /** Evaluation documentCounters */ + documentCounters?: (google.cloud.documentai.v1beta3.Evaluation.ICounters|null); - /** DocumentSchema metadata */ - metadata?: (google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null); + /** Evaluation allEntitiesMetrics */ + allEntitiesMetrics?: (google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics|null); + + /** Evaluation entityMetrics */ + entityMetrics?: ({ [k: string]: google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics }|null); + + /** Evaluation kmsKeyName */ + kmsKeyName?: (string|null); + + /** Evaluation kmsKeyVersionName */ + kmsKeyVersionName?: (string|null); } - /** Represents a DocumentSchema. */ - class DocumentSchema implements IDocumentSchema { + /** Represents an Evaluation. */ + class Evaluation implements IEvaluation { /** - * Constructs a new DocumentSchema. + * Constructs a new Evaluation. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.IDocumentSchema); + constructor(properties?: google.cloud.documentai.v1beta3.IEvaluation); - /** DocumentSchema displayName. */ - public displayName: string; + /** Evaluation name. */ + public name: string; - /** DocumentSchema description. */ - public description: string; + /** Evaluation createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** DocumentSchema entityTypes. */ - public entityTypes: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType[]; + /** Evaluation documentCounters. */ + public documentCounters?: (google.cloud.documentai.v1beta3.Evaluation.ICounters|null); - /** DocumentSchema metadata. */ - public metadata?: (google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null); + /** Evaluation allEntitiesMetrics. */ + public allEntitiesMetrics?: (google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics|null); + + /** Evaluation entityMetrics. */ + public entityMetrics: { [k: string]: google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics }; + + /** Evaluation kmsKeyName. */ + public kmsKeyName: string; + + /** Evaluation kmsKeyVersionName. */ + public kmsKeyVersionName: string; /** - * Creates a new DocumentSchema instance using the specified properties. + * Creates a new Evaluation instance using the specified properties. * @param [properties] Properties to set - * @returns DocumentSchema instance + * @returns Evaluation instance */ - public static create(properties?: google.cloud.documentai.v1beta3.IDocumentSchema): google.cloud.documentai.v1beta3.DocumentSchema; + public static create(properties?: google.cloud.documentai.v1beta3.IEvaluation): google.cloud.documentai.v1beta3.Evaluation; /** - * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. - * @param message DocumentSchema message or plain object to encode + * Encodes the specified Evaluation message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.verify|verify} messages. + * @param message Evaluation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.IEvaluation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DocumentSchema message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. - * @param message DocumentSchema message or plain object to encode + * Encodes the specified Evaluation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.verify|verify} messages. + * @param message Evaluation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.IEvaluation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DocumentSchema message from the specified reader or buffer. + * Decodes an Evaluation message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DocumentSchema + * @returns Evaluation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Evaluation; /** - * Decodes a DocumentSchema message from the specified reader or buffer, length delimited. + * Decodes an Evaluation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DocumentSchema + * @returns Evaluation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Evaluation; /** - * Verifies a DocumentSchema message. + * Verifies an Evaluation message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DocumentSchema message from a plain object. Also converts values to their respective internal types. + * Creates an Evaluation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DocumentSchema + * @returns Evaluation */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Evaluation; /** - * Creates a plain object from a DocumentSchema message. Also converts values to other types if specified. - * @param message DocumentSchema + * Creates a plain object from an Evaluation message. Also converts values to other types if specified. + * @param message Evaluation * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.Evaluation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DocumentSchema to JSON. + * Converts this Evaluation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for DocumentSchema + * Gets the default type url for Evaluation * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace DocumentSchema { - - /** Properties of an EntityType. */ - interface IEntityType { + namespace Evaluation { - /** EntityType enumValues */ - enumValues?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null); + /** Properties of a Counters. */ + interface ICounters { - /** EntityType displayName */ - displayName?: (string|null); + /** Counters inputDocumentsCount */ + inputDocumentsCount?: (number|null); - /** EntityType name */ - name?: (string|null); + /** Counters invalidDocumentsCount */ + invalidDocumentsCount?: (number|null); - /** EntityType baseTypes */ - baseTypes?: (string[]|null); + /** Counters failedDocumentsCount */ + failedDocumentsCount?: (number|null); - /** EntityType properties */ - properties?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty[]|null); + /** Counters evaluatedDocumentsCount */ + evaluatedDocumentsCount?: (number|null); } - /** Represents an EntityType. */ - class EntityType implements IEntityType { + /** Represents a Counters. */ + class Counters implements ICounters { /** - * Constructs a new EntityType. + * Constructs a new Counters. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType); - - /** EntityType enumValues. */ - public enumValues?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null); + constructor(properties?: google.cloud.documentai.v1beta3.Evaluation.ICounters); - /** EntityType displayName. */ - public displayName: string; - - /** EntityType name. */ - public name: string; + /** Counters inputDocumentsCount. */ + public inputDocumentsCount: number; - /** EntityType baseTypes. */ - public baseTypes: string[]; + /** Counters invalidDocumentsCount. */ + public invalidDocumentsCount: number; - /** EntityType properties. */ - public properties: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty[]; + /** Counters failedDocumentsCount. */ + public failedDocumentsCount: number; - /** EntityType valueSource. */ - public valueSource?: "enumValues"; + /** Counters evaluatedDocumentsCount. */ + public evaluatedDocumentsCount: number; /** - * Creates a new EntityType instance using the specified properties. + * Creates a new Counters instance using the specified properties. * @param [properties] Properties to set - * @returns EntityType instance + * @returns Counters instance */ - public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + public static create(properties?: google.cloud.documentai.v1beta3.Evaluation.ICounters): google.cloud.documentai.v1beta3.Evaluation.Counters; /** - * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. - * @param message EntityType message or plain object to encode + * Encodes the specified Counters message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.Counters.verify|verify} messages. + * @param message Counters message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.Evaluation.ICounters, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. - * @param message EntityType message or plain object to encode + * Encodes the specified Counters message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.Counters.verify|verify} messages. + * @param message Counters message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Evaluation.ICounters, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an EntityType message from the specified reader or buffer. + * Decodes a Counters message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns EntityType + * @returns Counters * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Evaluation.Counters; /** - * Decodes an EntityType message from the specified reader or buffer, length delimited. + * Decodes a Counters message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns EntityType + * @returns Counters * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Evaluation.Counters; /** - * Verifies an EntityType message. + * Verifies a Counters message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an EntityType message from a plain object. Also converts values to their respective internal types. + * Creates a Counters message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns EntityType + * @returns Counters */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.EntityType; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Evaluation.Counters; /** - * Creates a plain object from an EntityType message. Also converts values to other types if specified. - * @param message EntityType + * Creates a plain object from a Counters message. Also converts values to other types if specified. + * @param message Counters * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.Evaluation.Counters, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this EntityType to JSON. + * Converts this Counters to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for EntityType + * Gets the default type url for Counters * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - namespace EntityType { + /** Properties of a Metrics. */ + interface IMetrics { - /** Properties of an EnumValues. */ - interface IEnumValues { + /** Metrics precision */ + precision?: (number|null); - /** EnumValues values */ - values?: (string[]|null); - } + /** Metrics recall */ + recall?: (number|null); - /** Represents an EnumValues. */ - class EnumValues implements IEnumValues { + /** Metrics f1Score */ + f1Score?: (number|null); - /** - * Constructs a new EnumValues. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues); + /** Metrics predictedOccurrencesCount */ + predictedOccurrencesCount?: (number|null); - /** EnumValues values. */ - public values: string[]; + /** Metrics groundTruthOccurrencesCount */ + groundTruthOccurrencesCount?: (number|null); - /** - * Creates a new EnumValues instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumValues instance - */ - public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + /** Metrics predictedDocumentCount */ + predictedDocumentCount?: (number|null); - /** - * Encodes the specified EnumValues message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. - * @param message EnumValues message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; + /** Metrics groundTruthDocumentCount */ + groundTruthDocumentCount?: (number|null); - /** - * Encodes the specified EnumValues message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. - * @param message EnumValues message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; + /** Metrics truePositivesCount */ + truePositivesCount?: (number|null); - /** - * Decodes an EnumValues message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumValues - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + /** Metrics falsePositivesCount */ + falsePositivesCount?: (number|null); - /** - * Decodes an EnumValues message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumValues - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + /** Metrics falseNegativesCount */ + falseNegativesCount?: (number|null); - /** - * Verifies an EnumValues message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** Metrics totalDocumentsCount */ + totalDocumentsCount?: (number|null); + } + + /** Represents a Metrics. */ + class Metrics implements IMetrics { + + /** + * Constructs a new Metrics. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Evaluation.IMetrics); + + /** Metrics precision. */ + public precision: number; + + /** Metrics recall. */ + public recall: number; + + /** Metrics f1Score. */ + public f1Score: number; + + /** Metrics predictedOccurrencesCount. */ + public predictedOccurrencesCount: number; + + /** Metrics groundTruthOccurrencesCount. */ + public groundTruthOccurrencesCount: number; + + /** Metrics predictedDocumentCount. */ + public predictedDocumentCount: number; + + /** Metrics groundTruthDocumentCount. */ + public groundTruthDocumentCount: number; + + /** Metrics truePositivesCount. */ + public truePositivesCount: number; + + /** Metrics falsePositivesCount. */ + public falsePositivesCount: number; + + /** Metrics falseNegativesCount. */ + public falseNegativesCount: number; + + /** Metrics totalDocumentsCount. */ + public totalDocumentsCount: number; + + /** + * Creates a new Metrics instance using the specified properties. + * @param [properties] Properties to set + * @returns Metrics instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Evaluation.IMetrics): google.cloud.documentai.v1beta3.Evaluation.Metrics; + + /** + * Encodes the specified Metrics message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.Metrics.verify|verify} messages. + * @param message Metrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Evaluation.IMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Metrics message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.Metrics.verify|verify} messages. + * @param message Metrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Evaluation.IMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Metrics message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Metrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Evaluation.Metrics; + + /** + * Decodes a Metrics message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Metrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Evaluation.Metrics; - /** - * Creates an EnumValues message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumValues - */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues; + /** + * Verifies a Metrics message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Creates a plain object from an EnumValues message. Also converts values to other types if specified. - * @param message EnumValues - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a Metrics message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Metrics + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Evaluation.Metrics; - /** - * Converts this EnumValues to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Creates a plain object from a Metrics message. Also converts values to other types if specified. + * @param message Metrics + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Evaluation.Metrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Gets the default type url for EnumValues - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** + * Converts this Metrics to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** Properties of a Property. */ - interface IProperty { + /** + * Gets the default type url for Metrics + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** Property name */ - name?: (string|null); + /** Properties of a ConfidenceLevelMetrics. */ + interface IConfidenceLevelMetrics { - /** Property valueType */ - valueType?: (string|null); + /** ConfidenceLevelMetrics confidenceLevel */ + confidenceLevel?: (number|null); - /** Property occurrenceType */ - occurrenceType?: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|null); - } + /** ConfidenceLevelMetrics metrics */ + metrics?: (google.cloud.documentai.v1beta3.Evaluation.IMetrics|null); + } - /** Represents a Property. */ - class Property implements IProperty { + /** Represents a ConfidenceLevelMetrics. */ + class ConfidenceLevelMetrics implements IConfidenceLevelMetrics { - /** - * Constructs a new Property. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty); + /** + * Constructs a new ConfidenceLevelMetrics. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics); - /** Property name. */ - public name: string; + /** ConfidenceLevelMetrics confidenceLevel. */ + public confidenceLevel: number; - /** Property valueType. */ - public valueType: string; + /** ConfidenceLevelMetrics metrics. */ + public metrics?: (google.cloud.documentai.v1beta3.Evaluation.IMetrics|null); - /** Property occurrenceType. */ - public occurrenceType: (google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType); + /** + * Creates a new ConfidenceLevelMetrics instance using the specified properties. + * @param [properties] Properties to set + * @returns ConfidenceLevelMetrics instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics): google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics; - /** - * Creates a new Property instance using the specified properties. - * @param [properties] Properties to set - * @returns Property instance - */ - public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + /** + * Encodes the specified ConfidenceLevelMetrics message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.verify|verify} messages. + * @param message ConfidenceLevelMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. - * @param message Property message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified ConfidenceLevelMetrics message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.verify|verify} messages. + * @param message ConfidenceLevelMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. - * @param message Property message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Decodes a ConfidenceLevelMetrics message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConfidenceLevelMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics; - /** - * Decodes a Property message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + /** + * Decodes a ConfidenceLevelMetrics message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConfidenceLevelMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics; - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + /** + * Verifies a ConfidenceLevelMetrics message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); - /** - * Verifies a Property message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); + /** + * Creates a ConfidenceLevelMetrics message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConfidenceLevelMetrics + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics; - /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Property - */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property; + /** + * Creates a plain object from a ConfidenceLevelMetrics message. Also converts values to other types if specified. + * @param message ConfidenceLevelMetrics + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Creates a plain object from a Property message. Also converts values to other types if specified. - * @param message Property - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Converts this ConfidenceLevelMetrics to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** - * Converts this Property to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Gets the default type url for ConfidenceLevelMetrics + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } - /** - * Gets the default type url for Property - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } + /** Properties of a MultiConfidenceMetrics. */ + interface IMultiConfidenceMetrics { - namespace Property { + /** MultiConfidenceMetrics confidenceLevelMetrics */ + confidenceLevelMetrics?: (google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics[]|null); - /** OccurrenceType enum. */ - enum OccurrenceType { - OCCURRENCE_TYPE_UNSPECIFIED = 0, - OPTIONAL_ONCE = 1, - OPTIONAL_MULTIPLE = 2, - REQUIRED_ONCE = 3, - REQUIRED_MULTIPLE = 4 - } - } - } + /** MultiConfidenceMetrics confidenceLevelMetricsExact */ + confidenceLevelMetricsExact?: (google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics[]|null); - /** Properties of a Metadata. */ - interface IMetadata { + /** MultiConfidenceMetrics auprc */ + auprc?: (number|null); - /** Metadata documentSplitter */ - documentSplitter?: (boolean|null); + /** MultiConfidenceMetrics estimatedCalibrationError */ + estimatedCalibrationError?: (number|null); - /** Metadata documentAllowMultipleLabels */ - documentAllowMultipleLabels?: (boolean|null); + /** MultiConfidenceMetrics auprcExact */ + auprcExact?: (number|null); - /** Metadata prefixedNamingOnProperties */ - prefixedNamingOnProperties?: (boolean|null); + /** MultiConfidenceMetrics estimatedCalibrationErrorExact */ + estimatedCalibrationErrorExact?: (number|null); - /** Metadata skipNamingValidation */ - skipNamingValidation?: (boolean|null); + /** MultiConfidenceMetrics metricsType */ + metricsType?: (google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.MetricsType|keyof typeof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.MetricsType|null); } - /** Represents a Metadata. */ - class Metadata implements IMetadata { + /** Represents a MultiConfidenceMetrics. */ + class MultiConfidenceMetrics implements IMultiConfidenceMetrics { /** - * Constructs a new Metadata. + * Constructs a new MultiConfidenceMetrics. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata); + constructor(properties?: google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics); - /** Metadata documentSplitter. */ - public documentSplitter: boolean; + /** MultiConfidenceMetrics confidenceLevelMetrics. */ + public confidenceLevelMetrics: google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics[]; - /** Metadata documentAllowMultipleLabels. */ - public documentAllowMultipleLabels: boolean; + /** MultiConfidenceMetrics confidenceLevelMetricsExact. */ + public confidenceLevelMetricsExact: google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics[]; - /** Metadata prefixedNamingOnProperties. */ - public prefixedNamingOnProperties: boolean; + /** MultiConfidenceMetrics auprc. */ + public auprc: number; - /** Metadata skipNamingValidation. */ - public skipNamingValidation: boolean; + /** MultiConfidenceMetrics estimatedCalibrationError. */ + public estimatedCalibrationError: number; + + /** MultiConfidenceMetrics auprcExact. */ + public auprcExact: number; + + /** MultiConfidenceMetrics estimatedCalibrationErrorExact. */ + public estimatedCalibrationErrorExact: number; + + /** MultiConfidenceMetrics metricsType. */ + public metricsType: (google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.MetricsType|keyof typeof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.MetricsType); /** - * Creates a new Metadata instance using the specified properties. + * Creates a new MultiConfidenceMetrics instance using the specified properties. * @param [properties] Properties to set - * @returns Metadata instance + * @returns MultiConfidenceMetrics instance */ - public static create(properties?: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + public static create(properties?: google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics): google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics; /** - * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. - * @param message Metadata message or plain object to encode + * Encodes the specified MultiConfidenceMetrics message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.verify|verify} messages. + * @param message MultiConfidenceMetrics message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. - * @param message Metadata message or plain object to encode + * Encodes the specified MultiConfidenceMetrics message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.verify|verify} messages. + * @param message MultiConfidenceMetrics message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Metadata message from the specified reader or buffer. + * Decodes a MultiConfidenceMetrics message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Metadata + * @returns MultiConfidenceMetrics * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics; /** - * Decodes a Metadata message from the specified reader or buffer, length delimited. + * Decodes a MultiConfidenceMetrics message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Metadata + * @returns MultiConfidenceMetrics * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics; /** - * Verifies a Metadata message. + * Verifies a MultiConfidenceMetrics message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * Creates a MultiConfidenceMetrics message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Metadata + * @returns MultiConfidenceMetrics */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentSchema.Metadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics; /** - * Creates a plain object from a Metadata message. Also converts values to other types if specified. - * @param message Metadata + * Creates a plain object from a MultiConfidenceMetrics message. Also converts values to other types if specified. + * @param message MultiConfidenceMetrics * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1beta3.DocumentSchema.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Metadata to JSON. + * Converts this MultiConfidenceMetrics to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Metadata + * Gets the default type url for MultiConfidenceMetrics * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + namespace MultiConfidenceMetrics { + + /** MetricsType enum. */ + enum MetricsType { + METRICS_TYPE_UNSPECIFIED = 0, + AGGREGATE = 1 + } + } } /** Properties of a CommonOperationMetadata. */ @@ -31424,6 +33551,9 @@ export namespace google { /** ProcessorVersion displayName */ displayName?: (string|null); + /** ProcessorVersion documentSchema */ + documentSchema?: (google.cloud.documentai.v1beta3.IDocumentSchema|null); + /** ProcessorVersion state */ state?: (google.cloud.documentai.v1beta3.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1beta3.ProcessorVersion.State|null); @@ -31458,6 +33588,9 @@ export namespace google { /** ProcessorVersion displayName. */ public displayName: string; + /** ProcessorVersion documentSchema. */ + public documentSchema?: (google.cloud.documentai.v1beta3.IDocumentSchema|null); + /** ProcessorVersion state. */ public state: (google.cloud.documentai.v1beta3.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1beta3.ProcessorVersion.State); diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 3a0d67dc16f..ee6e3946501 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -52665,6 +52665,7 @@ * @property {string|null} [textStyle] Style textStyle * @property {string|null} [textDecoration] Style textDecoration * @property {google.cloud.documentai.v1beta3.Document.Style.IFontSize|null} [fontSize] Style fontSize + * @property {string|null} [fontFamily] Style fontFamily */ /** @@ -52738,6 +52739,14 @@ */ Style.prototype.fontSize = null; + /** + * Style fontFamily. + * @member {string} fontFamily + * @memberof google.cloud.documentai.v1beta3.Document.Style + * @instance + */ + Style.prototype.fontFamily = ""; + /** * Creates a new Style instance using the specified properties. * @function create @@ -52776,6 +52785,8 @@ writer.uint32(/* id 6, wireType 2 =*/50).string(message.textDecoration); if (message.fontSize != null && Object.hasOwnProperty.call(message, "fontSize")) $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.encode(message.fontSize, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.fontFamily != null && Object.hasOwnProperty.call(message, "fontFamily")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.fontFamily); return writer; }; @@ -52838,6 +52849,10 @@ message.fontSize = $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.decode(reader, reader.uint32()); break; } + case 8: { + message.fontFamily = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -52902,6 +52917,9 @@ if (error) return "fontSize." + error; } + if (message.fontFamily != null && message.hasOwnProperty("fontFamily")) + if (!$util.isString(message.fontFamily)) + return "fontFamily: string expected"; return null; }; @@ -52943,6 +52961,8 @@ throw TypeError(".google.cloud.documentai.v1beta3.Document.Style.fontSize: object expected"); message.fontSize = $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.fromObject(object.fontSize); } + if (object.fontFamily != null) + message.fontFamily = String(object.fontFamily); return message; }; @@ -52967,6 +52987,7 @@ object.textStyle = ""; object.textDecoration = ""; object.fontSize = null; + object.fontFamily = ""; } if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) object.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.toObject(message.textAnchor, options); @@ -52982,6 +53003,8 @@ object.textDecoration = message.textDecoration; if (message.fontSize != null && message.hasOwnProperty("fontSize")) object.fontSize = $root.google.cloud.documentai.v1beta3.Document.Style.FontSize.toObject(message.fontSize, options); + if (message.fontFamily != null && message.hasOwnProperty("fontFamily")) + object.fontFamily = message.fontFamily; return object; }; @@ -53262,6 +53285,7 @@ * @property {Array.|null} [formFields] Page formFields * @property {Array.|null} [symbols] Page symbols * @property {Array.|null} [detectedBarcodes] Page detectedBarcodes + * @property {google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores|null} [imageQualityScores] Page imageQualityScores * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Page provenance */ @@ -53411,6 +53435,14 @@ */ Page.prototype.detectedBarcodes = $util.emptyArray; + /** + * Page imageQualityScores. + * @member {google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores|null|undefined} imageQualityScores + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.imageQualityScores = null; + /** * Page provenance. * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance @@ -53486,6 +53518,8 @@ $root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.encode(message.detectedBarcodes[i], writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.imageQualityScores != null && Object.hasOwnProperty.call(message, "imageQualityScores")) + $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.encode(message.imageQualityScores, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); return writer; }; @@ -53602,6 +53636,10 @@ message.detectedBarcodes.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.decode(reader, reader.uint32())); break; } + case 17: { + message.imageQualityScores = $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.decode(reader, reader.uint32()); + break; + } case 16: { message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); break; @@ -53758,6 +53796,11 @@ return "detectedBarcodes." + error; } } + if (message.imageQualityScores != null && message.hasOwnProperty("imageQualityScores")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.verify(message.imageQualityScores); + if (error) + return "imageQualityScores." + error; + } if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); if (error) @@ -53905,6 +53948,11 @@ message.detectedBarcodes[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode.fromObject(object.detectedBarcodes[i]); } } + if (object.imageQualityScores != null) { + if (typeof object.imageQualityScores !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.imageQualityScores: object expected"); + message.imageQualityScores = $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.fromObject(object.imageQualityScores); + } if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.provenance: object expected"); @@ -53945,6 +53993,7 @@ object.layout = null; object.image = null; object.provenance = null; + object.imageQualityScores = null; } if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) object.pageNumber = message.pageNumber; @@ -54011,6 +54060,8 @@ } if (message.provenance != null && message.hasOwnProperty("provenance")) object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); + if (message.imageQualityScores != null && message.hasOwnProperty("imageQualityScores")) + object.imageQualityScores = $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.toObject(message.imageQualityScores, options); return object; }; @@ -57137,6 +57188,7 @@ * @property {Array.|null} [headerRows] Table headerRows * @property {Array.|null} [bodyRows] Table bodyRows * @property {Array.|null} [detectedLanguages] Table detectedLanguages + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Table provenance */ /** @@ -57189,6 +57241,14 @@ */ Table.prototype.detectedLanguages = $util.emptyArray; + /** + * Table provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Page.Table + * @instance + */ + Table.prototype.provenance = null; + /** * Creates a new Table instance using the specified properties. * @function create @@ -57224,6 +57284,8 @@ if (message.detectedLanguages != null && message.detectedLanguages.length) for (var i = 0; i < message.detectedLanguages.length; ++i) $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -57280,6 +57342,10 @@ message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); break; } + case 5: { + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -57347,6 +57413,11 @@ return "detectedLanguages." + error; } } + if (message.provenance != null && message.hasOwnProperty("provenance")) { + var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); + if (error) + return "provenance." + error; + } return null; }; @@ -57397,6 +57468,11 @@ message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); } } + if (object.provenance != null) { + if (typeof object.provenance !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Table.provenance: object expected"); + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.fromObject(object.provenance); + } return message; }; @@ -57418,8 +57494,10 @@ object.bodyRows = []; object.detectedLanguages = []; } - if (options.defaults) + if (options.defaults) { object.layout = null; + object.provenance = null; + } if (message.layout != null && message.hasOwnProperty("layout")) object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); if (message.headerRows && message.headerRows.length) { @@ -57437,6 +57515,8 @@ for (var j = 0; j < message.detectedLanguages.length; ++j) object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); } + if (message.provenance != null && message.hasOwnProperty("provenance")) + object.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.toObject(message.provenance, options); return object; }; @@ -58881,297 +58961,772 @@ return DetectedLanguage; })(); - return Page; - })(); + Page.ImageQualityScores = (function() { - Document.Entity = (function() { + /** + * Properties of an ImageQualityScores. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface IImageQualityScores + * @property {number|null} [qualityScore] ImageQualityScores qualityScore + * @property {Array.|null} [detectedDefects] ImageQualityScores detectedDefects + */ - /** - * Properties of an Entity. - * @memberof google.cloud.documentai.v1beta3.Document - * @interface IEntity - * @property {google.cloud.documentai.v1beta3.Document.ITextAnchor|null} [textAnchor] Entity textAnchor - * @property {string|null} [type] Entity type - * @property {string|null} [mentionText] Entity mentionText - * @property {string|null} [mentionId] Entity mentionId - * @property {number|null} [confidence] Entity confidence - * @property {google.cloud.documentai.v1beta3.Document.IPageAnchor|null} [pageAnchor] Entity pageAnchor - * @property {string|null} [id] Entity id - * @property {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue|null} [normalizedValue] Entity normalizedValue - * @property {Array.|null} [properties] Entity properties - * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Entity provenance - * @property {boolean|null} [redacted] Entity redacted - */ + /** + * Constructs a new ImageQualityScores. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents an ImageQualityScores. + * @implements IImageQualityScores + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores=} [properties] Properties to set + */ + function ImageQualityScores(properties) { + this.detectedDefects = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Constructs a new Entity. - * @memberof google.cloud.documentai.v1beta3.Document - * @classdesc Represents an Entity. - * @implements IEntity - * @constructor - * @param {google.cloud.documentai.v1beta3.Document.IEntity=} [properties] Properties to set - */ - function Entity(properties) { - this.properties = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * ImageQualityScores qualityScore. + * @member {number} qualityScore + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @instance + */ + ImageQualityScores.prototype.qualityScore = 0; - /** - * Entity textAnchor. - * @member {google.cloud.documentai.v1beta3.Document.ITextAnchor|null|undefined} textAnchor - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.textAnchor = null; + /** + * ImageQualityScores detectedDefects. + * @member {Array.} detectedDefects + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @instance + */ + ImageQualityScores.prototype.detectedDefects = $util.emptyArray; - /** - * Entity type. - * @member {string} type - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.type = ""; + /** + * Creates a new ImageQualityScores instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores} ImageQualityScores instance + */ + ImageQualityScores.create = function create(properties) { + return new ImageQualityScores(properties); + }; - /** - * Entity mentionText. - * @member {string} mentionText - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.mentionText = ""; + /** + * Encodes the specified ImageQualityScores message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores} message ImageQualityScores message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImageQualityScores.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.qualityScore != null && Object.hasOwnProperty.call(message, "qualityScore")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.qualityScore); + if (message.detectedDefects != null && message.detectedDefects.length) + for (var i = 0; i < message.detectedDefects.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect.encode(message.detectedDefects[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; - /** - * Entity mentionId. - * @member {string} mentionId - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.mentionId = ""; + /** + * Encodes the specified ImageQualityScores message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.IImageQualityScores} message ImageQualityScores message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImageQualityScores.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Entity confidence. - * @member {number} confidence - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.confidence = 0; + /** + * Decodes an ImageQualityScores message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores} ImageQualityScores + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImageQualityScores.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.qualityScore = reader.float(); + break; + } + case 2: { + if (!(message.detectedDefects && message.detectedDefects.length)) + message.detectedDefects = []; + message.detectedDefects.push($root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Entity pageAnchor. - * @member {google.cloud.documentai.v1beta3.Document.IPageAnchor|null|undefined} pageAnchor - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.pageAnchor = null; + /** + * Decodes an ImageQualityScores message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores} ImageQualityScores + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImageQualityScores.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Entity id. - * @member {string} id - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.id = ""; + /** + * Verifies an ImageQualityScores message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImageQualityScores.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.qualityScore != null && message.hasOwnProperty("qualityScore")) + if (typeof message.qualityScore !== "number") + return "qualityScore: number expected"; + if (message.detectedDefects != null && message.hasOwnProperty("detectedDefects")) { + if (!Array.isArray(message.detectedDefects)) + return "detectedDefects: array expected"; + for (var i = 0; i < message.detectedDefects.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect.verify(message.detectedDefects[i]); + if (error) + return "detectedDefects." + error; + } + } + return null; + }; - /** - * Entity normalizedValue. - * @member {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue|null|undefined} normalizedValue - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.normalizedValue = null; + /** + * Creates an ImageQualityScores message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores} ImageQualityScores + */ + ImageQualityScores.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores(); + if (object.qualityScore != null) + message.qualityScore = Number(object.qualityScore); + if (object.detectedDefects) { + if (!Array.isArray(object.detectedDefects)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.detectedDefects: array expected"); + message.detectedDefects = []; + for (var i = 0; i < object.detectedDefects.length; ++i) { + if (typeof object.detectedDefects[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.detectedDefects: object expected"); + message.detectedDefects[i] = $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect.fromObject(object.detectedDefects[i]); + } + } + return message; + }; - /** - * Entity properties. - * @member {Array.} properties - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.properties = $util.emptyArray; + /** + * Creates a plain object from an ImageQualityScores message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores} message ImageQualityScores + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImageQualityScores.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedDefects = []; + if (options.defaults) + object.qualityScore = 0; + if (message.qualityScore != null && message.hasOwnProperty("qualityScore")) + object.qualityScore = options.json && !isFinite(message.qualityScore) ? String(message.qualityScore) : message.qualityScore; + if (message.detectedDefects && message.detectedDefects.length) { + object.detectedDefects = []; + for (var j = 0; j < message.detectedDefects.length; ++j) + object.detectedDefects[j] = $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect.toObject(message.detectedDefects[j], options); + } + return object; + }; - /** - * Entity provenance. - * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.provenance = null; + /** + * Converts this ImageQualityScores to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @instance + * @returns {Object.} JSON object + */ + ImageQualityScores.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Entity redacted. - * @member {boolean} redacted - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @instance - */ - Entity.prototype.redacted = false; + /** + * Gets the default type url for ImageQualityScores + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImageQualityScores.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores"; + }; - /** - * Creates a new Entity instance using the specified properties. - * @function create - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @static - * @param {google.cloud.documentai.v1beta3.Document.IEntity=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity instance - */ - Entity.create = function create(properties) { - return new Entity(properties); - }; + ImageQualityScores.DetectedDefect = (function() { - /** - * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.verify|verify} messages. - * @function encode - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @static - * @param {google.cloud.documentai.v1beta3.Document.IEntity} message Entity message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Entity.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) - $root.google.cloud.documentai.v1beta3.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - if (message.mentionText != null && Object.hasOwnProperty.call(message, "mentionText")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.mentionText); - if (message.mentionId != null && Object.hasOwnProperty.call(message, "mentionId")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.mentionId); - if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.pageAnchor != null && Object.hasOwnProperty.call(message, "pageAnchor")) - $root.google.cloud.documentai.v1beta3.Document.PageAnchor.encode(message.pageAnchor, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.id); - if (message.normalizedValue != null && Object.hasOwnProperty.call(message, "normalizedValue")) - $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.encode(message.normalizedValue, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.properties != null && message.properties.length) - for (var i = 0; i < message.properties.length; ++i) - $root.google.cloud.documentai.v1beta3.Document.Entity.encode(message.properties[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) - $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.redacted != null && Object.hasOwnProperty.call(message, "redacted")) - writer.uint32(/* id 12, wireType 0 =*/96).bool(message.redacted); - return writer; - }; + /** + * Properties of a DetectedDefect. + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @interface IDetectedDefect + * @property {string|null} [type] DetectedDefect type + * @property {number|null} [confidence] DetectedDefect confidence + */ - /** - * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @static - * @param {google.cloud.documentai.v1beta3.Document.IEntity} message Entity message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Entity.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Constructs a new DetectedDefect. + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores + * @classdesc Represents a DetectedDefect. + * @implements IDetectedDefect + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect=} [properties] Properties to set + */ + function DetectedDefect(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Decodes an Entity message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Entity.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Entity(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); - break; - } - case 2: { - message.type = reader.string(); - break; - } - case 3: { - message.mentionText = reader.string(); - break; - } - case 4: { - message.mentionId = reader.string(); - break; - } - case 5: { - message.confidence = reader.float(); - break; - } - case 6: { - message.pageAnchor = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.decode(reader, reader.uint32()); - break; - } - case 7: { - message.id = reader.string(); - break; - } - case 9: { - message.normalizedValue = $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.decode(reader, reader.uint32()); - break; - } - case 10: { - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.documentai.v1beta3.Document.Entity.decode(reader, reader.uint32())); - break; - } - case 11: { - message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); - break; + /** + * DetectedDefect type. + * @member {string} type + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @instance + */ + DetectedDefect.prototype.type = ""; + + /** + * DetectedDefect confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @instance + */ + DetectedDefect.prototype.confidence = 0; + + /** + * Creates a new DetectedDefect instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect} DetectedDefect instance + */ + DetectedDefect.create = function create(properties) { + return new DetectedDefect(properties); + }; + + /** + * Encodes the specified DetectedDefect message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect} message DetectedDefect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedDefect.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified DetectedDefect message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.IDetectedDefect} message DetectedDefect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedDefect.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedDefect message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect} DetectedDefect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedDefect.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } } - case 12: { - message.redacted = reader.bool(); - break; + return message; + }; + + /** + * Decodes a DetectedDefect message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect} DetectedDefect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedDefect.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedDefect message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedDefect.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a DetectedDefect message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect} DetectedDefect + */ + DetectedDefect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect(); + if (object.type != null) + message.type = String(object.type); + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a DetectedDefect message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect} message DetectedDefect + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedDefect.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.confidence = 0; } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this DetectedDefect to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @instance + * @returns {Object.} JSON object + */ + DetectedDefect.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectedDefect + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectedDefect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Document.Page.ImageQualityScores.DetectedDefect"; + }; + + return DetectedDefect; + })(); + + return ImageQualityScores; + })(); + + return Page; + })(); + + Document.Entity = (function() { /** - * Decodes an Entity message from the specified reader or buffer, length delimited. - * @function decodeDelimited + * Properties of an Entity. + * @memberof google.cloud.documentai.v1beta3.Document + * @interface IEntity + * @property {google.cloud.documentai.v1beta3.Document.ITextAnchor|null} [textAnchor] Entity textAnchor + * @property {string|null} [type] Entity type + * @property {string|null} [mentionText] Entity mentionText + * @property {string|null} [mentionId] Entity mentionId + * @property {number|null} [confidence] Entity confidence + * @property {google.cloud.documentai.v1beta3.Document.IPageAnchor|null} [pageAnchor] Entity pageAnchor + * @property {string|null} [id] Entity id + * @property {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue|null} [normalizedValue] Entity normalizedValue + * @property {Array.|null} [properties] Entity properties + * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Entity provenance + * @property {boolean|null} [redacted] Entity redacted + */ + + /** + * Constructs a new Entity. + * @memberof google.cloud.documentai.v1beta3.Document + * @classdesc Represents an Entity. + * @implements IEntity + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.IEntity=} [properties] Properties to set + */ + function Entity(properties) { + this.properties = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entity textAnchor. + * @member {google.cloud.documentai.v1beta3.Document.ITextAnchor|null|undefined} textAnchor * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * @instance */ - Entity.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + Entity.prototype.textAnchor = null; /** - * Verifies an Entity message. - * @function verify + * Entity type. + * @member {string} type * @memberof google.cloud.documentai.v1beta3.Document.Entity - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * @instance */ - Entity.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { - var error = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.verify(message.textAnchor); - if (error) + Entity.prototype.type = ""; + + /** + * Entity mentionText. + * @member {string} mentionText + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.mentionText = ""; + + /** + * Entity mentionId. + * @member {string} mentionId + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.mentionId = ""; + + /** + * Entity confidence. + * @member {number} confidence + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.confidence = 0; + + /** + * Entity pageAnchor. + * @member {google.cloud.documentai.v1beta3.Document.IPageAnchor|null|undefined} pageAnchor + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.pageAnchor = null; + + /** + * Entity id. + * @member {string} id + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.id = ""; + + /** + * Entity normalizedValue. + * @member {google.cloud.documentai.v1beta3.Document.Entity.INormalizedValue|null|undefined} normalizedValue + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.normalizedValue = null; + + /** + * Entity properties. + * @member {Array.} properties + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.properties = $util.emptyArray; + + /** + * Entity provenance. + * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.provenance = null; + + /** + * Entity redacted. + * @member {boolean} redacted + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @instance + */ + Entity.prototype.redacted = false; + + /** + * Creates a new Entity instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta3.Document.IEntity=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity instance + */ + Entity.create = function create(properties) { + return new Entity(properties); + }; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta3.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textAnchor != null && Object.hasOwnProperty.call(message, "textAnchor")) + $root.google.cloud.documentai.v1beta3.Document.TextAnchor.encode(message.textAnchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.mentionText != null && Object.hasOwnProperty.call(message, "mentionText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mentionText); + if (message.mentionId != null && Object.hasOwnProperty.call(message, "mentionId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mentionId); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.pageAnchor != null && Object.hasOwnProperty.call(message, "pageAnchor")) + $root.google.cloud.documentai.v1beta3.Document.PageAnchor.encode(message.pageAnchor, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.id); + if (message.normalizedValue != null && Object.hasOwnProperty.call(message, "normalizedValue")) + $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.encode(message.normalizedValue, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Entity.encode(message.properties[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) + $root.google.cloud.documentai.v1beta3.Document.Provenance.encode(message.provenance, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.redacted != null && Object.hasOwnProperty.call(message, "redacted")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.redacted); + return writer; + }; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Entity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {google.cloud.documentai.v1beta3.Document.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Entity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.textAnchor = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.decode(reader, reader.uint32()); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + message.mentionText = reader.string(); + break; + } + case 4: { + message.mentionId = reader.string(); + break; + } + case 5: { + message.confidence = reader.float(); + break; + } + case 6: { + message.pageAnchor = $root.google.cloud.documentai.v1beta3.Document.PageAnchor.decode(reader, reader.uint32()); + break; + } + case 7: { + message.id = reader.string(); + break; + } + case 9: { + message.normalizedValue = $root.google.cloud.documentai.v1beta3.Document.Entity.NormalizedValue.decode(reader, reader.uint32()); + break; + } + case 10: { + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1beta3.Document.Entity.decode(reader, reader.uint32())); + break; + } + case 11: { + message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); + break; + } + case 12: { + message.redacted = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entity message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Entity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textAnchor != null && message.hasOwnProperty("textAnchor")) { + var error = $root.google.cloud.documentai.v1beta3.Document.TextAnchor.verify(message.textAnchor); + if (error) return "textAnchor." + error; } if (message.type != null && message.hasOwnProperty("type")) @@ -64815,6 +65370,7 @@ * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig * @interface IGcsOutputConfig * @property {string|null} [gcsUri] GcsOutputConfig gcsUri + * @property {google.protobuf.IFieldMask|null} [fieldMask] GcsOutputConfig fieldMask */ /** @@ -64840,6 +65396,14 @@ */ GcsOutputConfig.prototype.gcsUri = ""; + /** + * GcsOutputConfig fieldMask. + * @member {google.protobuf.IFieldMask|null|undefined} fieldMask + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @instance + */ + GcsOutputConfig.prototype.fieldMask = null; + /** * Creates a new GcsOutputConfig instance using the specified properties. * @function create @@ -64866,6 +65430,8 @@ writer = $Writer.create(); if (message.gcsUri != null && Object.hasOwnProperty.call(message, "gcsUri")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUri); + if (message.fieldMask != null && Object.hasOwnProperty.call(message, "fieldMask")) + $root.google.protobuf.FieldMask.encode(message.fieldMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -64904,6 +65470,10 @@ message.gcsUri = reader.string(); break; } + case 2: { + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -64942,8 +65512,13 @@ if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) if (!$util.isString(message.gcsUri)) return "gcsUri: string expected"; - return null; - }; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.fieldMask); + if (error) + return "fieldMask." + error; + } + return null; + }; /** * Creates a GcsOutputConfig message from a plain object. Also converts values to their respective internal types. @@ -64959,6 +65534,11 @@ var message = new $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig(); if (object.gcsUri != null) message.gcsUri = String(object.gcsUri); + if (object.fieldMask != null) { + if (typeof object.fieldMask !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.fieldMask: object expected"); + message.fieldMask = $root.google.protobuf.FieldMask.fromObject(object.fieldMask); + } return message; }; @@ -64975,10 +65555,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.gcsUri = ""; + object.fieldMask = null; + } if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) object.gcsUri = message.gcsUri; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) + object.fieldMask = $root.google.protobuf.FieldMask.toObject(message.fieldMask, options); return object; }; @@ -65244,6 +65828,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|trainProcessorVersion}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef TrainProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls TrainProcessorVersion. + * @function trainProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest} request TrainProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.TrainProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.trainProcessorVersion = function trainProcessorVersion(request, callback) { + return this.rpcCall(trainProcessorVersion, $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "TrainProcessorVersion" }); + + /** + * Calls TrainProcessorVersion. + * @function trainProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest} request TrainProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|getProcessorVersion}. * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService @@ -65607,6 +66224,105 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|evaluateProcessorVersion}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef EvaluateProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls EvaluateProcessorVersion. + * @function evaluateProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest} request EvaluateProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.EvaluateProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.evaluateProcessorVersion = function evaluateProcessorVersion(request, callback) { + return this.rpcCall(evaluateProcessorVersion, $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "EvaluateProcessorVersion" }); + + /** + * Calls EvaluateProcessorVersion. + * @function evaluateProcessorVersion + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest} request EvaluateProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|getEvaluation}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef GetEvaluationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.Evaluation} [response] Evaluation + */ + + /** + * Calls GetEvaluation. + * @function getEvaluation + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IGetEvaluationRequest} request GetEvaluationRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.GetEvaluationCallback} callback Node-style callback called with the error, if any, and Evaluation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.getEvaluation = function getEvaluation(request, callback) { + return this.rpcCall(getEvaluation, $root.google.cloud.documentai.v1beta3.GetEvaluationRequest, $root.google.cloud.documentai.v1beta3.Evaluation, request, callback); + }, "name", { value: "GetEvaluation" }); + + /** + * Calls GetEvaluation. + * @function getEvaluation + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IGetEvaluationRequest} request GetEvaluationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1beta3.DocumentProcessorService|listEvaluations}. + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @typedef ListEvaluationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1beta3.ListEvaluationsResponse} [response] ListEvaluationsResponse + */ + + /** + * Calls ListEvaluations. + * @function listEvaluations + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IListEvaluationsRequest} request ListEvaluationsRequest message or plain object + * @param {google.cloud.documentai.v1beta3.DocumentProcessorService.ListEvaluationsCallback} callback Node-style callback called with the error, if any, and ListEvaluationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.listEvaluations = function listEvaluations(request, callback) { + return this.rpcCall(listEvaluations, $root.google.cloud.documentai.v1beta3.ListEvaluationsRequest, $root.google.cloud.documentai.v1beta3.ListEvaluationsResponse, request, callback); + }, "name", { value: "ListEvaluations" }); + + /** + * Calls ListEvaluations. + * @function listEvaluations + * @memberof google.cloud.documentai.v1beta3.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1beta3.IListEvaluationsRequest} request ListEvaluationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return DocumentProcessorService; })(); @@ -74538,29 +75254,28 @@ return SetDefaultProcessorVersionMetadata; })(); - v1beta3.ReviewDocumentRequest = (function() { + v1beta3.TrainProcessorVersionRequest = (function() { /** - * Properties of a ReviewDocumentRequest. + * Properties of a TrainProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentRequest - * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument - * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig - * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ReviewDocumentRequest document - * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation - * @property {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority - * @property {google.cloud.documentai.v1beta3.IDocumentSchema|null} [documentSchema] ReviewDocumentRequest documentSchema + * @interface ITrainProcessorVersionRequest + * @property {string|null} [parent] TrainProcessorVersionRequest parent + * @property {google.cloud.documentai.v1beta3.IProcessorVersion|null} [processorVersion] TrainProcessorVersionRequest processorVersion + * @property {google.cloud.documentai.v1beta3.IDocumentSchema|null} [documentSchema] TrainProcessorVersionRequest documentSchema + * @property {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData|null} [inputData] TrainProcessorVersionRequest inputData + * @property {string|null} [baseProcessorVersion] TrainProcessorVersionRequest baseProcessorVersion */ /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new TrainProcessorVersionRequest. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentRequest. - * @implements IReviewDocumentRequest + * @classdesc Represents a TrainProcessorVersionRequest. + * @implements ITrainProcessorVersionRequest * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest=} [properties] Properties to set */ - function ReviewDocumentRequest(properties) { + function TrainProcessorVersionRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -74568,159 +75283,131 @@ } /** - * ReviewDocumentRequest inlineDocument. - * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.inlineDocument = null; - - /** - * ReviewDocumentRequest humanReviewConfig. - * @member {string} humanReviewConfig - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.humanReviewConfig = ""; - - /** - * ReviewDocumentRequest document. - * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * TrainProcessorVersionRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @instance */ - ReviewDocumentRequest.prototype.document = null; + TrainProcessorVersionRequest.prototype.parent = ""; /** - * ReviewDocumentRequest enableSchemaValidation. - * @member {boolean} enableSchemaValidation - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * TrainProcessorVersionRequest processorVersion. + * @member {google.cloud.documentai.v1beta3.IProcessorVersion|null|undefined} processorVersion + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @instance */ - ReviewDocumentRequest.prototype.enableSchemaValidation = false; + TrainProcessorVersionRequest.prototype.processorVersion = null; /** - * ReviewDocumentRequest priority. - * @member {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} priority - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * TrainProcessorVersionRequest documentSchema. + * @member {google.cloud.documentai.v1beta3.IDocumentSchema|null|undefined} documentSchema + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @instance */ - ReviewDocumentRequest.prototype.priority = 0; + TrainProcessorVersionRequest.prototype.documentSchema = null; /** - * ReviewDocumentRequest documentSchema. - * @member {google.cloud.documentai.v1beta3.IDocumentSchema|null|undefined} documentSchema - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * TrainProcessorVersionRequest inputData. + * @member {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData|null|undefined} inputData + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @instance */ - ReviewDocumentRequest.prototype.documentSchema = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + TrainProcessorVersionRequest.prototype.inputData = null; /** - * ReviewDocumentRequest source. - * @member {"inlineDocument"|undefined} source - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * TrainProcessorVersionRequest baseProcessorVersion. + * @member {string} baseProcessorVersion + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @instance */ - Object.defineProperty(ReviewDocumentRequest.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), - set: $util.oneOfSetter($oneOfFields) - }); + TrainProcessorVersionRequest.prototype.baseProcessorVersion = ""; /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new TrainProcessorVersionRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest instance + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest} TrainProcessorVersionRequest instance */ - ReviewDocumentRequest.create = function create(properties) { - return new ReviewDocumentRequest(properties); + TrainProcessorVersionRequest.create = function create(properties) { + return new TrainProcessorVersionRequest(properties); }; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified TrainProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest} message TrainProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encode = function encode(message, writer) { + TrainProcessorVersionRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); - if (message.document != null && Object.hasOwnProperty.call(message, "document")) - $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.enableSchemaValidation != null && Object.hasOwnProperty.call(message, "enableSchemaValidation")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSchemaValidation); - if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) - $root.google.cloud.documentai.v1beta3.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.priority); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.processorVersion != null && Object.hasOwnProperty.call(message, "processorVersion")) + $root.google.cloud.documentai.v1beta3.ProcessorVersion.encode(message.processorVersion, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.inputData != null && Object.hasOwnProperty.call(message, "inputData")) + $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.encode(message.inputData, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.baseProcessorVersion != null && Object.hasOwnProperty.call(message, "baseProcessorVersion")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.baseProcessorVersion); if (message.documentSchema != null && Object.hasOwnProperty.call(message, "documentSchema")) - $root.google.cloud.documentai.v1beta3.DocumentSchema.encode(message.documentSchema, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + $root.google.cloud.documentai.v1beta3.DocumentSchema.encode(message.documentSchema, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); return writer; }; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified TrainProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest} message TrainProcessorVersionRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + TrainProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a TrainProcessorVersionRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest} TrainProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentRequest.decode = function decode(reader, length) { + TrainProcessorVersionRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: { - message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); - break; - } case 1: { - message.humanReviewConfig = reader.string(); + message.parent = reader.string(); break; } case 2: { - message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + message.processorVersion = $root.google.cloud.documentai.v1beta3.ProcessorVersion.decode(reader, reader.uint32()); break; } - case 3: { - message.enableSchemaValidation = reader.bool(); + case 10: { + message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.decode(reader, reader.uint32()); break; } - case 5: { - message.priority = reader.int32(); + case 4: { + message.inputData = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.decode(reader, reader.uint32()); break; } - case 6: { - message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.decode(reader, reader.uint32()); + case 8: { + message.baseProcessorVersion = reader.string(); break; } default: @@ -74732,219 +75419,407 @@ }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a TrainProcessorVersionRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest} TrainProcessorVersionRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + TrainProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a TrainProcessorVersionRequest message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentRequest.verify = function verify(message) { + TrainProcessorVersionRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { - properties.source = 1; - { - var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.inlineDocument); - if (error) - return "inlineDocument." + error; - } - } - if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) - if (!$util.isString(message.humanReviewConfig)) - return "humanReviewConfig: string expected"; - if (message.document != null && message.hasOwnProperty("document")) { - var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.processorVersion != null && message.hasOwnProperty("processorVersion")) { + var error = $root.google.cloud.documentai.v1beta3.ProcessorVersion.verify(message.processorVersion); if (error) - return "document." + error; + return "processorVersion." + error; } - if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) - if (typeof message.enableSchemaValidation !== "boolean") - return "enableSchemaValidation: boolean expected"; - if (message.priority != null && message.hasOwnProperty("priority")) - switch (message.priority) { - default: - return "priority: enum value expected"; - case 0: - case 1: - break; - } if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) { var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.verify(message.documentSchema); if (error) return "documentSchema." + error; } + if (message.inputData != null && message.hasOwnProperty("inputData")) { + var error = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.verify(message.inputData); + if (error) + return "inputData." + error; + } + if (message.baseProcessorVersion != null && message.hasOwnProperty("baseProcessorVersion")) + if (!$util.isString(message.baseProcessorVersion)) + return "baseProcessorVersion: string expected"; return null; }; /** - * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a TrainProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest} TrainProcessorVersionRequest */ - ReviewDocumentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest) + TrainProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); - if (object.inlineDocument != null) { - if (typeof object.inlineDocument !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.inlineDocument: object expected"); - message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.inlineDocument); - } - if (object.humanReviewConfig != null) - message.humanReviewConfig = String(object.humanReviewConfig); - if (object.document != null) { - if (typeof object.document !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.document: object expected"); - message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); - } - if (object.enableSchemaValidation != null) - message.enableSchemaValidation = Boolean(object.enableSchemaValidation); - switch (object.priority) { - default: - if (typeof object.priority === "number") { - message.priority = object.priority; - break; - } - break; - case "DEFAULT": - case 0: - message.priority = 0; - break; - case "URGENT": - case 1: - message.priority = 1; - break; + var message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.processorVersion != null) { + if (typeof object.processorVersion !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.processorVersion: object expected"); + message.processorVersion = $root.google.cloud.documentai.v1beta3.ProcessorVersion.fromObject(object.processorVersion); } if (object.documentSchema != null) { if (typeof object.documentSchema !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.documentSchema: object expected"); + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.documentSchema: object expected"); message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.fromObject(object.documentSchema); } + if (object.inputData != null) { + if (typeof object.inputData !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.inputData: object expected"); + message.inputData = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.fromObject(object.inputData); + } + if (object.baseProcessorVersion != null) + message.baseProcessorVersion = String(object.baseProcessorVersion); return message; }; /** - * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * Creates a plain object from a TrainProcessorVersionRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest} message TrainProcessorVersionRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentRequest.toObject = function toObject(message, options) { + TrainProcessorVersionRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.humanReviewConfig = ""; - object.document = null; - object.enableSchemaValidation = false; - object.priority = options.enums === String ? "DEFAULT" : 0; + object.parent = ""; + object.processorVersion = null; + object.inputData = null; + object.baseProcessorVersion = ""; object.documentSchema = null; } - if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) - object.humanReviewConfig = message.humanReviewConfig; - if (message.document != null && message.hasOwnProperty("document")) - object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); - if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) - object.enableSchemaValidation = message.enableSchemaValidation; - if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { - object.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.toObject(message.inlineDocument, options); - if (options.oneofs) - object.source = "inlineDocument"; - } - if (message.priority != null && message.hasOwnProperty("priority")) - object.priority = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] === undefined ? message.priority : $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] : message.priority; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.processorVersion != null && message.hasOwnProperty("processorVersion")) + object.processorVersion = $root.google.cloud.documentai.v1beta3.ProcessorVersion.toObject(message.processorVersion, options); + if (message.inputData != null && message.hasOwnProperty("inputData")) + object.inputData = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.toObject(message.inputData, options); + if (message.baseProcessorVersion != null && message.hasOwnProperty("baseProcessorVersion")) + object.baseProcessorVersion = message.baseProcessorVersion; if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) object.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.toObject(message.documentSchema, options); return object; }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this TrainProcessorVersionRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @instance * @returns {Object.} JSON object */ - ReviewDocumentRequest.prototype.toJSON = function toJSON() { + TrainProcessorVersionRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ReviewDocumentRequest + * Gets the default type url for TrainProcessorVersionRequest * @function getTypeUrl - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ReviewDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + TrainProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ReviewDocumentRequest"; + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.TrainProcessorVersionRequest"; }; - /** - * Priority enum. - * @name google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority - * @enum {number} - * @property {number} DEFAULT=0 DEFAULT value - * @property {number} URGENT=1 URGENT value - */ - ReviewDocumentRequest.Priority = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DEFAULT"] = 0; - values[valuesById[1] = "URGENT"] = 1; - return values; + TrainProcessorVersionRequest.InputData = (function() { + + /** + * Properties of an InputData. + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest + * @interface IInputData + * @property {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null} [trainingDocuments] InputData trainingDocuments + * @property {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null} [testDocuments] InputData testDocuments + */ + + /** + * Constructs a new InputData. + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest + * @classdesc Represents an InputData. + * @implements IInputData + * @constructor + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData=} [properties] Properties to set + */ + function InputData(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InputData trainingDocuments. + * @member {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null|undefined} trainingDocuments + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @instance + */ + InputData.prototype.trainingDocuments = null; + + /** + * InputData testDocuments. + * @member {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null|undefined} testDocuments + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @instance + */ + InputData.prototype.testDocuments = null; + + /** + * Creates a new InputData instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @static + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData} InputData instance + */ + InputData.create = function create(properties) { + return new InputData(properties); + }; + + /** + * Encodes the specified InputData message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @static + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData} message InputData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputData.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.trainingDocuments != null && Object.hasOwnProperty.call(message, "trainingDocuments")) + $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.encode(message.trainingDocuments, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.testDocuments != null && Object.hasOwnProperty.call(message, "testDocuments")) + $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.encode(message.testDocuments, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InputData message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @static + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.IInputData} message InputData message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputData.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InputData message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData} InputData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputData.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.trainingDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.testDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InputData message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData} InputData + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputData.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InputData message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InputData.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.trainingDocuments != null && message.hasOwnProperty("trainingDocuments")) { + var error = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.verify(message.trainingDocuments); + if (error) + return "trainingDocuments." + error; + } + if (message.testDocuments != null && message.hasOwnProperty("testDocuments")) { + var error = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.verify(message.testDocuments); + if (error) + return "testDocuments." + error; + } + return null; + }; + + /** + * Creates an InputData message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData} InputData + */ + InputData.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData) + return object; + var message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData(); + if (object.trainingDocuments != null) { + if (typeof object.trainingDocuments !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.trainingDocuments: object expected"); + message.trainingDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.fromObject(object.trainingDocuments); + } + if (object.testDocuments != null) { + if (typeof object.testDocuments !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData.testDocuments: object expected"); + message.testDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.fromObject(object.testDocuments); + } + return message; + }; + + /** + * Creates a plain object from an InputData message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @static + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData} message InputData + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InputData.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.trainingDocuments = null; + object.testDocuments = null; + } + if (message.trainingDocuments != null && message.hasOwnProperty("trainingDocuments")) + object.trainingDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.toObject(message.trainingDocuments, options); + if (message.testDocuments != null && message.hasOwnProperty("testDocuments")) + object.testDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.toObject(message.testDocuments, options); + return object; + }; + + /** + * Converts this InputData to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @instance + * @returns {Object.} JSON object + */ + InputData.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InputData + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputData.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData"; + }; + + return InputData; })(); - return ReviewDocumentRequest; + return TrainProcessorVersionRequest; })(); - v1beta3.ReviewDocumentResponse = (function() { + v1beta3.TrainProcessorVersionResponse = (function() { /** - * Properties of a ReviewDocumentResponse. + * Properties of a TrainProcessorVersionResponse. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentResponse - * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination - * @property {google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|null} [state] ReviewDocumentResponse state - * @property {string|null} [rejectionReason] ReviewDocumentResponse rejectionReason + * @interface ITrainProcessorVersionResponse + * @property {string|null} [processorVersion] TrainProcessorVersionResponse processorVersion */ /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new TrainProcessorVersionResponse. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentResponse. - * @implements IReviewDocumentResponse + * @classdesc Represents a TrainProcessorVersionResponse. + * @implements ITrainProcessorVersionResponse * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse=} [properties] Properties to set */ - function ReviewDocumentResponse(properties) { + function TrainProcessorVersionResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -74952,103 +75827,75 @@ } /** - * ReviewDocumentResponse gcsDestination. - * @member {string} gcsDestination - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse - * @instance - */ - ReviewDocumentResponse.prototype.gcsDestination = ""; - - /** - * ReviewDocumentResponse state. - * @member {google.cloud.documentai.v1beta3.ReviewDocumentResponse.State} state - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse - * @instance - */ - ReviewDocumentResponse.prototype.state = 0; - - /** - * ReviewDocumentResponse rejectionReason. - * @member {string} rejectionReason - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * TrainProcessorVersionResponse processorVersion. + * @member {string} processorVersion + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @instance */ - ReviewDocumentResponse.prototype.rejectionReason = ""; + TrainProcessorVersionResponse.prototype.processorVersion = ""; /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new TrainProcessorVersionResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse instance + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionResponse} TrainProcessorVersionResponse instance */ - ReviewDocumentResponse.create = function create(properties) { - return new ReviewDocumentResponse(properties); + TrainProcessorVersionResponse.create = function create(properties) { + return new TrainProcessorVersionResponse(properties); }; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified TrainProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse} message TrainProcessorVersionResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encode = function encode(message, writer) { + TrainProcessorVersionResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); - if (message.rejectionReason != null && Object.hasOwnProperty.call(message, "rejectionReason")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.rejectionReason); + if (message.processorVersion != null && Object.hasOwnProperty.call(message, "processorVersion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.processorVersion); return writer; }; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified TrainProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse} message TrainProcessorVersionResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + TrainProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a TrainProcessorVersionResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionResponse} TrainProcessorVersionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decode = function decode(reader, length) { + TrainProcessorVersionResponse.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.gcsDestination = reader.string(); - break; - } - case 2: { - message.state = reader.int32(); - break; - } - case 3: { - message.rejectionReason = reader.string(); + message.processorVersion = reader.string(); break; } default: @@ -75060,184 +75907,124 @@ }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a TrainProcessorVersionResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionResponse} TrainProcessorVersionResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + TrainProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a TrainProcessorVersionResponse message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentResponse.verify = function verify(message) { + TrainProcessorVersionResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - if (!$util.isString(message.gcsDestination)) - return "gcsDestination: string expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) - if (!$util.isString(message.rejectionReason)) - return "rejectionReason: string expected"; + if (message.processorVersion != null && message.hasOwnProperty("processorVersion")) + if (!$util.isString(message.processorVersion)) + return "processorVersion: string expected"; return null; }; /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a TrainProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionResponse} TrainProcessorVersionResponse */ - ReviewDocumentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse) + TrainProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); - if (object.gcsDestination != null) - message.gcsDestination = String(object.gcsDestination); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "REJECTED": - case 1: - message.state = 1; - break; - case "SUCCEEDED": - case 2: - message.state = 2; - break; - } - if (object.rejectionReason != null) - message.rejectionReason = String(object.rejectionReason); + var message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse(); + if (object.processorVersion != null) + message.processorVersion = String(object.processorVersion); return message; }; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * Creates a plain object from a TrainProcessorVersionResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionResponse} message TrainProcessorVersionResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentResponse.toObject = function toObject(message, options) { + TrainProcessorVersionResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.gcsDestination = ""; - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.rejectionReason = ""; - } - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = message.gcsDestination; - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse.State[message.state] : message.state; - if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) - object.rejectionReason = message.rejectionReason; + if (options.defaults) + object.processorVersion = ""; + if (message.processorVersion != null && message.hasOwnProperty("processorVersion")) + object.processorVersion = message.processorVersion; return object; }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this TrainProcessorVersionResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @instance * @returns {Object.} JSON object */ - ReviewDocumentResponse.prototype.toJSON = function toJSON() { + TrainProcessorVersionResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for ReviewDocumentResponse + * Gets the default type url for TrainProcessorVersionResponse * @function getTypeUrl - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionResponse * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - ReviewDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + TrainProcessorVersionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ReviewDocumentResponse"; + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.TrainProcessorVersionResponse"; }; - /** - * State enum. - * @name google.cloud.documentai.v1beta3.ReviewDocumentResponse.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} REJECTED=1 REJECTED value - * @property {number} SUCCEEDED=2 SUCCEEDED value - */ - ReviewDocumentResponse.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "REJECTED"] = 1; - values[valuesById[2] = "SUCCEEDED"] = 2; - return values; - })(); - - return ReviewDocumentResponse; + return TrainProcessorVersionResponse; })(); - v1beta3.ReviewDocumentOperationMetadata = (function() { + v1beta3.TrainProcessorVersionMetadata = (function() { /** - * Properties of a ReviewDocumentOperationMetadata. + * Properties of a TrainProcessorVersionMetadata. * @memberof google.cloud.documentai.v1beta3 - * @interface IReviewDocumentOperationMetadata - * @property {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null} [state] ReviewDocumentOperationMetadata state - * @property {string|null} [stateMessage] ReviewDocumentOperationMetadata stateMessage - * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime - * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata - * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId + * @interface ITrainProcessorVersionMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] TrainProcessorVersionMetadata commonMetadata + * @property {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation|null} [trainingDatasetValidation] TrainProcessorVersionMetadata trainingDatasetValidation + * @property {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation|null} [testDatasetValidation] TrainProcessorVersionMetadata testDatasetValidation */ /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new TrainProcessorVersionMetadata. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a ReviewDocumentOperationMetadata. - * @implements IReviewDocumentOperationMetadata + * @classdesc Represents a TrainProcessorVersionMetadata. + * @implements ITrainProcessorVersionMetadata * @constructor - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata=} [properties] Properties to set */ - function ReviewDocumentOperationMetadata(properties) { + function TrainProcessorVersionMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -75245,145 +76032,103 @@ } /** - * ReviewDocumentOperationMetadata state. - * @member {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State} state - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.state = 0; - - /** - * ReviewDocumentOperationMetadata stateMessage. - * @member {string} stateMessage - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.stateMessage = ""; - - /** - * ReviewDocumentOperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - */ - ReviewDocumentOperationMetadata.prototype.createTime = null; - - /** - * ReviewDocumentOperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * TrainProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @instance */ - ReviewDocumentOperationMetadata.prototype.updateTime = null; + TrainProcessorVersionMetadata.prototype.commonMetadata = null; /** - * ReviewDocumentOperationMetadata commonMetadata. - * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * TrainProcessorVersionMetadata trainingDatasetValidation. + * @member {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation|null|undefined} trainingDatasetValidation + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @instance */ - ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + TrainProcessorVersionMetadata.prototype.trainingDatasetValidation = null; /** - * ReviewDocumentOperationMetadata questionId. - * @member {string} questionId - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * TrainProcessorVersionMetadata testDatasetValidation. + * @member {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation|null|undefined} testDatasetValidation + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @instance */ - ReviewDocumentOperationMetadata.prototype.questionId = ""; + TrainProcessorVersionMetadata.prototype.testDatasetValidation = null; /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * Creates a new TrainProcessorVersionMetadata instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata} TrainProcessorVersionMetadata instance */ - ReviewDocumentOperationMetadata.create = function create(properties) { - return new ReviewDocumentOperationMetadata(properties); + TrainProcessorVersionMetadata.create = function create(properties) { + return new TrainProcessorVersionMetadata(properties); }; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified TrainProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata} message TrainProcessorVersionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + TrainProcessorVersionMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) - $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.questionId != null && Object.hasOwnProperty.call(message, "questionId")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.questionId); + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.trainingDatasetValidation != null && Object.hasOwnProperty.call(message, "trainingDatasetValidation")) + $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.encode(message.trainingDatasetValidation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.testDatasetValidation != null && Object.hasOwnProperty.call(message, "testDatasetValidation")) + $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.encode(message.testDatasetValidation, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified TrainProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata} message TrainProcessorVersionMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + TrainProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a TrainProcessorVersionMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata} TrainProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + TrainProcessorVersionMetadata.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.state = reader.int32(); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); break; } case 2: { - message.stateMessage = reader.string(); + message.trainingDatasetValidation = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.decode(reader, reader.uint32()); break; } case 3: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 4: { - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); - break; - } - case 6: { - message.questionId = reader.string(); + message.testDatasetValidation = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.decode(reader, reader.uint32()); break; } default: @@ -75395,243 +76140,4350 @@ }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a TrainProcessorVersionMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata} TrainProcessorVersionMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + TrainProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a TrainProcessorVersionMetadata message. * @function verify - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ReviewDocumentOperationMetadata.verify = function verify(message) { + TrainProcessorVersionMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - if (!$util.isString(message.stateMessage)) - return "stateMessage: string expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); if (error) - return "createTime." + error; + return "commonMetadata." + error; } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (message.trainingDatasetValidation != null && message.hasOwnProperty("trainingDatasetValidation")) { + var error = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.verify(message.trainingDatasetValidation); if (error) - return "updateTime." + error; + return "trainingDatasetValidation." + error; } - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { - var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (message.testDatasetValidation != null && message.hasOwnProperty("testDatasetValidation")) { + var error = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.verify(message.testDatasetValidation); if (error) - return "commonMetadata." + error; + return "testDatasetValidation." + error; } - if (message.questionId != null && message.hasOwnProperty("questionId")) - if (!$util.isString(message.questionId)) - return "questionId: string expected"; return null; }; /** - * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a TrainProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata} TrainProcessorVersionMetadata */ - ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata) + TrainProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata) return object; - var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNING": - case 1: - message.state = 1; - break; - case "CANCELLING": - case 2: - message.state = 2; - break; - case "SUCCEEDED": - case 3: - message.state = 3; - break; - case "FAILED": - case 4: - message.state = 4; - break; - case "CANCELLED": - case 5: - message.state = 5; - break; - } - if (object.stateMessage != null) - message.stateMessage = String(object.stateMessage); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } + var message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata(); if (object.commonMetadata != null) { if (typeof object.commonMetadata !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.commonMetadata: object expected"); + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.commonMetadata: object expected"); message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); } - if (object.questionId != null) - message.questionId = String(object.questionId); + if (object.trainingDatasetValidation != null) { + if (typeof object.trainingDatasetValidation !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.trainingDatasetValidation: object expected"); + message.trainingDatasetValidation = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.fromObject(object.trainingDatasetValidation); + } + if (object.testDatasetValidation != null) { + if (typeof object.testDatasetValidation !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.testDatasetValidation: object expected"); + message.testDatasetValidation = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.fromObject(object.testDatasetValidation); + } return message; }; /** - * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from a TrainProcessorVersionMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata * @static - * @param {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata} message TrainProcessorVersionMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + TrainProcessorVersionMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.stateMessage = ""; - object.createTime = null; - object.updateTime = null; object.commonMetadata = null; - object.questionId = ""; + object.trainingDatasetValidation = null; + object.testDatasetValidation = null; } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; - if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) - object.stateMessage = message.stateMessage; - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); - if (message.questionId != null && message.hasOwnProperty("questionId")) - object.questionId = message.questionId; + if (message.trainingDatasetValidation != null && message.hasOwnProperty("trainingDatasetValidation")) + object.trainingDatasetValidation = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.toObject(message.trainingDatasetValidation, options); + if (message.testDatasetValidation != null && message.hasOwnProperty("testDatasetValidation")) + object.testDatasetValidation = $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.toObject(message.testDatasetValidation, options); return object; }; - /** - * Converts this ReviewDocumentOperationMetadata to JSON. - * @function toJSON - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @instance - * @returns {Object.} JSON object - */ - ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this TrainProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + TrainProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TrainProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TrainProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata"; + }; + + TrainProcessorVersionMetadata.DatasetValidation = (function() { + + /** + * Properties of a DatasetValidation. + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata + * @interface IDatasetValidation + * @property {number|null} [documentErrorCount] DatasetValidation documentErrorCount + * @property {number|null} [datasetErrorCount] DatasetValidation datasetErrorCount + * @property {Array.|null} [documentErrors] DatasetValidation documentErrors + * @property {Array.|null} [datasetErrors] DatasetValidation datasetErrors + */ + + /** + * Constructs a new DatasetValidation. + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata + * @classdesc Represents a DatasetValidation. + * @implements IDatasetValidation + * @constructor + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation=} [properties] Properties to set + */ + function DatasetValidation(properties) { + this.documentErrors = []; + this.datasetErrors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DatasetValidation documentErrorCount. + * @member {number} documentErrorCount + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @instance + */ + DatasetValidation.prototype.documentErrorCount = 0; + + /** + * DatasetValidation datasetErrorCount. + * @member {number} datasetErrorCount + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @instance + */ + DatasetValidation.prototype.datasetErrorCount = 0; + + /** + * DatasetValidation documentErrors. + * @member {Array.} documentErrors + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @instance + */ + DatasetValidation.prototype.documentErrors = $util.emptyArray; + + /** + * DatasetValidation datasetErrors. + * @member {Array.} datasetErrors + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @instance + */ + DatasetValidation.prototype.datasetErrors = $util.emptyArray; + + /** + * Creates a new DatasetValidation instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @static + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation} DatasetValidation instance + */ + DatasetValidation.create = function create(properties) { + return new DatasetValidation(properties); + }; + + /** + * Encodes the specified DatasetValidation message. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @static + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation} message DatasetValidation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatasetValidation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentErrors != null && message.documentErrors.length) + for (var i = 0; i < message.documentErrors.length; ++i) + $root.google.rpc.Status.encode(message.documentErrors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.datasetErrors != null && message.datasetErrors.length) + for (var i = 0; i < message.datasetErrors.length; ++i) + $root.google.rpc.Status.encode(message.datasetErrors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.documentErrorCount != null && Object.hasOwnProperty.call(message, "documentErrorCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.documentErrorCount); + if (message.datasetErrorCount != null && Object.hasOwnProperty.call(message, "datasetErrorCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.datasetErrorCount); + return writer; + }; + + /** + * Encodes the specified DatasetValidation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @static + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.IDatasetValidation} message DatasetValidation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatasetValidation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DatasetValidation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation} DatasetValidation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatasetValidation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.documentErrorCount = reader.int32(); + break; + } + case 4: { + message.datasetErrorCount = reader.int32(); + break; + } + case 1: { + if (!(message.documentErrors && message.documentErrors.length)) + message.documentErrors = []; + message.documentErrors.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.datasetErrors && message.datasetErrors.length)) + message.datasetErrors = []; + message.datasetErrors.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DatasetValidation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation} DatasetValidation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatasetValidation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DatasetValidation message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DatasetValidation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documentErrorCount != null && message.hasOwnProperty("documentErrorCount")) + if (!$util.isInteger(message.documentErrorCount)) + return "documentErrorCount: integer expected"; + if (message.datasetErrorCount != null && message.hasOwnProperty("datasetErrorCount")) + if (!$util.isInteger(message.datasetErrorCount)) + return "datasetErrorCount: integer expected"; + if (message.documentErrors != null && message.hasOwnProperty("documentErrors")) { + if (!Array.isArray(message.documentErrors)) + return "documentErrors: array expected"; + for (var i = 0; i < message.documentErrors.length; ++i) { + var error = $root.google.rpc.Status.verify(message.documentErrors[i]); + if (error) + return "documentErrors." + error; + } + } + if (message.datasetErrors != null && message.hasOwnProperty("datasetErrors")) { + if (!Array.isArray(message.datasetErrors)) + return "datasetErrors: array expected"; + for (var i = 0; i < message.datasetErrors.length; ++i) { + var error = $root.google.rpc.Status.verify(message.datasetErrors[i]); + if (error) + return "datasetErrors." + error; + } + } + return null; + }; + + /** + * Creates a DatasetValidation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation} DatasetValidation + */ + DatasetValidation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation) + return object; + var message = new $root.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation(); + if (object.documentErrorCount != null) + message.documentErrorCount = object.documentErrorCount | 0; + if (object.datasetErrorCount != null) + message.datasetErrorCount = object.datasetErrorCount | 0; + if (object.documentErrors) { + if (!Array.isArray(object.documentErrors)) + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.documentErrors: array expected"); + message.documentErrors = []; + for (var i = 0; i < object.documentErrors.length; ++i) { + if (typeof object.documentErrors[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.documentErrors: object expected"); + message.documentErrors[i] = $root.google.rpc.Status.fromObject(object.documentErrors[i]); + } + } + if (object.datasetErrors) { + if (!Array.isArray(object.datasetErrors)) + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.datasetErrors: array expected"); + message.datasetErrors = []; + for (var i = 0; i < object.datasetErrors.length; ++i) { + if (typeof object.datasetErrors[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation.datasetErrors: object expected"); + message.datasetErrors[i] = $root.google.rpc.Status.fromObject(object.datasetErrors[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DatasetValidation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @static + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation} message DatasetValidation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DatasetValidation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.documentErrors = []; + object.datasetErrors = []; + } + if (options.defaults) { + object.documentErrorCount = 0; + object.datasetErrorCount = 0; + } + if (message.documentErrors && message.documentErrors.length) { + object.documentErrors = []; + for (var j = 0; j < message.documentErrors.length; ++j) + object.documentErrors[j] = $root.google.rpc.Status.toObject(message.documentErrors[j], options); + } + if (message.datasetErrors && message.datasetErrors.length) { + object.datasetErrors = []; + for (var j = 0; j < message.datasetErrors.length; ++j) + object.datasetErrors[j] = $root.google.rpc.Status.toObject(message.datasetErrors[j], options); + } + if (message.documentErrorCount != null && message.hasOwnProperty("documentErrorCount")) + object.documentErrorCount = message.documentErrorCount; + if (message.datasetErrorCount != null && message.hasOwnProperty("datasetErrorCount")) + object.datasetErrorCount = message.datasetErrorCount; + return object; + }; + + /** + * Converts this DatasetValidation to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @instance + * @returns {Object.} JSON object + */ + DatasetValidation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DatasetValidation + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DatasetValidation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata.DatasetValidation"; + }; + + return DatasetValidation; + })(); + + return TrainProcessorVersionMetadata; + })(); + + v1beta3.ReviewDocumentRequest = (function() { + + /** + * Properties of a ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentRequest + * @property {google.cloud.documentai.v1beta3.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument + * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig + * @property {google.cloud.documentai.v1beta3.IDocument|null} [document] ReviewDocumentRequest document + * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation + * @property {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority + * @property {google.cloud.documentai.v1beta3.IDocumentSchema|null} [documentSchema] ReviewDocumentRequest documentSchema + */ + + /** + * Constructs a new ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentRequest. + * @implements IReviewDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + */ + function ReviewDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentRequest inlineDocument. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.inlineDocument = null; + + /** + * ReviewDocumentRequest humanReviewConfig. + * @member {string} humanReviewConfig + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.humanReviewConfig = ""; + + /** + * ReviewDocumentRequest document. + * @member {google.cloud.documentai.v1beta3.IDocument|null|undefined} document + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.document = null; + + /** + * ReviewDocumentRequest enableSchemaValidation. + * @member {boolean} enableSchemaValidation + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.enableSchemaValidation = false; + + /** + * ReviewDocumentRequest priority. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority} priority + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.priority = 0; + + /** + * ReviewDocumentRequest documentSchema. + * @member {google.cloud.documentai.v1beta3.IDocumentSchema|null|undefined} documentSchema + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.documentSchema = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReviewDocumentRequest source. + * @member {"inlineDocument"|undefined} source + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + */ + Object.defineProperty(ReviewDocumentRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReviewDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest instance + */ + ReviewDocumentRequest.create = function create(properties) { + return new ReviewDocumentRequest(properties); + }; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.humanReviewConfig != null && Object.hasOwnProperty.call(message, "humanReviewConfig")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.humanReviewConfig); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.enableSchemaValidation != null && Object.hasOwnProperty.call(message, "enableSchemaValidation")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSchemaValidation); + if (message.inlineDocument != null && Object.hasOwnProperty.call(message, "inlineDocument")) + $root.google.cloud.documentai.v1beta3.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.priority != null && Object.hasOwnProperty.call(message, "priority")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.priority); + if (message.documentSchema != null && Object.hasOwnProperty.call(message, "documentSchema")) + $root.google.cloud.documentai.v1beta3.DocumentSchema.encode(message.documentSchema, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + } + case 1: { + message.humanReviewConfig = reader.string(); + break; + } + case 2: { + message.document = $root.google.cloud.documentai.v1beta3.Document.decode(reader, reader.uint32()); + break; + } + case 3: { + message.enableSchemaValidation = reader.bool(); + break; + } + case 5: { + message.priority = reader.int32(); + break; + } + case 6: { + message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + properties.source = 1; + { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.inlineDocument); + if (error) + return "inlineDocument." + error; + } + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + if (!$util.isString(message.humanReviewConfig)) + return "humanReviewConfig: string expected"; + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.documentai.v1beta3.Document.verify(message.document); + if (error) + return "document." + error; + } + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + if (typeof message.enableSchemaValidation !== "boolean") + return "enableSchemaValidation: boolean expected"; + if (message.priority != null && message.hasOwnProperty("priority")) + switch (message.priority) { + default: + return "priority: enum value expected"; + case 0: + case 1: + break; + } + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.verify(message.documentSchema); + if (error) + return "documentSchema." + error; + } + return null; + }; + + /** + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentRequest} ReviewDocumentRequest + */ + ReviewDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest(); + if (object.inlineDocument != null) { + if (typeof object.inlineDocument !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.inlineDocument: object expected"); + message.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.inlineDocument); + } + if (object.humanReviewConfig != null) + message.humanReviewConfig = String(object.humanReviewConfig); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.document: object expected"); + message.document = $root.google.cloud.documentai.v1beta3.Document.fromObject(object.document); + } + if (object.enableSchemaValidation != null) + message.enableSchemaValidation = Boolean(object.enableSchemaValidation); + switch (object.priority) { + default: + if (typeof object.priority === "number") { + message.priority = object.priority; + break; + } + break; + case "DEFAULT": + case 0: + message.priority = 0; + break; + case "URGENT": + case 1: + message.priority = 1; + break; + } + if (object.documentSchema != null) { + if (typeof object.documentSchema !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentRequest.documentSchema: object expected"); + message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.fromObject(object.documentSchema); + } + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.humanReviewConfig = ""; + object.document = null; + object.enableSchemaValidation = false; + object.priority = options.enums === String ? "DEFAULT" : 0; + object.documentSchema = null; + } + if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) + object.humanReviewConfig = message.humanReviewConfig; + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.documentai.v1beta3.Document.toObject(message.document, options); + if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + object.enableSchemaValidation = message.enableSchemaValidation; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + object.inlineDocument = $root.google.cloud.documentai.v1beta3.Document.toObject(message.inlineDocument, options); + if (options.oneofs) + object.source = "inlineDocument"; + } + if (message.priority != null && message.hasOwnProperty("priority")) + object.priority = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] === undefined ? message.priority : $root.google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority[message.priority] : message.priority; + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) + object.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.toObject(message.documentSchema, options); + return object; + }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReviewDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReviewDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ReviewDocumentRequest"; + }; + + /** + * Priority enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority + * @enum {number} + * @property {number} DEFAULT=0 DEFAULT value + * @property {number} URGENT=1 URGENT value + */ + ReviewDocumentRequest.Priority = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT"] = 0; + values[valuesById[1] = "URGENT"] = 1; + return values; + })(); + + return ReviewDocumentRequest; + })(); + + v1beta3.ReviewDocumentResponse = (function() { + + /** + * Properties of a ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentResponse + * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + * @property {google.cloud.documentai.v1beta3.ReviewDocumentResponse.State|null} [state] ReviewDocumentResponse state + * @property {string|null} [rejectionReason] ReviewDocumentResponse rejectionReason + */ + + /** + * Constructs a new ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentResponse. + * @implements IReviewDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + */ + function ReviewDocumentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentResponse gcsDestination. + * @member {string} gcsDestination + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.gcsDestination = ""; + + /** + * ReviewDocumentResponse state. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentResponse.State} state + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.state = 0; + + /** + * ReviewDocumentResponse rejectionReason. + * @member {string} rejectionReason + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.rejectionReason = ""; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse instance + */ + ReviewDocumentResponse.create = function create(properties) { + return new ReviewDocumentResponse(properties); + }; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsDestination); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.rejectionReason != null && Object.hasOwnProperty.call(message, "rejectionReason")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.rejectionReason); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsDestination = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.rejectionReason = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + if (!$util.isString(message.gcsDestination)) + return "gcsDestination: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) + if (!$util.isString(message.rejectionReason)) + return "rejectionReason: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentResponse} ReviewDocumentResponse + */ + ReviewDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse(); + if (object.gcsDestination != null) + message.gcsDestination = String(object.gcsDestination); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "REJECTED": + case 1: + message.state = 1; + break; + case "SUCCEEDED": + case 2: + message.state = 2; + break; + } + if (object.rejectionReason != null) + message.rejectionReason = String(object.rejectionReason); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.gcsDestination = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.rejectionReason = ""; + } + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = message.gcsDestination; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.ReviewDocumentResponse.State[message.state] : message.state; + if (message.rejectionReason != null && message.hasOwnProperty("rejectionReason")) + object.rejectionReason = message.rejectionReason; + return object; + }; + + /** + * Converts this ReviewDocumentResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReviewDocumentResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReviewDocumentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ReviewDocumentResponse"; + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentResponse.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} REJECTED=1 REJECTED value + * @property {number} SUCCEEDED=2 SUCCEEDED value + */ + ReviewDocumentResponse.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "REJECTED"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + return values; + })(); + + return ReviewDocumentResponse; + })(); + + v1beta3.ReviewDocumentOperationMetadata = (function() { + + /** + * Properties of a ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IReviewDocumentOperationMetadata + * @property {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State|null} [state] ReviewDocumentOperationMetadata state + * @property {string|null} [stateMessage] ReviewDocumentOperationMetadata stateMessage + * @property {google.protobuf.ITimestamp|null} [createTime] ReviewDocumentOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ReviewDocumentOperationMetadata updateTime + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId + */ + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ReviewDocumentOperationMetadata. + * @implements IReviewDocumentOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + */ + function ReviewDocumentOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReviewDocumentOperationMetadata state. + * @member {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State} state + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.state = 0; + + /** + * ReviewDocumentOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.stateMessage = ""; + + /** + * ReviewDocumentOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.createTime = null; + + /** + * ReviewDocumentOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.updateTime = null; + + /** + * ReviewDocumentOperationMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + + /** + * ReviewDocumentOperationMetadata questionId. + * @member {string} questionId + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.questionId = ""; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + */ + ReviewDocumentOperationMetadata.create = function create(properties) { + return new ReviewDocumentOperationMetadata(properties); + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.stateMessage != null && Object.hasOwnProperty.call(message, "stateMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.stateMessage); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.questionId != null && Object.hasOwnProperty.call(message, "questionId")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.questionId); + return writer; + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 2: { + message.stateMessage = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } + case 6: { + message.questionId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReviewDocumentOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReviewDocumentOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReviewDocumentOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + if (!$util.isString(message.stateMessage)) + return "stateMessage: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + if (message.questionId != null && message.hasOwnProperty("questionId")) + if (!$util.isString(message.questionId)) + return "questionId: string expected"; + return null; + }; + + /** + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + */ + ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata(); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNING": + case 1: + message.state = 1; + break; + case "CANCELLING": + case 2: + message.state = 2; + break; + case "SUCCEEDED": + case 3: + message.state = 3; + break; + case "FAILED": + case 4: + message.state = 4; + break; + case "CANCELLED": + case 5: + message.state = 5; + break; + } + if (object.stateMessage != null) + message.stateMessage = String(object.stateMessage); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + if (object.questionId != null) + message.questionId = String(object.questionId); + return message; + }; + + /** + * Creates a plain object from a ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.stateMessage = ""; + object.createTime = null; + object.updateTime = null; + object.commonMetadata = null; + object.questionId = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State[message.state] : message.state; + if (message.stateMessage != null && message.hasOwnProperty("stateMessage")) + object.stateMessage = message.stateMessage; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + if (message.questionId != null && message.hasOwnProperty("questionId")) + object.questionId = message.questionId; + return object; + }; + + /** + * Converts this ReviewDocumentOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReviewDocumentOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReviewDocumentOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata"; + }; + + /** + * State enum. + * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} RUNNING=1 RUNNING value + * @property {number} CANCELLING=2 CANCELLING value + * @property {number} SUCCEEDED=3 SUCCEEDED value + * @property {number} FAILED=4 FAILED value + * @property {number} CANCELLED=5 CANCELLED value + */ + ReviewDocumentOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNING"] = 1; + values[valuesById[2] = "CANCELLING"] = 2; + values[valuesById[3] = "SUCCEEDED"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "CANCELLED"] = 5; + return values; + })(); + + return ReviewDocumentOperationMetadata; + })(); + + v1beta3.EvaluateProcessorVersionRequest = (function() { + + /** + * Properties of an EvaluateProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IEvaluateProcessorVersionRequest + * @property {string|null} [processorVersion] EvaluateProcessorVersionRequest processorVersion + * @property {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null} [evaluationDocuments] EvaluateProcessorVersionRequest evaluationDocuments + */ + + /** + * Constructs a new EvaluateProcessorVersionRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an EvaluateProcessorVersionRequest. + * @implements IEvaluateProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest=} [properties] Properties to set + */ + function EvaluateProcessorVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EvaluateProcessorVersionRequest processorVersion. + * @member {string} processorVersion + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @instance + */ + EvaluateProcessorVersionRequest.prototype.processorVersion = ""; + + /** + * EvaluateProcessorVersionRequest evaluationDocuments. + * @member {google.cloud.documentai.v1beta3.IBatchDocumentsInputConfig|null|undefined} evaluationDocuments + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @instance + */ + EvaluateProcessorVersionRequest.prototype.evaluationDocuments = null; + + /** + * Creates a new EvaluateProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest} EvaluateProcessorVersionRequest instance + */ + EvaluateProcessorVersionRequest.create = function create(properties) { + return new EvaluateProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified EvaluateProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest} message EvaluateProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvaluateProcessorVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processorVersion != null && Object.hasOwnProperty.call(message, "processorVersion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.processorVersion); + if (message.evaluationDocuments != null && Object.hasOwnProperty.call(message, "evaluationDocuments")) + $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.encode(message.evaluationDocuments, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EvaluateProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest} message EvaluateProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvaluateProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EvaluateProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest} EvaluateProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvaluateProcessorVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.processorVersion = reader.string(); + break; + } + case 3: { + message.evaluationDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EvaluateProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest} EvaluateProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvaluateProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EvaluateProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EvaluateProcessorVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processorVersion != null && message.hasOwnProperty("processorVersion")) + if (!$util.isString(message.processorVersion)) + return "processorVersion: string expected"; + if (message.evaluationDocuments != null && message.hasOwnProperty("evaluationDocuments")) { + var error = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.verify(message.evaluationDocuments); + if (error) + return "evaluationDocuments." + error; + } + return null; + }; + + /** + * Creates an EvaluateProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest} EvaluateProcessorVersionRequest + */ + EvaluateProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest(); + if (object.processorVersion != null) + message.processorVersion = String(object.processorVersion); + if (object.evaluationDocuments != null) { + if (typeof object.evaluationDocuments !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest.evaluationDocuments: object expected"); + message.evaluationDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.fromObject(object.evaluationDocuments); + } + return message; + }; + + /** + * Creates a plain object from an EvaluateProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest} message EvaluateProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EvaluateProcessorVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.processorVersion = ""; + object.evaluationDocuments = null; + } + if (message.processorVersion != null && message.hasOwnProperty("processorVersion")) + object.processorVersion = message.processorVersion; + if (message.evaluationDocuments != null && message.hasOwnProperty("evaluationDocuments")) + object.evaluationDocuments = $root.google.cloud.documentai.v1beta3.BatchDocumentsInputConfig.toObject(message.evaluationDocuments, options); + return object; + }; + + /** + * Converts this EvaluateProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + EvaluateProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EvaluateProcessorVersionRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EvaluateProcessorVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest"; + }; + + return EvaluateProcessorVersionRequest; + })(); + + v1beta3.EvaluateProcessorVersionMetadata = (function() { + + /** + * Properties of an EvaluateProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @interface IEvaluateProcessorVersionMetadata + * @property {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null} [commonMetadata] EvaluateProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new EvaluateProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an EvaluateProcessorVersionMetadata. + * @implements IEvaluateProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata=} [properties] Properties to set + */ + function EvaluateProcessorVersionMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EvaluateProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1beta3.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @instance + */ + EvaluateProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new EvaluateProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata} EvaluateProcessorVersionMetadata instance + */ + EvaluateProcessorVersionMetadata.create = function create(properties) { + return new EvaluateProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified EvaluateProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata} message EvaluateProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvaluateProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EvaluateProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata} message EvaluateProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvaluateProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EvaluateProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata} EvaluateProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvaluateProcessorVersionMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EvaluateProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata} EvaluateProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvaluateProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EvaluateProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EvaluateProcessorVersionMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates an EvaluateProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata} EvaluateProcessorVersionMetadata + */ + EvaluateProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from an EvaluateProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata} message EvaluateProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EvaluateProcessorVersionMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonMetadata = null; + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1beta3.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this EvaluateProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + EvaluateProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EvaluateProcessorVersionMetadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EvaluateProcessorVersionMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata"; + }; + + return EvaluateProcessorVersionMetadata; + })(); + + v1beta3.EvaluateProcessorVersionResponse = (function() { + + /** + * Properties of an EvaluateProcessorVersionResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IEvaluateProcessorVersionResponse + * @property {string|null} [evaluation] EvaluateProcessorVersionResponse evaluation + */ + + /** + * Constructs a new EvaluateProcessorVersionResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents an EvaluateProcessorVersionResponse. + * @implements IEvaluateProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse=} [properties] Properties to set + */ + function EvaluateProcessorVersionResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EvaluateProcessorVersionResponse evaluation. + * @member {string} evaluation + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @instance + */ + EvaluateProcessorVersionResponse.prototype.evaluation = ""; + + /** + * Creates a new EvaluateProcessorVersionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse} EvaluateProcessorVersionResponse instance + */ + EvaluateProcessorVersionResponse.create = function create(properties) { + return new EvaluateProcessorVersionResponse(properties); + }; + + /** + * Encodes the specified EvaluateProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse} message EvaluateProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvaluateProcessorVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.evaluation != null && Object.hasOwnProperty.call(message, "evaluation")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.evaluation); + return writer; + }; + + /** + * Encodes the specified EvaluateProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse} message EvaluateProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvaluateProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EvaluateProcessorVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse} EvaluateProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvaluateProcessorVersionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.evaluation = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EvaluateProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse} EvaluateProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvaluateProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EvaluateProcessorVersionResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EvaluateProcessorVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.evaluation != null && message.hasOwnProperty("evaluation")) + if (!$util.isString(message.evaluation)) + return "evaluation: string expected"; + return null; + }; + + /** + * Creates an EvaluateProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse} EvaluateProcessorVersionResponse + */ + EvaluateProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse(); + if (object.evaluation != null) + message.evaluation = String(object.evaluation); + return message; + }; + + /** + * Creates a plain object from an EvaluateProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse} message EvaluateProcessorVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EvaluateProcessorVersionResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.evaluation = ""; + if (message.evaluation != null && message.hasOwnProperty("evaluation")) + object.evaluation = message.evaluation; + return object; + }; + + /** + * Converts this EvaluateProcessorVersionResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @instance + * @returns {Object.} JSON object + */ + EvaluateProcessorVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EvaluateProcessorVersionResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EvaluateProcessorVersionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse"; + }; + + return EvaluateProcessorVersionResponse; + })(); + + v1beta3.GetEvaluationRequest = (function() { + + /** + * Properties of a GetEvaluationRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IGetEvaluationRequest + * @property {string|null} [name] GetEvaluationRequest name + */ + + /** + * Constructs a new GetEvaluationRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a GetEvaluationRequest. + * @implements IGetEvaluationRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IGetEvaluationRequest=} [properties] Properties to set + */ + function GetEvaluationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEvaluationRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @instance + */ + GetEvaluationRequest.prototype.name = ""; + + /** + * Creates a new GetEvaluationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @static + * @param {google.cloud.documentai.v1beta3.IGetEvaluationRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.GetEvaluationRequest} GetEvaluationRequest instance + */ + GetEvaluationRequest.create = function create(properties) { + return new GetEvaluationRequest(properties); + }; + + /** + * Encodes the specified GetEvaluationRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.GetEvaluationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @static + * @param {google.cloud.documentai.v1beta3.IGetEvaluationRequest} message GetEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEvaluationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.GetEvaluationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @static + * @param {google.cloud.documentai.v1beta3.IGetEvaluationRequest} message GetEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEvaluationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEvaluationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.GetEvaluationRequest} GetEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEvaluationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.GetEvaluationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetEvaluationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.GetEvaluationRequest} GetEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEvaluationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEvaluationRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEvaluationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.GetEvaluationRequest} GetEvaluationRequest + */ + GetEvaluationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.GetEvaluationRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.GetEvaluationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetEvaluationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @static + * @param {google.cloud.documentai.v1beta3.GetEvaluationRequest} message GetEvaluationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEvaluationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetEvaluationRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @instance + * @returns {Object.} JSON object + */ + GetEvaluationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetEvaluationRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.GetEvaluationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetEvaluationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.GetEvaluationRequest"; + }; + + return GetEvaluationRequest; + })(); + + v1beta3.ListEvaluationsRequest = (function() { + + /** + * Properties of a ListEvaluationsRequest. + * @memberof google.cloud.documentai.v1beta3 + * @interface IListEvaluationsRequest + * @property {string|null} [parent] ListEvaluationsRequest parent + * @property {number|null} [pageSize] ListEvaluationsRequest pageSize + * @property {string|null} [pageToken] ListEvaluationsRequest pageToken + */ + + /** + * Constructs a new ListEvaluationsRequest. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ListEvaluationsRequest. + * @implements IListEvaluationsRequest + * @constructor + * @param {google.cloud.documentai.v1beta3.IListEvaluationsRequest=} [properties] Properties to set + */ + function ListEvaluationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEvaluationsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @instance + */ + ListEvaluationsRequest.prototype.parent = ""; + + /** + * ListEvaluationsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @instance + */ + ListEvaluationsRequest.prototype.pageSize = 0; + + /** + * ListEvaluationsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @instance + */ + ListEvaluationsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListEvaluationsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @static + * @param {google.cloud.documentai.v1beta3.IListEvaluationsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListEvaluationsRequest} ListEvaluationsRequest instance + */ + ListEvaluationsRequest.create = function create(properties) { + return new ListEvaluationsRequest(properties); + }; + + /** + * Encodes the specified ListEvaluationsRequest message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListEvaluationsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @static + * @param {google.cloud.documentai.v1beta3.IListEvaluationsRequest} message ListEvaluationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEvaluationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListEvaluationsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListEvaluationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @static + * @param {google.cloud.documentai.v1beta3.IListEvaluationsRequest} message ListEvaluationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEvaluationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEvaluationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ListEvaluationsRequest} ListEvaluationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEvaluationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListEvaluationsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEvaluationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ListEvaluationsRequest} ListEvaluationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEvaluationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEvaluationsRequest message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEvaluationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListEvaluationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ListEvaluationsRequest} ListEvaluationsRequest + */ + ListEvaluationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListEvaluationsRequest) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ListEvaluationsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListEvaluationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @static + * @param {google.cloud.documentai.v1beta3.ListEvaluationsRequest} message ListEvaluationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEvaluationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListEvaluationsRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListEvaluationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEvaluationsRequest + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEvaluationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ListEvaluationsRequest"; + }; + + return ListEvaluationsRequest; + })(); + + v1beta3.ListEvaluationsResponse = (function() { + + /** + * Properties of a ListEvaluationsResponse. + * @memberof google.cloud.documentai.v1beta3 + * @interface IListEvaluationsResponse + * @property {Array.|null} [evaluations] ListEvaluationsResponse evaluations + * @property {string|null} [nextPageToken] ListEvaluationsResponse nextPageToken + */ + + /** + * Constructs a new ListEvaluationsResponse. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a ListEvaluationsResponse. + * @implements IListEvaluationsResponse + * @constructor + * @param {google.cloud.documentai.v1beta3.IListEvaluationsResponse=} [properties] Properties to set + */ + function ListEvaluationsResponse(properties) { + this.evaluations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEvaluationsResponse evaluations. + * @member {Array.} evaluations + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @instance + */ + ListEvaluationsResponse.prototype.evaluations = $util.emptyArray; + + /** + * ListEvaluationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @instance + */ + ListEvaluationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListEvaluationsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @static + * @param {google.cloud.documentai.v1beta3.IListEvaluationsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.ListEvaluationsResponse} ListEvaluationsResponse instance + */ + ListEvaluationsResponse.create = function create(properties) { + return new ListEvaluationsResponse(properties); + }; + + /** + * Encodes the specified ListEvaluationsResponse message. Does not implicitly {@link google.cloud.documentai.v1beta3.ListEvaluationsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @static + * @param {google.cloud.documentai.v1beta3.IListEvaluationsResponse} message ListEvaluationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEvaluationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.evaluations != null && message.evaluations.length) + for (var i = 0; i < message.evaluations.length; ++i) + $root.google.cloud.documentai.v1beta3.Evaluation.encode(message.evaluations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListEvaluationsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.ListEvaluationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @static + * @param {google.cloud.documentai.v1beta3.IListEvaluationsResponse} message ListEvaluationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEvaluationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEvaluationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.ListEvaluationsResponse} ListEvaluationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEvaluationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.ListEvaluationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.evaluations && message.evaluations.length)) + message.evaluations = []; + message.evaluations.push($root.google.cloud.documentai.v1beta3.Evaluation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEvaluationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.ListEvaluationsResponse} ListEvaluationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEvaluationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEvaluationsResponse message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEvaluationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.evaluations != null && message.hasOwnProperty("evaluations")) { + if (!Array.isArray(message.evaluations)) + return "evaluations: array expected"; + for (var i = 0; i < message.evaluations.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Evaluation.verify(message.evaluations[i]); + if (error) + return "evaluations." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListEvaluationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.ListEvaluationsResponse} ListEvaluationsResponse + */ + ListEvaluationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.ListEvaluationsResponse) + return object; + var message = new $root.google.cloud.documentai.v1beta3.ListEvaluationsResponse(); + if (object.evaluations) { + if (!Array.isArray(object.evaluations)) + throw TypeError(".google.cloud.documentai.v1beta3.ListEvaluationsResponse.evaluations: array expected"); + message.evaluations = []; + for (var i = 0; i < object.evaluations.length; ++i) { + if (typeof object.evaluations[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ListEvaluationsResponse.evaluations: object expected"); + message.evaluations[i] = $root.google.cloud.documentai.v1beta3.Evaluation.fromObject(object.evaluations[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListEvaluationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @static + * @param {google.cloud.documentai.v1beta3.ListEvaluationsResponse} message ListEvaluationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEvaluationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.evaluations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.evaluations && message.evaluations.length) { + object.evaluations = []; + for (var j = 0; j < message.evaluations.length; ++j) + object.evaluations[j] = $root.google.cloud.documentai.v1beta3.Evaluation.toObject(message.evaluations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListEvaluationsResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListEvaluationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEvaluationsResponse + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.ListEvaluationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEvaluationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ListEvaluationsResponse"; + }; + + return ListEvaluationsResponse; + })(); + + v1beta3.DocumentSchema = (function() { + + /** + * Properties of a DocumentSchema. + * @memberof google.cloud.documentai.v1beta3 + * @interface IDocumentSchema + * @property {string|null} [displayName] DocumentSchema displayName + * @property {string|null} [description] DocumentSchema description + * @property {Array.|null} [entityTypes] DocumentSchema entityTypes + * @property {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null} [metadata] DocumentSchema metadata + */ + + /** + * Constructs a new DocumentSchema. + * @memberof google.cloud.documentai.v1beta3 + * @classdesc Represents a DocumentSchema. + * @implements IDocumentSchema + * @constructor + * @param {google.cloud.documentai.v1beta3.IDocumentSchema=} [properties] Properties to set + */ + function DocumentSchema(properties) { + this.entityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentSchema displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + */ + DocumentSchema.prototype.displayName = ""; + + /** + * DocumentSchema description. + * @member {string} description + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + */ + DocumentSchema.prototype.description = ""; + + /** + * DocumentSchema entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + */ + DocumentSchema.prototype.entityTypes = $util.emptyArray; + + /** + * DocumentSchema metadata. + * @member {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null|undefined} metadata + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + */ + DocumentSchema.prototype.metadata = null; + + /** + * Creates a new DocumentSchema instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {google.cloud.documentai.v1beta3.IDocumentSchema=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema instance + */ + DocumentSchema.create = function create(properties) { + return new DocumentSchema(properties); + }; + + /** + * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {google.cloud.documentai.v1beta3.IDocumentSchema} message DocumentSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentSchema.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.encode(message.entityTypes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.encode(message.metadata, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentSchema message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {google.cloud.documentai.v1beta3.IDocumentSchema} message DocumentSchema message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentSchema.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentSchema.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.displayName = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.decode(reader, reader.uint32())); + break; + } + case 4: { + message.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentSchema message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentSchema.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentSchema message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentSchema.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a DocumentSchema message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema + */ + DocumentSchema.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema(); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.fromObject(object.entityTypes[i]); + } + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.metadata: object expected"); + message.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a DocumentSchema message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema} message DocumentSchema + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentSchema.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (options.defaults) { + object.displayName = ""; + object.description = ""; + object.metadata = null; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.toObject(message.entityTypes[j], options); + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this DocumentSchema to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @instance + * @returns {Object.} JSON object + */ + DocumentSchema.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentSchema + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentSchema.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema"; + }; + + DocumentSchema.EntityType = (function() { + + /** + * Properties of an EntityType. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @interface IEntityType + * @property {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null} [enumValues] EntityType enumValues + * @property {string|null} [displayName] EntityType displayName + * @property {string|null} [name] EntityType name + * @property {Array.|null} [baseTypes] EntityType baseTypes + * @property {Array.|null} [properties] EntityType properties + */ + + /** + * Constructs a new EntityType. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @classdesc Represents an EntityType. + * @implements IEntityType + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType=} [properties] Properties to set + */ + function EntityType(properties) { + this.baseTypes = []; + this.properties = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityType enumValues. + * @member {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null|undefined} enumValues + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.enumValues = null; + + /** + * EntityType displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.displayName = ""; + + /** + * EntityType name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.name = ""; + + /** + * EntityType baseTypes. + * @member {Array.} baseTypes + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.baseTypes = $util.emptyArray; + + /** + * EntityType properties. + * @member {Array.} properties + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.properties = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * EntityType valueSource. + * @member {"enumValues"|undefined} valueSource + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + */ + Object.defineProperty(EntityType.prototype, "valueSource", { + get: $util.oneOfGetter($oneOfFields = ["enumValues"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new EntityType instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType instance + */ + EntityType.create = function create(properties) { + return new EntityType(properties); + }; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.baseTypes != null && message.baseTypes.length) + for (var i = 0; i < message.baseTypes.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.baseTypes[i]); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.encode(message.properties[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.displayName); + if (message.enumValues != null && Object.hasOwnProperty.call(message, "enumValues")) + $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.encode(message.enumValues, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 14: { + message.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.decode(reader, reader.uint32()); + break; + } + case 13: { + message.displayName = reader.string(); + break; + } + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.baseTypes && message.baseTypes.length)) + message.baseTypes = []; + message.baseTypes.push(reader.string()); + break; + } + case 6: { + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityType message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityType.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enumValues != null && message.hasOwnProperty("enumValues")) { + properties.valueSource = 1; + { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify(message.enumValues); + if (error) + return "enumValues." + error; + } + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.baseTypes != null && message.hasOwnProperty("baseTypes")) { + if (!Array.isArray(message.baseTypes)) + return "baseTypes: array expected"; + for (var i = 0; i < message.baseTypes.length; ++i) + if (!$util.isString(message.baseTypes[i])) + return "baseTypes: string[] expected"; + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify(message.properties[i]); + if (error) + return "properties." + error; + } + } + return null; + }; + + /** + * Creates an EntityType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType + */ + EntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType(); + if (object.enumValues != null) { + if (typeof object.enumValues !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.enumValues: object expected"); + message.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.fromObject(object.enumValues); + } + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.name != null) + message.name = String(object.name); + if (object.baseTypes) { + if (!Array.isArray(object.baseTypes)) + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.baseTypes: array expected"); + message.baseTypes = []; + for (var i = 0; i < object.baseTypes.length; ++i) + message.baseTypes[i] = String(object.baseTypes[i]); + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.properties: object expected"); + message.properties[i] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.fromObject(object.properties[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} message EntityType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.baseTypes = []; + object.properties = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.baseTypes && message.baseTypes.length) { + object.baseTypes = []; + for (var j = 0; j < message.baseTypes.length; ++j) + object.baseTypes[j] = message.baseTypes[j]; + } + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.toObject(message.properties[j], options); + } + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.enumValues != null && message.hasOwnProperty("enumValues")) { + object.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.toObject(message.enumValues, options); + if (options.oneofs) + object.valueSource = "enumValues"; + } + return object; + }; + + /** + * Converts this EntityType to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @instance + * @returns {Object.} JSON object + */ + EntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EntityType + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.EntityType"; + }; + + EntityType.EnumValues = (function() { + + /** + * Properties of an EnumValues. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @interface IEnumValues + * @property {Array.|null} [values] EnumValues values + */ + + /** + * Constructs a new EnumValues. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @classdesc Represents an EnumValues. + * @implements IEnumValues + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues=} [properties] Properties to set + */ + function EnumValues(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValues values. + * @member {Array.} values + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @instance + */ + EnumValues.prototype.values = $util.emptyArray; + + /** + * Creates a new EnumValues instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues instance + */ + EnumValues.create = function create(properties) { + return new EnumValues(properties); + }; + + /** + * Encodes the specified EnumValues message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues} message EnumValues message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValues.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.values[i]); + return writer; + }; + + /** + * Encodes the specified EnumValues message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues} message EnumValues message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValues.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValues message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValues.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValues message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValues.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValues message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValues.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) + if (!$util.isString(message.values[i])) + return "values: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumValues message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues + */ + EnumValues.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) + message.values[i] = String(object.values[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumValues message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} message EnumValues + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValues.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = message.values[j]; + } + return object; + }; + + /** + * Converts this EnumValues to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @instance + * @returns {Object.} JSON object + */ + EnumValues.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValues + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValues.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues"; + }; + + return EnumValues; + })(); + + EntityType.Property = (function() { + + /** + * Properties of a Property. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @interface IProperty + * @property {string|null} [name] Property name + * @property {string|null} [valueType] Property valueType + * @property {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|null} [occurrenceType] Property occurrenceType + */ + + /** + * Constructs a new Property. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @classdesc Represents a Property. + * @implements IProperty + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty=} [properties] Properties to set + */ + function Property(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Property name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.name = ""; + + /** + * Property valueType. + * @member {string} valueType + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.valueType = ""; + + /** + * Property occurrenceType. + * @member {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType} occurrenceType + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.occurrenceType = 0; + + /** + * Creates a new Property instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property instance + */ + Property.create = function create(properties) { + return new Property(properties); + }; + + /** + * Encodes the specified Property message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty} message Property message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Property.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueType); + if (message.occurrenceType != null && Object.hasOwnProperty.call(message, "occurrenceType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.occurrenceType); + return writer; + }; + + /** + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty} message Property message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Property.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Property message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Property.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.valueType = reader.string(); + break; + } + case 3: { + message.occurrenceType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Property message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Property.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Property message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Property.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.valueType != null && message.hasOwnProperty("valueType")) + if (!$util.isString(message.valueType)) + return "valueType: string expected"; + if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) + switch (message.occurrenceType) { + default: + return "occurrenceType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a Property message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property + */ + Property.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property(); + if (object.name != null) + message.name = String(object.name); + if (object.valueType != null) + message.valueType = String(object.valueType); + switch (object.occurrenceType) { + default: + if (typeof object.occurrenceType === "number") { + message.occurrenceType = object.occurrenceType; + break; + } + break; + case "OCCURRENCE_TYPE_UNSPECIFIED": + case 0: + message.occurrenceType = 0; + break; + case "OPTIONAL_ONCE": + case 1: + message.occurrenceType = 1; + break; + case "OPTIONAL_MULTIPLE": + case 2: + message.occurrenceType = 2; + break; + case "REQUIRED_ONCE": + case 3: + message.occurrenceType = 3; + break; + case "REQUIRED_MULTIPLE": + case 4: + message.occurrenceType = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a Property message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} message Property + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Property.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.valueType = ""; + object.occurrenceType = options.enums === String ? "OCCURRENCE_TYPE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = message.valueType; + if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) + object.occurrenceType = options.enums === String ? $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] === undefined ? message.occurrenceType : $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] : message.occurrenceType; + return object; + }; + + /** + * Converts this Property to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @instance + * @returns {Object.} JSON object + */ + Property.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Property + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property"; + }; + + /** + * OccurrenceType enum. + * @name google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType + * @enum {number} + * @property {number} OCCURRENCE_TYPE_UNSPECIFIED=0 OCCURRENCE_TYPE_UNSPECIFIED value + * @property {number} OPTIONAL_ONCE=1 OPTIONAL_ONCE value + * @property {number} OPTIONAL_MULTIPLE=2 OPTIONAL_MULTIPLE value + * @property {number} REQUIRED_ONCE=3 REQUIRED_ONCE value + * @property {number} REQUIRED_MULTIPLE=4 REQUIRED_MULTIPLE value + */ + Property.OccurrenceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OCCURRENCE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL_ONCE"] = 1; + values[valuesById[2] = "OPTIONAL_MULTIPLE"] = 2; + values[valuesById[3] = "REQUIRED_ONCE"] = 3; + values[valuesById[4] = "REQUIRED_MULTIPLE"] = 4; + return values; + })(); + + return Property; + })(); + + return EntityType; + })(); + + DocumentSchema.Metadata = (function() { + + /** + * Properties of a Metadata. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @interface IMetadata + * @property {boolean|null} [documentSplitter] Metadata documentSplitter + * @property {boolean|null} [documentAllowMultipleLabels] Metadata documentAllowMultipleLabels + * @property {boolean|null} [prefixedNamingOnProperties] Metadata prefixedNamingOnProperties + * @property {boolean|null} [skipNamingValidation] Metadata skipNamingValidation + */ + + /** + * Constructs a new Metadata. + * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @classdesc Represents a Metadata. + * @implements IMetadata + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata=} [properties] Properties to set + */ + function Metadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metadata documentSplitter. + * @member {boolean} documentSplitter + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.documentSplitter = false; + + /** + * Metadata documentAllowMultipleLabels. + * @member {boolean} documentAllowMultipleLabels + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.documentAllowMultipleLabels = false; + + /** + * Metadata prefixedNamingOnProperties. + * @member {boolean} prefixedNamingOnProperties + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.prefixedNamingOnProperties = false; + + /** + * Metadata skipNamingValidation. + * @member {boolean} skipNamingValidation + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.skipNamingValidation = false; + + /** + * Creates a new Metadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata instance + */ + Metadata.create = function create(properties) { + return new Metadata(properties); + }; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentSplitter != null && Object.hasOwnProperty.call(message, "documentSplitter")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.documentSplitter); + if (message.documentAllowMultipleLabels != null && Object.hasOwnProperty.call(message, "documentAllowMultipleLabels")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.documentAllowMultipleLabels); + if (message.prefixedNamingOnProperties != null && Object.hasOwnProperty.call(message, "prefixedNamingOnProperties")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.prefixedNamingOnProperties); + if (message.skipNamingValidation != null && Object.hasOwnProperty.call(message, "skipNamingValidation")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.skipNamingValidation); + return writer; + }; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.documentSplitter = reader.bool(); + break; + } + case 2: { + message.documentAllowMultipleLabels = reader.bool(); + break; + } + case 6: { + message.prefixedNamingOnProperties = reader.bool(); + break; + } + case 7: { + message.skipNamingValidation = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metadata message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documentSplitter != null && message.hasOwnProperty("documentSplitter")) + if (typeof message.documentSplitter !== "boolean") + return "documentSplitter: boolean expected"; + if (message.documentAllowMultipleLabels != null && message.hasOwnProperty("documentAllowMultipleLabels")) + if (typeof message.documentAllowMultipleLabels !== "boolean") + return "documentAllowMultipleLabels: boolean expected"; + if (message.prefixedNamingOnProperties != null && message.hasOwnProperty("prefixedNamingOnProperties")) + if (typeof message.prefixedNamingOnProperties !== "boolean") + return "prefixedNamingOnProperties: boolean expected"; + if (message.skipNamingValidation != null && message.hasOwnProperty("skipNamingValidation")) + if (typeof message.skipNamingValidation !== "boolean") + return "skipNamingValidation: boolean expected"; + return null; + }; + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata + */ + Metadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata(); + if (object.documentSplitter != null) + message.documentSplitter = Boolean(object.documentSplitter); + if (object.documentAllowMultipleLabels != null) + message.documentAllowMultipleLabels = Boolean(object.documentAllowMultipleLabels); + if (object.prefixedNamingOnProperties != null) + message.prefixedNamingOnProperties = Boolean(object.prefixedNamingOnProperties); + if (object.skipNamingValidation != null) + message.skipNamingValidation = Boolean(object.skipNamingValidation); + return message; + }; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} message Metadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.documentSplitter = false; + object.documentAllowMultipleLabels = false; + object.prefixedNamingOnProperties = false; + object.skipNamingValidation = false; + } + if (message.documentSplitter != null && message.hasOwnProperty("documentSplitter")) + object.documentSplitter = message.documentSplitter; + if (message.documentAllowMultipleLabels != null && message.hasOwnProperty("documentAllowMultipleLabels")) + object.documentAllowMultipleLabels = message.documentAllowMultipleLabels; + if (message.prefixedNamingOnProperties != null && message.hasOwnProperty("prefixedNamingOnProperties")) + object.prefixedNamingOnProperties = message.prefixedNamingOnProperties; + if (message.skipNamingValidation != null && message.hasOwnProperty("skipNamingValidation")) + object.skipNamingValidation = message.skipNamingValidation; + return object; + }; - /** - * Gets the default type url for ReviewDocumentOperationMetadata - * @function getTypeUrl - * @memberof google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReviewDocumentOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata"; - }; + /** + * Converts this Metadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @instance + * @returns {Object.} JSON object + */ + Metadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * State enum. - * @name google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata.State - * @enum {number} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} RUNNING=1 RUNNING value - * @property {number} CANCELLING=2 CANCELLING value - * @property {number} SUCCEEDED=3 SUCCEEDED value - * @property {number} FAILED=4 FAILED value - * @property {number} CANCELLED=5 CANCELLED value - */ - ReviewDocumentOperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNING"] = 1; - values[valuesById[2] = "CANCELLING"] = 2; - values[valuesById[3] = "SUCCEEDED"] = 3; - values[valuesById[4] = "FAILED"] = 4; - values[valuesById[5] = "CANCELLED"] = 5; - return values; + /** + * Gets the default type url for Metadata + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Metadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.Metadata"; + }; + + return Metadata; })(); - return ReviewDocumentOperationMetadata; + return DocumentSchema; })(); - v1beta3.DocumentSchema = (function() { + v1beta3.Evaluation = (function() { /** - * Properties of a DocumentSchema. + * Properties of an Evaluation. * @memberof google.cloud.documentai.v1beta3 - * @interface IDocumentSchema - * @property {string|null} [displayName] DocumentSchema displayName - * @property {string|null} [description] DocumentSchema description - * @property {Array.|null} [entityTypes] DocumentSchema entityTypes - * @property {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null} [metadata] DocumentSchema metadata + * @interface IEvaluation + * @property {string|null} [name] Evaluation name + * @property {google.protobuf.ITimestamp|null} [createTime] Evaluation createTime + * @property {google.cloud.documentai.v1beta3.Evaluation.ICounters|null} [documentCounters] Evaluation documentCounters + * @property {google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics|null} [allEntitiesMetrics] Evaluation allEntitiesMetrics + * @property {Object.|null} [entityMetrics] Evaluation entityMetrics + * @property {string|null} [kmsKeyName] Evaluation kmsKeyName + * @property {string|null} [kmsKeyVersionName] Evaluation kmsKeyVersionName */ /** - * Constructs a new DocumentSchema. + * Constructs a new Evaluation. * @memberof google.cloud.documentai.v1beta3 - * @classdesc Represents a DocumentSchema. - * @implements IDocumentSchema + * @classdesc Represents an Evaluation. + * @implements IEvaluation * @constructor - * @param {google.cloud.documentai.v1beta3.IDocumentSchema=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.IEvaluation=} [properties] Properties to set */ - function DocumentSchema(properties) { - this.entityTypes = []; + function Evaluation(properties) { + this.entityMetrics = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -75639,120 +80491,181 @@ } /** - * DocumentSchema displayName. - * @member {string} displayName - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * Evaluation name. + * @member {string} name + * @memberof google.cloud.documentai.v1beta3.Evaluation * @instance */ - DocumentSchema.prototype.displayName = ""; + Evaluation.prototype.name = ""; /** - * DocumentSchema description. - * @member {string} description - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * Evaluation createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1beta3.Evaluation * @instance */ - DocumentSchema.prototype.description = ""; + Evaluation.prototype.createTime = null; /** - * DocumentSchema entityTypes. - * @member {Array.} entityTypes - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * Evaluation documentCounters. + * @member {google.cloud.documentai.v1beta3.Evaluation.ICounters|null|undefined} documentCounters + * @memberof google.cloud.documentai.v1beta3.Evaluation * @instance */ - DocumentSchema.prototype.entityTypes = $util.emptyArray; + Evaluation.prototype.documentCounters = null; /** - * DocumentSchema metadata. - * @member {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata|null|undefined} metadata - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * Evaluation allEntitiesMetrics. + * @member {google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics|null|undefined} allEntitiesMetrics + * @memberof google.cloud.documentai.v1beta3.Evaluation * @instance */ - DocumentSchema.prototype.metadata = null; + Evaluation.prototype.allEntitiesMetrics = null; /** - * Creates a new DocumentSchema instance using the specified properties. + * Evaluation entityMetrics. + * @member {Object.} entityMetrics + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @instance + */ + Evaluation.prototype.entityMetrics = $util.emptyObject; + + /** + * Evaluation kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @instance + */ + Evaluation.prototype.kmsKeyName = ""; + + /** + * Evaluation kmsKeyVersionName. + * @member {string} kmsKeyVersionName + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @instance + */ + Evaluation.prototype.kmsKeyVersionName = ""; + + /** + * Creates a new Evaluation instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @static - * @param {google.cloud.documentai.v1beta3.IDocumentSchema=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema instance + * @param {google.cloud.documentai.v1beta3.IEvaluation=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Evaluation} Evaluation instance */ - DocumentSchema.create = function create(properties) { - return new DocumentSchema(properties); + Evaluation.create = function create(properties) { + return new Evaluation(properties); }; /** - * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * Encodes the specified Evaluation message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @static - * @param {google.cloud.documentai.v1beta3.IDocumentSchema} message DocumentSchema message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IEvaluation} message Evaluation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DocumentSchema.encode = function encode(message, writer) { + Evaluation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.displayName); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); - if (message.entityTypes != null && message.entityTypes.length) - for (var i = 0; i < message.entityTypes.length; ++i) - $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.encode(message.entityTypes[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.encode(message.metadata, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.allEntitiesMetrics != null && Object.hasOwnProperty.call(message, "allEntitiesMetrics")) + $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.encode(message.allEntitiesMetrics, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.entityMetrics != null && Object.hasOwnProperty.call(message, "entityMetrics")) + for (var keys = Object.keys(message.entityMetrics), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.encode(message.entityMetrics[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + if (message.documentCounters != null && Object.hasOwnProperty.call(message, "documentCounters")) + $root.google.cloud.documentai.v1beta3.Evaluation.Counters.encode(message.documentCounters, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.kmsKeyName); + if (message.kmsKeyVersionName != null && Object.hasOwnProperty.call(message, "kmsKeyVersionName")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.kmsKeyVersionName); return writer; }; /** - * Encodes the specified DocumentSchema message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.verify|verify} messages. + * Encodes the specified Evaluation message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @static - * @param {google.cloud.documentai.v1beta3.IDocumentSchema} message DocumentSchema message or plain object to encode + * @param {google.cloud.documentai.v1beta3.IEvaluation} message Evaluation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DocumentSchema.encodeDelimited = function encodeDelimited(message, writer) { + Evaluation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DocumentSchema message from the specified reader or buffer. + * Decodes an Evaluation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema + * @returns {google.cloud.documentai.v1beta3.Evaluation} Evaluation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DocumentSchema.decode = function decode(reader, length) { + Evaluation.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Evaluation(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.displayName = reader.string(); + message.name = reader.string(); break; } case 2: { - message.description = reader.string(); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.documentCounters = $root.google.cloud.documentai.v1beta3.Evaluation.Counters.decode(reader, reader.uint32()); break; } case 3: { - if (!(message.entityTypes && message.entityTypes.length)) - message.entityTypes = []; - message.entityTypes.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.decode(reader, reader.uint32())); + message.allEntitiesMetrics = $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.decode(reader, reader.uint32()); break; } case 4: { - message.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.decode(reader, reader.uint32()); + if (message.entityMetrics === $util.emptyObject) + message.entityMetrics = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.entityMetrics[key] = value; + break; + } + case 6: { + message.kmsKeyName = reader.string(); + break; + } + case 7: { + message.kmsKeyVersionName = reader.string(); break; } default: @@ -75764,173 +80677,206 @@ }; /** - * Decodes a DocumentSchema message from the specified reader or buffer, length delimited. + * Decodes an Evaluation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema + * @returns {google.cloud.documentai.v1beta3.Evaluation} Evaluation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DocumentSchema.decodeDelimited = function decodeDelimited(reader) { + Evaluation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DocumentSchema message. + * Verifies an Evaluation message. * @function verify - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DocumentSchema.verify = function verify(message) { + Evaluation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { - if (!Array.isArray(message.entityTypes)) - return "entityTypes: array expected"; - for (var i = 0; i < message.entityTypes.length; ++i) { - var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify(message.entityTypes[i]); - if (error) - return "entityTypes." + error; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify(message.metadata); + if (message.documentCounters != null && message.hasOwnProperty("documentCounters")) { + var error = $root.google.cloud.documentai.v1beta3.Evaluation.Counters.verify(message.documentCounters); if (error) - return "metadata." + error; + return "documentCounters." + error; + } + if (message.allEntitiesMetrics != null && message.hasOwnProperty("allEntitiesMetrics")) { + var error = $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.verify(message.allEntitiesMetrics); + if (error) + return "allEntitiesMetrics." + error; + } + if (message.entityMetrics != null && message.hasOwnProperty("entityMetrics")) { + if (!$util.isObject(message.entityMetrics)) + return "entityMetrics: object expected"; + var key = Object.keys(message.entityMetrics); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.verify(message.entityMetrics[key[i]]); + if (error) + return "entityMetrics." + error; + } } + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + if (!$util.isString(message.kmsKeyVersionName)) + return "kmsKeyVersionName: string expected"; return null; }; /** - * Creates a DocumentSchema message from a plain object. Also converts values to their respective internal types. + * Creates an Evaluation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DocumentSchema} DocumentSchema + * @returns {google.cloud.documentai.v1beta3.Evaluation} Evaluation */ - DocumentSchema.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema) + Evaluation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Evaluation) return object; - var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema(); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.description != null) - message.description = String(object.description); - if (object.entityTypes) { - if (!Array.isArray(object.entityTypes)) - throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.entityTypes: array expected"); - message.entityTypes = []; - for (var i = 0; i < object.entityTypes.length; ++i) { - if (typeof object.entityTypes[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.entityTypes: object expected"); - message.entityTypes[i] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.fromObject(object.entityTypes[i]); - } + var message = new $root.google.cloud.documentai.v1beta3.Evaluation(); + if (object.name != null) + message.name = String(object.name); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.metadata: object expected"); - message.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.fromObject(object.metadata); + if (object.documentCounters != null) { + if (typeof object.documentCounters !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.documentCounters: object expected"); + message.documentCounters = $root.google.cloud.documentai.v1beta3.Evaluation.Counters.fromObject(object.documentCounters); + } + if (object.allEntitiesMetrics != null) { + if (typeof object.allEntitiesMetrics !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.allEntitiesMetrics: object expected"); + message.allEntitiesMetrics = $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.fromObject(object.allEntitiesMetrics); + } + if (object.entityMetrics) { + if (typeof object.entityMetrics !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.entityMetrics: object expected"); + message.entityMetrics = {}; + for (var keys = Object.keys(object.entityMetrics), i = 0; i < keys.length; ++i) { + if (typeof object.entityMetrics[keys[i]] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.entityMetrics: object expected"); + message.entityMetrics[keys[i]] = $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.fromObject(object.entityMetrics[keys[i]]); + } } + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.kmsKeyVersionName != null) + message.kmsKeyVersionName = String(object.kmsKeyVersionName); return message; }; /** - * Creates a plain object from a DocumentSchema message. Also converts values to other types if specified. + * Creates a plain object from an Evaluation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema} message DocumentSchema + * @param {google.cloud.documentai.v1beta3.Evaluation} message Evaluation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DocumentSchema.toObject = function toObject(message, options) { + Evaluation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.entityTypes = []; + if (options.objects || options.defaults) + object.entityMetrics = {}; if (options.defaults) { - object.displayName = ""; - object.description = ""; - object.metadata = null; - } - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.entityTypes && message.entityTypes.length) { - object.entityTypes = []; - for (var j = 0; j < message.entityTypes.length; ++j) - object.entityTypes[j] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.toObject(message.entityTypes[j], options); + object.name = ""; + object.createTime = null; + object.allEntitiesMetrics = null; + object.documentCounters = null; + object.kmsKeyName = ""; + object.kmsKeyVersionName = ""; } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata.toObject(message.metadata, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.allEntitiesMetrics != null && message.hasOwnProperty("allEntitiesMetrics")) + object.allEntitiesMetrics = $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.toObject(message.allEntitiesMetrics, options); + var keys2; + if (message.entityMetrics && (keys2 = Object.keys(message.entityMetrics)).length) { + object.entityMetrics = {}; + for (var j = 0; j < keys2.length; ++j) + object.entityMetrics[keys2[j]] = $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.toObject(message.entityMetrics[keys2[j]], options); + } + if (message.documentCounters != null && message.hasOwnProperty("documentCounters")) + object.documentCounters = $root.google.cloud.documentai.v1beta3.Evaluation.Counters.toObject(message.documentCounters, options); + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + object.kmsKeyVersionName = message.kmsKeyVersionName; return object; }; /** - * Converts this DocumentSchema to JSON. + * Converts this Evaluation to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @instance * @returns {Object.} JSON object */ - DocumentSchema.prototype.toJSON = function toJSON() { + Evaluation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for DocumentSchema + * Gets the default type url for Evaluation * @function getTypeUrl - * @memberof google.cloud.documentai.v1beta3.DocumentSchema + * @memberof google.cloud.documentai.v1beta3.Evaluation * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - DocumentSchema.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Evaluation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema"; + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Evaluation"; }; - DocumentSchema.EntityType = (function() { + Evaluation.Counters = (function() { /** - * Properties of an EntityType. - * @memberof google.cloud.documentai.v1beta3.DocumentSchema - * @interface IEntityType - * @property {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null} [enumValues] EntityType enumValues - * @property {string|null} [displayName] EntityType displayName - * @property {string|null} [name] EntityType name - * @property {Array.|null} [baseTypes] EntityType baseTypes - * @property {Array.|null} [properties] EntityType properties + * Properties of a Counters. + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @interface ICounters + * @property {number|null} [inputDocumentsCount] Counters inputDocumentsCount + * @property {number|null} [invalidDocumentsCount] Counters invalidDocumentsCount + * @property {number|null} [failedDocumentsCount] Counters failedDocumentsCount + * @property {number|null} [evaluatedDocumentsCount] Counters evaluatedDocumentsCount */ /** - * Constructs a new EntityType. - * @memberof google.cloud.documentai.v1beta3.DocumentSchema - * @classdesc Represents an EntityType. - * @implements IEntityType + * Constructs a new Counters. + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @classdesc Represents a Counters. + * @implements ICounters * @constructor - * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.Evaluation.ICounters=} [properties] Properties to set */ - function EntityType(properties) { - this.baseTypes = []; - this.properties = []; + function Counters(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -75938,151 +80884,117 @@ } /** - * EntityType enumValues. - * @member {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues|null|undefined} enumValues - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType - * @instance - */ - EntityType.prototype.enumValues = null; - - /** - * EntityType displayName. - * @member {string} displayName - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType - * @instance - */ - EntityType.prototype.displayName = ""; - - /** - * EntityType name. - * @member {string} name - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * Counters inputDocumentsCount. + * @member {number} inputDocumentsCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @instance */ - EntityType.prototype.name = ""; + Counters.prototype.inputDocumentsCount = 0; /** - * EntityType baseTypes. - * @member {Array.} baseTypes - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * Counters invalidDocumentsCount. + * @member {number} invalidDocumentsCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @instance */ - EntityType.prototype.baseTypes = $util.emptyArray; + Counters.prototype.invalidDocumentsCount = 0; /** - * EntityType properties. - * @member {Array.} properties - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * Counters failedDocumentsCount. + * @member {number} failedDocumentsCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @instance */ - EntityType.prototype.properties = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; + Counters.prototype.failedDocumentsCount = 0; /** - * EntityType valueSource. - * @member {"enumValues"|undefined} valueSource - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * Counters evaluatedDocumentsCount. + * @member {number} evaluatedDocumentsCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @instance */ - Object.defineProperty(EntityType.prototype, "valueSource", { - get: $util.oneOfGetter($oneOfFields = ["enumValues"]), - set: $util.oneOfSetter($oneOfFields) - }); + Counters.prototype.evaluatedDocumentsCount = 0; /** - * Creates a new EntityType instance using the specified properties. + * Creates a new Counters instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType instance + * @param {google.cloud.documentai.v1beta3.Evaluation.ICounters=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Evaluation.Counters} Counters instance */ - EntityType.create = function create(properties) { - return new EntityType(properties); + Counters.create = function create(properties) { + return new Counters(properties); }; /** - * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * Encodes the specified Counters message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.Counters.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType} message EntityType message or plain object to encode + * @param {google.cloud.documentai.v1beta3.Evaluation.ICounters} message Counters message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityType.encode = function encode(message, writer) { + Counters.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.baseTypes != null && message.baseTypes.length) - for (var i = 0; i < message.baseTypes.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.baseTypes[i]); - if (message.properties != null && message.properties.length) - for (var i = 0; i < message.properties.length; ++i) - $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.encode(message.properties[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.displayName); - if (message.enumValues != null && Object.hasOwnProperty.call(message, "enumValues")) - $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.encode(message.enumValues, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.inputDocumentsCount != null && Object.hasOwnProperty.call(message, "inputDocumentsCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.inputDocumentsCount); + if (message.invalidDocumentsCount != null && Object.hasOwnProperty.call(message, "invalidDocumentsCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.invalidDocumentsCount); + if (message.failedDocumentsCount != null && Object.hasOwnProperty.call(message, "failedDocumentsCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.failedDocumentsCount); + if (message.evaluatedDocumentsCount != null && Object.hasOwnProperty.call(message, "evaluatedDocumentsCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.evaluatedDocumentsCount); return writer; }; /** - * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.verify|verify} messages. + * Encodes the specified Counters message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.Counters.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.IEntityType} message EntityType message or plain object to encode + * @param {google.cloud.documentai.v1beta3.Evaluation.ICounters} message Counters message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityType.encodeDelimited = function encodeDelimited(message, writer) { + Counters.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EntityType message from the specified reader or buffer. + * Decodes a Counters message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType + * @returns {google.cloud.documentai.v1beta3.Evaluation.Counters} Counters * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityType.decode = function decode(reader, length) { + Counters.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Evaluation.Counters(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 14: { - message.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.decode(reader, reader.uint32()); - break; - } - case 13: { - message.displayName = reader.string(); - break; - } case 1: { - message.name = reader.string(); + message.inputDocumentsCount = reader.int32(); break; } case 2: { - if (!(message.baseTypes && message.baseTypes.length)) - message.baseTypes = []; - message.baseTypes.push(reader.string()); + message.invalidDocumentsCount = reader.int32(); break; } - case 6: { - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.decode(reader, reader.uint32())); + case 3: { + message.failedDocumentsCount = reader.int32(); + break; + } + case 4: { + message.evaluatedDocumentsCount = reader.int32(); break; } default: @@ -76094,723 +81006,821 @@ }; /** - * Decodes an EntityType message from the specified reader or buffer, length delimited. + * Decodes a Counters message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType + * @returns {google.cloud.documentai.v1beta3.Evaluation.Counters} Counters * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityType.decodeDelimited = function decodeDelimited(reader) { + Counters.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EntityType message. + * Verifies a Counters message. * @function verify - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EntityType.verify = function verify(message) { + Counters.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.enumValues != null && message.hasOwnProperty("enumValues")) { - properties.valueSource = 1; - { - var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify(message.enumValues); - if (error) - return "enumValues." + error; - } - } - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.baseTypes != null && message.hasOwnProperty("baseTypes")) { - if (!Array.isArray(message.baseTypes)) - return "baseTypes: array expected"; - for (var i = 0; i < message.baseTypes.length; ++i) - if (!$util.isString(message.baseTypes[i])) - return "baseTypes: string[] expected"; - } - if (message.properties != null && message.hasOwnProperty("properties")) { - if (!Array.isArray(message.properties)) - return "properties: array expected"; - for (var i = 0; i < message.properties.length; ++i) { - var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify(message.properties[i]); - if (error) - return "properties." + error; - } - } + if (message.inputDocumentsCount != null && message.hasOwnProperty("inputDocumentsCount")) + if (!$util.isInteger(message.inputDocumentsCount)) + return "inputDocumentsCount: integer expected"; + if (message.invalidDocumentsCount != null && message.hasOwnProperty("invalidDocumentsCount")) + if (!$util.isInteger(message.invalidDocumentsCount)) + return "invalidDocumentsCount: integer expected"; + if (message.failedDocumentsCount != null && message.hasOwnProperty("failedDocumentsCount")) + if (!$util.isInteger(message.failedDocumentsCount)) + return "failedDocumentsCount: integer expected"; + if (message.evaluatedDocumentsCount != null && message.hasOwnProperty("evaluatedDocumentsCount")) + if (!$util.isInteger(message.evaluatedDocumentsCount)) + return "evaluatedDocumentsCount: integer expected"; return null; }; /** - * Creates an EntityType message from a plain object. Also converts values to their respective internal types. + * Creates a Counters message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} EntityType + * @returns {google.cloud.documentai.v1beta3.Evaluation.Counters} Counters */ - EntityType.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType) - return object; - var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType(); - if (object.enumValues != null) { - if (typeof object.enumValues !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.enumValues: object expected"); - message.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.fromObject(object.enumValues); - } - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.name != null) - message.name = String(object.name); - if (object.baseTypes) { - if (!Array.isArray(object.baseTypes)) - throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.baseTypes: array expected"); - message.baseTypes = []; - for (var i = 0; i < object.baseTypes.length; ++i) - message.baseTypes[i] = String(object.baseTypes[i]); - } - if (object.properties) { - if (!Array.isArray(object.properties)) - throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.properties: array expected"); - message.properties = []; - for (var i = 0; i < object.properties.length; ++i) { - if (typeof object.properties[i] !== "object") - throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.properties: object expected"); - message.properties[i] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.fromObject(object.properties[i]); - } - } + Counters.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Evaluation.Counters) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Evaluation.Counters(); + if (object.inputDocumentsCount != null) + message.inputDocumentsCount = object.inputDocumentsCount | 0; + if (object.invalidDocumentsCount != null) + message.invalidDocumentsCount = object.invalidDocumentsCount | 0; + if (object.failedDocumentsCount != null) + message.failedDocumentsCount = object.failedDocumentsCount | 0; + if (object.evaluatedDocumentsCount != null) + message.evaluatedDocumentsCount = object.evaluatedDocumentsCount | 0; return message; }; /** - * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * Creates a plain object from a Counters message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType} message EntityType + * @param {google.cloud.documentai.v1beta3.Evaluation.Counters} message Counters * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EntityType.toObject = function toObject(message, options) { + Counters.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.baseTypes = []; - object.properties = []; - } if (options.defaults) { - object.name = ""; - object.displayName = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.baseTypes && message.baseTypes.length) { - object.baseTypes = []; - for (var j = 0; j < message.baseTypes.length; ++j) - object.baseTypes[j] = message.baseTypes[j]; - } - if (message.properties && message.properties.length) { - object.properties = []; - for (var j = 0; j < message.properties.length; ++j) - object.properties[j] = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.toObject(message.properties[j], options); - } - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.enumValues != null && message.hasOwnProperty("enumValues")) { - object.enumValues = $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.toObject(message.enumValues, options); - if (options.oneofs) - object.valueSource = "enumValues"; - } + object.inputDocumentsCount = 0; + object.invalidDocumentsCount = 0; + object.failedDocumentsCount = 0; + object.evaluatedDocumentsCount = 0; + } + if (message.inputDocumentsCount != null && message.hasOwnProperty("inputDocumentsCount")) + object.inputDocumentsCount = message.inputDocumentsCount; + if (message.invalidDocumentsCount != null && message.hasOwnProperty("invalidDocumentsCount")) + object.invalidDocumentsCount = message.invalidDocumentsCount; + if (message.failedDocumentsCount != null && message.hasOwnProperty("failedDocumentsCount")) + object.failedDocumentsCount = message.failedDocumentsCount; + if (message.evaluatedDocumentsCount != null && message.hasOwnProperty("evaluatedDocumentsCount")) + object.evaluatedDocumentsCount = message.evaluatedDocumentsCount; return object; }; /** - * Converts this EntityType to JSON. + * Converts this Counters to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @instance * @returns {Object.} JSON object */ - EntityType.prototype.toJSON = function toJSON() { + Counters.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EntityType + * Gets the default type url for Counters * @function getTypeUrl - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType + * @memberof google.cloud.documentai.v1beta3.Evaluation.Counters * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EntityType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + Counters.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.EntityType"; + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Evaluation.Counters"; }; - EntityType.EnumValues = (function() { + return Counters; + })(); - /** - * Properties of an EnumValues. - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType - * @interface IEnumValues - * @property {Array.|null} [values] EnumValues values - */ + Evaluation.Metrics = (function() { - /** - * Constructs a new EnumValues. - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType - * @classdesc Represents an EnumValues. - * @implements IEnumValues - * @constructor - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues=} [properties] Properties to set - */ - function EnumValues(properties) { - this.values = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } + /** + * Properties of a Metrics. + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @interface IMetrics + * @property {number|null} [precision] Metrics precision + * @property {number|null} [recall] Metrics recall + * @property {number|null} [f1Score] Metrics f1Score + * @property {number|null} [predictedOccurrencesCount] Metrics predictedOccurrencesCount + * @property {number|null} [groundTruthOccurrencesCount] Metrics groundTruthOccurrencesCount + * @property {number|null} [predictedDocumentCount] Metrics predictedDocumentCount + * @property {number|null} [groundTruthDocumentCount] Metrics groundTruthDocumentCount + * @property {number|null} [truePositivesCount] Metrics truePositivesCount + * @property {number|null} [falsePositivesCount] Metrics falsePositivesCount + * @property {number|null} [falseNegativesCount] Metrics falseNegativesCount + * @property {number|null} [totalDocumentsCount] Metrics totalDocumentsCount + */ - /** - * EnumValues values. - * @member {Array.} values - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @instance - */ - EnumValues.prototype.values = $util.emptyArray; + /** + * Constructs a new Metrics. + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @classdesc Represents a Metrics. + * @implements IMetrics + * @constructor + * @param {google.cloud.documentai.v1beta3.Evaluation.IMetrics=} [properties] Properties to set + */ + function Metrics(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new EnumValues instance using the specified properties. - * @function create - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues instance - */ - EnumValues.create = function create(properties) { - return new EnumValues(properties); - }; + /** + * Metrics precision. + * @member {number} precision + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.precision = 0; - /** - * Encodes the specified EnumValues message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. - * @function encode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues} message EnumValues message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValues.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.values[i]); - return writer; - }; + /** + * Metrics recall. + * @member {number} recall + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.recall = 0; - /** - * Encodes the specified EnumValues message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IEnumValues} message EnumValues message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValues.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Metrics f1Score. + * @member {number} f1Score + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.f1Score = 0; - /** - * Decodes an EnumValues message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValues.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - if (!(message.values && message.values.length)) - message.values = []; - message.values.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Metrics predictedOccurrencesCount. + * @member {number} predictedOccurrencesCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.predictedOccurrencesCount = 0; - /** - * Decodes an EnumValues message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValues.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Metrics groundTruthOccurrencesCount. + * @member {number} groundTruthOccurrencesCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.groundTruthOccurrencesCount = 0; - /** - * Verifies an EnumValues message. - * @function verify - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumValues.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) - if (!$util.isString(message.values[i])) - return "values: string[] expected"; - } - return null; - }; + /** + * Metrics predictedDocumentCount. + * @member {number} predictedDocumentCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.predictedDocumentCount = 0; - /** - * Creates an EnumValues message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} EnumValues - */ - EnumValues.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues) - return object; - var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues(); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) - message.values[i] = String(object.values[i]); - } - return message; - }; + /** + * Metrics groundTruthDocumentCount. + * @member {number} groundTruthDocumentCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.groundTruthDocumentCount = 0; + + /** + * Metrics truePositivesCount. + * @member {number} truePositivesCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.truePositivesCount = 0; + + /** + * Metrics falsePositivesCount. + * @member {number} falsePositivesCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.falsePositivesCount = 0; + + /** + * Metrics falseNegativesCount. + * @member {number} falseNegativesCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.falseNegativesCount = 0; + + /** + * Metrics totalDocumentsCount. + * @member {number} totalDocumentsCount + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + */ + Metrics.prototype.totalDocumentsCount = 0; + + /** + * Creates a new Metrics instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @static + * @param {google.cloud.documentai.v1beta3.Evaluation.IMetrics=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Evaluation.Metrics} Metrics instance + */ + Metrics.create = function create(properties) { + return new Metrics(properties); + }; + + /** + * Encodes the specified Metrics message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.Metrics.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @static + * @param {google.cloud.documentai.v1beta3.Evaluation.IMetrics} message Metrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metrics.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.precision != null && Object.hasOwnProperty.call(message, "precision")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.precision); + if (message.recall != null && Object.hasOwnProperty.call(message, "recall")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.recall); + if (message.f1Score != null && Object.hasOwnProperty.call(message, "f1Score")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.f1Score); + if (message.predictedOccurrencesCount != null && Object.hasOwnProperty.call(message, "predictedOccurrencesCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.predictedOccurrencesCount); + if (message.groundTruthOccurrencesCount != null && Object.hasOwnProperty.call(message, "groundTruthOccurrencesCount")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.groundTruthOccurrencesCount); + if (message.truePositivesCount != null && Object.hasOwnProperty.call(message, "truePositivesCount")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.truePositivesCount); + if (message.falsePositivesCount != null && Object.hasOwnProperty.call(message, "falsePositivesCount")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.falsePositivesCount); + if (message.falseNegativesCount != null && Object.hasOwnProperty.call(message, "falseNegativesCount")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.falseNegativesCount); + if (message.totalDocumentsCount != null && Object.hasOwnProperty.call(message, "totalDocumentsCount")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.totalDocumentsCount); + if (message.predictedDocumentCount != null && Object.hasOwnProperty.call(message, "predictedDocumentCount")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.predictedDocumentCount); + if (message.groundTruthDocumentCount != null && Object.hasOwnProperty.call(message, "groundTruthDocumentCount")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.groundTruthDocumentCount); + return writer; + }; - /** - * Creates a plain object from an EnumValues message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues} message EnumValues - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumValues.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = message.values[j]; + /** + * Encodes the specified Metrics message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.Metrics.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @static + * @param {google.cloud.documentai.v1beta3.Evaluation.IMetrics} message Metrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metrics.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metrics message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Evaluation.Metrics} Metrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metrics.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Evaluation.Metrics(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.precision = reader.float(); + break; + } + case 2: { + message.recall = reader.float(); + break; + } + case 3: { + message.f1Score = reader.float(); + break; + } + case 4: { + message.predictedOccurrencesCount = reader.int32(); + break; + } + case 5: { + message.groundTruthOccurrencesCount = reader.int32(); + break; + } + case 10: { + message.predictedDocumentCount = reader.int32(); + break; + } + case 11: { + message.groundTruthDocumentCount = reader.int32(); + break; + } + case 6: { + message.truePositivesCount = reader.int32(); + break; + } + case 7: { + message.falsePositivesCount = reader.int32(); + break; + } + case 8: { + message.falseNegativesCount = reader.int32(); + break; + } + case 9: { + message.totalDocumentsCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; } - return object; - }; + } + return message; + }; - /** - * Converts this EnumValues to JSON. - * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @instance - * @returns {Object.} JSON object - */ - EnumValues.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Decodes a Metrics message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Evaluation.Metrics} Metrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metrics.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Gets the default type url for EnumValues - * @function getTypeUrl - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumValues.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.EntityType.EnumValues"; - }; + /** + * Verifies a Metrics message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metrics.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.precision != null && message.hasOwnProperty("precision")) + if (typeof message.precision !== "number") + return "precision: number expected"; + if (message.recall != null && message.hasOwnProperty("recall")) + if (typeof message.recall !== "number") + return "recall: number expected"; + if (message.f1Score != null && message.hasOwnProperty("f1Score")) + if (typeof message.f1Score !== "number") + return "f1Score: number expected"; + if (message.predictedOccurrencesCount != null && message.hasOwnProperty("predictedOccurrencesCount")) + if (!$util.isInteger(message.predictedOccurrencesCount)) + return "predictedOccurrencesCount: integer expected"; + if (message.groundTruthOccurrencesCount != null && message.hasOwnProperty("groundTruthOccurrencesCount")) + if (!$util.isInteger(message.groundTruthOccurrencesCount)) + return "groundTruthOccurrencesCount: integer expected"; + if (message.predictedDocumentCount != null && message.hasOwnProperty("predictedDocumentCount")) + if (!$util.isInteger(message.predictedDocumentCount)) + return "predictedDocumentCount: integer expected"; + if (message.groundTruthDocumentCount != null && message.hasOwnProperty("groundTruthDocumentCount")) + if (!$util.isInteger(message.groundTruthDocumentCount)) + return "groundTruthDocumentCount: integer expected"; + if (message.truePositivesCount != null && message.hasOwnProperty("truePositivesCount")) + if (!$util.isInteger(message.truePositivesCount)) + return "truePositivesCount: integer expected"; + if (message.falsePositivesCount != null && message.hasOwnProperty("falsePositivesCount")) + if (!$util.isInteger(message.falsePositivesCount)) + return "falsePositivesCount: integer expected"; + if (message.falseNegativesCount != null && message.hasOwnProperty("falseNegativesCount")) + if (!$util.isInteger(message.falseNegativesCount)) + return "falseNegativesCount: integer expected"; + if (message.totalDocumentsCount != null && message.hasOwnProperty("totalDocumentsCount")) + if (!$util.isInteger(message.totalDocumentsCount)) + return "totalDocumentsCount: integer expected"; + return null; + }; - return EnumValues; - })(); + /** + * Creates a Metrics message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Evaluation.Metrics} Metrics + */ + Metrics.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Evaluation.Metrics) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Evaluation.Metrics(); + if (object.precision != null) + message.precision = Number(object.precision); + if (object.recall != null) + message.recall = Number(object.recall); + if (object.f1Score != null) + message.f1Score = Number(object.f1Score); + if (object.predictedOccurrencesCount != null) + message.predictedOccurrencesCount = object.predictedOccurrencesCount | 0; + if (object.groundTruthOccurrencesCount != null) + message.groundTruthOccurrencesCount = object.groundTruthOccurrencesCount | 0; + if (object.predictedDocumentCount != null) + message.predictedDocumentCount = object.predictedDocumentCount | 0; + if (object.groundTruthDocumentCount != null) + message.groundTruthDocumentCount = object.groundTruthDocumentCount | 0; + if (object.truePositivesCount != null) + message.truePositivesCount = object.truePositivesCount | 0; + if (object.falsePositivesCount != null) + message.falsePositivesCount = object.falsePositivesCount | 0; + if (object.falseNegativesCount != null) + message.falseNegativesCount = object.falseNegativesCount | 0; + if (object.totalDocumentsCount != null) + message.totalDocumentsCount = object.totalDocumentsCount | 0; + return message; + }; - EntityType.Property = (function() { + /** + * Creates a plain object from a Metrics message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @static + * @param {google.cloud.documentai.v1beta3.Evaluation.Metrics} message Metrics + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metrics.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.precision = 0; + object.recall = 0; + object.f1Score = 0; + object.predictedOccurrencesCount = 0; + object.groundTruthOccurrencesCount = 0; + object.truePositivesCount = 0; + object.falsePositivesCount = 0; + object.falseNegativesCount = 0; + object.totalDocumentsCount = 0; + object.predictedDocumentCount = 0; + object.groundTruthDocumentCount = 0; + } + if (message.precision != null && message.hasOwnProperty("precision")) + object.precision = options.json && !isFinite(message.precision) ? String(message.precision) : message.precision; + if (message.recall != null && message.hasOwnProperty("recall")) + object.recall = options.json && !isFinite(message.recall) ? String(message.recall) : message.recall; + if (message.f1Score != null && message.hasOwnProperty("f1Score")) + object.f1Score = options.json && !isFinite(message.f1Score) ? String(message.f1Score) : message.f1Score; + if (message.predictedOccurrencesCount != null && message.hasOwnProperty("predictedOccurrencesCount")) + object.predictedOccurrencesCount = message.predictedOccurrencesCount; + if (message.groundTruthOccurrencesCount != null && message.hasOwnProperty("groundTruthOccurrencesCount")) + object.groundTruthOccurrencesCount = message.groundTruthOccurrencesCount; + if (message.truePositivesCount != null && message.hasOwnProperty("truePositivesCount")) + object.truePositivesCount = message.truePositivesCount; + if (message.falsePositivesCount != null && message.hasOwnProperty("falsePositivesCount")) + object.falsePositivesCount = message.falsePositivesCount; + if (message.falseNegativesCount != null && message.hasOwnProperty("falseNegativesCount")) + object.falseNegativesCount = message.falseNegativesCount; + if (message.totalDocumentsCount != null && message.hasOwnProperty("totalDocumentsCount")) + object.totalDocumentsCount = message.totalDocumentsCount; + if (message.predictedDocumentCount != null && message.hasOwnProperty("predictedDocumentCount")) + object.predictedDocumentCount = message.predictedDocumentCount; + if (message.groundTruthDocumentCount != null && message.hasOwnProperty("groundTruthDocumentCount")) + object.groundTruthDocumentCount = message.groundTruthDocumentCount; + return object; + }; - /** - * Properties of a Property. - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType - * @interface IProperty - * @property {string|null} [name] Property name - * @property {string|null} [valueType] Property valueType - * @property {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType|null} [occurrenceType] Property occurrenceType - */ + /** + * Converts this Metrics to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @instance + * @returns {Object.} JSON object + */ + Metrics.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Constructs a new Property. - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType - * @classdesc Represents a Property. - * @implements IProperty - * @constructor - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty=} [properties] Properties to set - */ - function Property(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; + /** + * Gets the default type url for Metrics + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Evaluation.Metrics + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Metrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Evaluation.Metrics"; + }; - /** - * Property name. - * @member {string} name - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @instance - */ - Property.prototype.name = ""; + return Metrics; + })(); - /** - * Property valueType. - * @member {string} valueType - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @instance - */ - Property.prototype.valueType = ""; + Evaluation.ConfidenceLevelMetrics = (function() { - /** - * Property occurrenceType. - * @member {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType} occurrenceType - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @instance - */ - Property.prototype.occurrenceType = 0; + /** + * Properties of a ConfidenceLevelMetrics. + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @interface IConfidenceLevelMetrics + * @property {number|null} [confidenceLevel] ConfidenceLevelMetrics confidenceLevel + * @property {google.cloud.documentai.v1beta3.Evaluation.IMetrics|null} [metrics] ConfidenceLevelMetrics metrics + */ - /** - * Creates a new Property instance using the specified properties. - * @function create - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property instance - */ - Property.create = function create(properties) { - return new Property(properties); - }; + /** + * Constructs a new ConfidenceLevelMetrics. + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @classdesc Represents a ConfidenceLevelMetrics. + * @implements IConfidenceLevelMetrics + * @constructor + * @param {google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics=} [properties] Properties to set + */ + function ConfidenceLevelMetrics(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. - * @function encode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty} message Property message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Property.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueType); - if (message.occurrenceType != null && Object.hasOwnProperty.call(message, "occurrenceType")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.occurrenceType); - return writer; - }; + /** + * ConfidenceLevelMetrics confidenceLevel. + * @member {number} confidenceLevel + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @instance + */ + ConfidenceLevelMetrics.prototype.confidenceLevel = 0; - /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.IProperty} message Property message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Property.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * ConfidenceLevelMetrics metrics. + * @member {google.cloud.documentai.v1beta3.Evaluation.IMetrics|null|undefined} metrics + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @instance + */ + ConfidenceLevelMetrics.prototype.metrics = null; - /** - * Decodes a Property message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Property.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.valueType = reader.string(); - break; - } - case 3: { - message.occurrenceType = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new ConfidenceLevelMetrics instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @static + * @param {google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics} ConfidenceLevelMetrics instance + */ + ConfidenceLevelMetrics.create = function create(properties) { + return new ConfidenceLevelMetrics(properties); + }; - /** - * Decodes a Property message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Property.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified ConfidenceLevelMetrics message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @static + * @param {google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics} message ConfidenceLevelMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConfidenceLevelMetrics.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.confidenceLevel != null && Object.hasOwnProperty.call(message, "confidenceLevel")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.confidenceLevel); + if (message.metrics != null && Object.hasOwnProperty.call(message, "metrics")) + $root.google.cloud.documentai.v1beta3.Evaluation.Metrics.encode(message.metrics, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; - /** - * Verifies a Property message. - * @function verify - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Property.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.valueType != null && message.hasOwnProperty("valueType")) - if (!$util.isString(message.valueType)) - return "valueType: string expected"; - if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) - switch (message.occurrenceType) { - default: - return "occurrenceType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: + /** + * Encodes the specified ConfidenceLevelMetrics message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @static + * @param {google.cloud.documentai.v1beta3.Evaluation.IConfidenceLevelMetrics} message ConfidenceLevelMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConfidenceLevelMetrics.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConfidenceLevelMetrics message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics} ConfidenceLevelMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConfidenceLevelMetrics.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.confidenceLevel = reader.float(); break; } - return null; - }; - - /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} Property - */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property) - return object; - var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property(); - if (object.name != null) - message.name = String(object.name); - if (object.valueType != null) - message.valueType = String(object.valueType); - switch (object.occurrenceType) { - default: - if (typeof object.occurrenceType === "number") { - message.occurrenceType = object.occurrenceType; + case 2: { + message.metrics = $root.google.cloud.documentai.v1beta3.Evaluation.Metrics.decode(reader, reader.uint32()); break; } + default: + reader.skipType(tag & 7); break; - case "OCCURRENCE_TYPE_UNSPECIFIED": - case 0: - message.occurrenceType = 0; - break; - case "OPTIONAL_ONCE": - case 1: - message.occurrenceType = 1; - break; - case "OPTIONAL_MULTIPLE": - case 2: - message.occurrenceType = 2; - break; - case "REQUIRED_ONCE": - case 3: - message.occurrenceType = 3; - break; - case "REQUIRED_MULTIPLE": - case 4: - message.occurrenceType = 4; - break; - } - return message; - }; - - /** - * Creates a plain object from a Property message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property} message Property - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Property.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.valueType = ""; - object.occurrenceType = options.enums === String ? "OCCURRENCE_TYPE_UNSPECIFIED" : 0; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.valueType != null && message.hasOwnProperty("valueType")) - object.valueType = message.valueType; - if (message.occurrenceType != null && message.hasOwnProperty("occurrenceType")) - object.occurrenceType = options.enums === String ? $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] === undefined ? message.occurrenceType : $root.google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] : message.occurrenceType; - return object; - }; + } + return message; + }; - /** - * Converts this Property to JSON. - * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @instance - * @returns {Object.} JSON object - */ - Property.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Decodes a ConfidenceLevelMetrics message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics} ConfidenceLevelMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConfidenceLevelMetrics.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Gets the default type url for Property - * @function getTypeUrl - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Property.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property"; - }; + /** + * Verifies a ConfidenceLevelMetrics message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConfidenceLevelMetrics.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.confidenceLevel != null && message.hasOwnProperty("confidenceLevel")) + if (typeof message.confidenceLevel !== "number") + return "confidenceLevel: number expected"; + if (message.metrics != null && message.hasOwnProperty("metrics")) { + var error = $root.google.cloud.documentai.v1beta3.Evaluation.Metrics.verify(message.metrics); + if (error) + return "metrics." + error; + } + return null; + }; - /** - * OccurrenceType enum. - * @name google.cloud.documentai.v1beta3.DocumentSchema.EntityType.Property.OccurrenceType - * @enum {number} - * @property {number} OCCURRENCE_TYPE_UNSPECIFIED=0 OCCURRENCE_TYPE_UNSPECIFIED value - * @property {number} OPTIONAL_ONCE=1 OPTIONAL_ONCE value - * @property {number} OPTIONAL_MULTIPLE=2 OPTIONAL_MULTIPLE value - * @property {number} REQUIRED_ONCE=3 REQUIRED_ONCE value - * @property {number} REQUIRED_MULTIPLE=4 REQUIRED_MULTIPLE value - */ - Property.OccurrenceType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "OCCURRENCE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "OPTIONAL_ONCE"] = 1; - values[valuesById[2] = "OPTIONAL_MULTIPLE"] = 2; - values[valuesById[3] = "REQUIRED_ONCE"] = 3; - values[valuesById[4] = "REQUIRED_MULTIPLE"] = 4; - return values; - })(); + /** + * Creates a ConfidenceLevelMetrics message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics} ConfidenceLevelMetrics + */ + ConfidenceLevelMetrics.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics(); + if (object.confidenceLevel != null) + message.confidenceLevel = Number(object.confidenceLevel); + if (object.metrics != null) { + if (typeof object.metrics !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.metrics: object expected"); + message.metrics = $root.google.cloud.documentai.v1beta3.Evaluation.Metrics.fromObject(object.metrics); + } + return message; + }; - return Property; - })(); + /** + * Creates a plain object from a ConfidenceLevelMetrics message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @static + * @param {google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics} message ConfidenceLevelMetrics + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConfidenceLevelMetrics.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.confidenceLevel = 0; + object.metrics = null; + } + if (message.confidenceLevel != null && message.hasOwnProperty("confidenceLevel")) + object.confidenceLevel = options.json && !isFinite(message.confidenceLevel) ? String(message.confidenceLevel) : message.confidenceLevel; + if (message.metrics != null && message.hasOwnProperty("metrics")) + object.metrics = $root.google.cloud.documentai.v1beta3.Evaluation.Metrics.toObject(message.metrics, options); + return object; + }; - return EntityType; + /** + * Converts this ConfidenceLevelMetrics to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @instance + * @returns {Object.} JSON object + */ + ConfidenceLevelMetrics.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConfidenceLevelMetrics + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConfidenceLevelMetrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics"; + }; + + return ConfidenceLevelMetrics; })(); - DocumentSchema.Metadata = (function() { + Evaluation.MultiConfidenceMetrics = (function() { /** - * Properties of a Metadata. - * @memberof google.cloud.documentai.v1beta3.DocumentSchema - * @interface IMetadata - * @property {boolean|null} [documentSplitter] Metadata documentSplitter - * @property {boolean|null} [documentAllowMultipleLabels] Metadata documentAllowMultipleLabels - * @property {boolean|null} [prefixedNamingOnProperties] Metadata prefixedNamingOnProperties - * @property {boolean|null} [skipNamingValidation] Metadata skipNamingValidation + * Properties of a MultiConfidenceMetrics. + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @interface IMultiConfidenceMetrics + * @property {Array.|null} [confidenceLevelMetrics] MultiConfidenceMetrics confidenceLevelMetrics + * @property {Array.|null} [confidenceLevelMetricsExact] MultiConfidenceMetrics confidenceLevelMetricsExact + * @property {number|null} [auprc] MultiConfidenceMetrics auprc + * @property {number|null} [estimatedCalibrationError] MultiConfidenceMetrics estimatedCalibrationError + * @property {number|null} [auprcExact] MultiConfidenceMetrics auprcExact + * @property {number|null} [estimatedCalibrationErrorExact] MultiConfidenceMetrics estimatedCalibrationErrorExact + * @property {google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.MetricsType|null} [metricsType] MultiConfidenceMetrics metricsType */ /** - * Constructs a new Metadata. - * @memberof google.cloud.documentai.v1beta3.DocumentSchema - * @classdesc Represents a Metadata. - * @implements IMetadata + * Constructs a new MultiConfidenceMetrics. + * @memberof google.cloud.documentai.v1beta3.Evaluation + * @classdesc Represents a MultiConfidenceMetrics. + * @implements IMultiConfidenceMetrics * @constructor - * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics=} [properties] Properties to set */ - function Metadata(properties) { + function MultiConfidenceMetrics(properties) { + this.confidenceLevelMetrics = []; + this.confidenceLevelMetricsExact = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -76818,117 +81828,165 @@ } /** - * Metadata documentSplitter. - * @member {boolean} documentSplitter - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * MultiConfidenceMetrics confidenceLevelMetrics. + * @member {Array.} confidenceLevelMetrics + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @instance */ - Metadata.prototype.documentSplitter = false; + MultiConfidenceMetrics.prototype.confidenceLevelMetrics = $util.emptyArray; /** - * Metadata documentAllowMultipleLabels. - * @member {boolean} documentAllowMultipleLabels - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * MultiConfidenceMetrics confidenceLevelMetricsExact. + * @member {Array.} confidenceLevelMetricsExact + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @instance */ - Metadata.prototype.documentAllowMultipleLabels = false; + MultiConfidenceMetrics.prototype.confidenceLevelMetricsExact = $util.emptyArray; /** - * Metadata prefixedNamingOnProperties. - * @member {boolean} prefixedNamingOnProperties - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * MultiConfidenceMetrics auprc. + * @member {number} auprc + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @instance */ - Metadata.prototype.prefixedNamingOnProperties = false; + MultiConfidenceMetrics.prototype.auprc = 0; /** - * Metadata skipNamingValidation. - * @member {boolean} skipNamingValidation - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * MultiConfidenceMetrics estimatedCalibrationError. + * @member {number} estimatedCalibrationError + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @instance */ - Metadata.prototype.skipNamingValidation = false; + MultiConfidenceMetrics.prototype.estimatedCalibrationError = 0; /** - * Creates a new Metadata instance using the specified properties. + * MultiConfidenceMetrics auprcExact. + * @member {number} auprcExact + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics + * @instance + */ + MultiConfidenceMetrics.prototype.auprcExact = 0; + + /** + * MultiConfidenceMetrics estimatedCalibrationErrorExact. + * @member {number} estimatedCalibrationErrorExact + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics + * @instance + */ + MultiConfidenceMetrics.prototype.estimatedCalibrationErrorExact = 0; + + /** + * MultiConfidenceMetrics metricsType. + * @member {google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.MetricsType} metricsType + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics + * @instance + */ + MultiConfidenceMetrics.prototype.metricsType = 0; + + /** + * Creates a new MultiConfidenceMetrics instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata instance + * @param {google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics} MultiConfidenceMetrics instance */ - Metadata.create = function create(properties) { - return new Metadata(properties); + MultiConfidenceMetrics.create = function create(properties) { + return new MultiConfidenceMetrics(properties); }; /** - * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * Encodes the specified MultiConfidenceMetrics message. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata} message Metadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics} message MultiConfidenceMetrics message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Metadata.encode = function encode(message, writer) { + MultiConfidenceMetrics.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.documentSplitter != null && Object.hasOwnProperty.call(message, "documentSplitter")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.documentSplitter); - if (message.documentAllowMultipleLabels != null && Object.hasOwnProperty.call(message, "documentAllowMultipleLabels")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.documentAllowMultipleLabels); - if (message.prefixedNamingOnProperties != null && Object.hasOwnProperty.call(message, "prefixedNamingOnProperties")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.prefixedNamingOnProperties); - if (message.skipNamingValidation != null && Object.hasOwnProperty.call(message, "skipNamingValidation")) - writer.uint32(/* id 7, wireType 0 =*/56).bool(message.skipNamingValidation); + if (message.confidenceLevelMetrics != null && message.confidenceLevelMetrics.length) + for (var i = 0; i < message.confidenceLevelMetrics.length; ++i) + $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.encode(message.confidenceLevelMetrics[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.auprc != null && Object.hasOwnProperty.call(message, "auprc")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.auprc); + if (message.estimatedCalibrationError != null && Object.hasOwnProperty.call(message, "estimatedCalibrationError")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.estimatedCalibrationError); + if (message.confidenceLevelMetricsExact != null && message.confidenceLevelMetricsExact.length) + for (var i = 0; i < message.confidenceLevelMetricsExact.length; ++i) + $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.encode(message.confidenceLevelMetricsExact[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.auprcExact != null && Object.hasOwnProperty.call(message, "auprcExact")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.auprcExact); + if (message.estimatedCalibrationErrorExact != null && Object.hasOwnProperty.call(message, "estimatedCalibrationErrorExact")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.estimatedCalibrationErrorExact); + if (message.metricsType != null && Object.hasOwnProperty.call(message, "metricsType")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.metricsType); return writer; }; /** - * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentSchema.Metadata.verify|verify} messages. + * Encodes the specified MultiConfidenceMetrics message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.IMetadata} message Metadata message or plain object to encode + * @param {google.cloud.documentai.v1beta3.Evaluation.IMultiConfidenceMetrics} message MultiConfidenceMetrics message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Metadata.encodeDelimited = function encodeDelimited(message, writer) { + MultiConfidenceMetrics.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Metadata message from the specified reader or buffer. + * Decodes a MultiConfidenceMetrics message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata + * @returns {google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics} MultiConfidenceMetrics * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Metadata.decode = function decode(reader, length) { + MultiConfidenceMetrics.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: { - message.documentSplitter = reader.bool(); + if (!(message.confidenceLevelMetrics && message.confidenceLevelMetrics.length)) + message.confidenceLevelMetrics = []; + message.confidenceLevelMetrics.push($root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.confidenceLevelMetricsExact && message.confidenceLevelMetricsExact.length)) + message.confidenceLevelMetricsExact = []; + message.confidenceLevelMetricsExact.push($root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.decode(reader, reader.uint32())); break; } case 2: { - message.documentAllowMultipleLabels = reader.bool(); + message.auprc = reader.float(); + break; + } + case 3: { + message.estimatedCalibrationError = reader.float(); + break; + } + case 5: { + message.auprcExact = reader.float(); break; } case 6: { - message.prefixedNamingOnProperties = reader.bool(); + message.estimatedCalibrationErrorExact = reader.float(); break; } case 7: { - message.skipNamingValidation = reader.bool(); + message.metricsType = reader.int32(); break; } default: @@ -76940,130 +81998,223 @@ }; /** - * Decodes a Metadata message from the specified reader or buffer, length delimited. + * Decodes a MultiConfidenceMetrics message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata + * @returns {google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics} MultiConfidenceMetrics * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Metadata.decodeDelimited = function decodeDelimited(reader) { + MultiConfidenceMetrics.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Metadata message. + * Verifies a MultiConfidenceMetrics message. * @function verify - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Metadata.verify = function verify(message) { + MultiConfidenceMetrics.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.documentSplitter != null && message.hasOwnProperty("documentSplitter")) - if (typeof message.documentSplitter !== "boolean") - return "documentSplitter: boolean expected"; - if (message.documentAllowMultipleLabels != null && message.hasOwnProperty("documentAllowMultipleLabels")) - if (typeof message.documentAllowMultipleLabels !== "boolean") - return "documentAllowMultipleLabels: boolean expected"; - if (message.prefixedNamingOnProperties != null && message.hasOwnProperty("prefixedNamingOnProperties")) - if (typeof message.prefixedNamingOnProperties !== "boolean") - return "prefixedNamingOnProperties: boolean expected"; - if (message.skipNamingValidation != null && message.hasOwnProperty("skipNamingValidation")) - if (typeof message.skipNamingValidation !== "boolean") - return "skipNamingValidation: boolean expected"; + if (message.confidenceLevelMetrics != null && message.hasOwnProperty("confidenceLevelMetrics")) { + if (!Array.isArray(message.confidenceLevelMetrics)) + return "confidenceLevelMetrics: array expected"; + for (var i = 0; i < message.confidenceLevelMetrics.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.verify(message.confidenceLevelMetrics[i]); + if (error) + return "confidenceLevelMetrics." + error; + } + } + if (message.confidenceLevelMetricsExact != null && message.hasOwnProperty("confidenceLevelMetricsExact")) { + if (!Array.isArray(message.confidenceLevelMetricsExact)) + return "confidenceLevelMetricsExact: array expected"; + for (var i = 0; i < message.confidenceLevelMetricsExact.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.verify(message.confidenceLevelMetricsExact[i]); + if (error) + return "confidenceLevelMetricsExact." + error; + } + } + if (message.auprc != null && message.hasOwnProperty("auprc")) + if (typeof message.auprc !== "number") + return "auprc: number expected"; + if (message.estimatedCalibrationError != null && message.hasOwnProperty("estimatedCalibrationError")) + if (typeof message.estimatedCalibrationError !== "number") + return "estimatedCalibrationError: number expected"; + if (message.auprcExact != null && message.hasOwnProperty("auprcExact")) + if (typeof message.auprcExact !== "number") + return "auprcExact: number expected"; + if (message.estimatedCalibrationErrorExact != null && message.hasOwnProperty("estimatedCalibrationErrorExact")) + if (typeof message.estimatedCalibrationErrorExact !== "number") + return "estimatedCalibrationErrorExact: number expected"; + if (message.metricsType != null && message.hasOwnProperty("metricsType")) + switch (message.metricsType) { + default: + return "metricsType: enum value expected"; + case 0: + case 1: + break; + } return null; }; /** - * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * Creates a MultiConfidenceMetrics message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} Metadata + * @returns {google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics} MultiConfidenceMetrics */ - Metadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata) + MultiConfidenceMetrics.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics) return object; - var message = new $root.google.cloud.documentai.v1beta3.DocumentSchema.Metadata(); - if (object.documentSplitter != null) - message.documentSplitter = Boolean(object.documentSplitter); - if (object.documentAllowMultipleLabels != null) - message.documentAllowMultipleLabels = Boolean(object.documentAllowMultipleLabels); - if (object.prefixedNamingOnProperties != null) - message.prefixedNamingOnProperties = Boolean(object.prefixedNamingOnProperties); - if (object.skipNamingValidation != null) - message.skipNamingValidation = Boolean(object.skipNamingValidation); + var message = new $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics(); + if (object.confidenceLevelMetrics) { + if (!Array.isArray(object.confidenceLevelMetrics)) + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.confidenceLevelMetrics: array expected"); + message.confidenceLevelMetrics = []; + for (var i = 0; i < object.confidenceLevelMetrics.length; ++i) { + if (typeof object.confidenceLevelMetrics[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.confidenceLevelMetrics: object expected"); + message.confidenceLevelMetrics[i] = $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.fromObject(object.confidenceLevelMetrics[i]); + } + } + if (object.confidenceLevelMetricsExact) { + if (!Array.isArray(object.confidenceLevelMetricsExact)) + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.confidenceLevelMetricsExact: array expected"); + message.confidenceLevelMetricsExact = []; + for (var i = 0; i < object.confidenceLevelMetricsExact.length; ++i) { + if (typeof object.confidenceLevelMetricsExact[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.confidenceLevelMetricsExact: object expected"); + message.confidenceLevelMetricsExact[i] = $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.fromObject(object.confidenceLevelMetricsExact[i]); + } + } + if (object.auprc != null) + message.auprc = Number(object.auprc); + if (object.estimatedCalibrationError != null) + message.estimatedCalibrationError = Number(object.estimatedCalibrationError); + if (object.auprcExact != null) + message.auprcExact = Number(object.auprcExact); + if (object.estimatedCalibrationErrorExact != null) + message.estimatedCalibrationErrorExact = Number(object.estimatedCalibrationErrorExact); + switch (object.metricsType) { + default: + if (typeof object.metricsType === "number") { + message.metricsType = object.metricsType; + break; + } + break; + case "METRICS_TYPE_UNSPECIFIED": + case 0: + message.metricsType = 0; + break; + case "AGGREGATE": + case 1: + message.metricsType = 1; + break; + } return message; }; /** - * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * Creates a plain object from a MultiConfidenceMetrics message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @static - * @param {google.cloud.documentai.v1beta3.DocumentSchema.Metadata} message Metadata + * @param {google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics} message MultiConfidenceMetrics * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Metadata.toObject = function toObject(message, options) { + MultiConfidenceMetrics.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.documentSplitter = false; - object.documentAllowMultipleLabels = false; - object.prefixedNamingOnProperties = false; - object.skipNamingValidation = false; + if (options.arrays || options.defaults) { + object.confidenceLevelMetrics = []; + object.confidenceLevelMetricsExact = []; } - if (message.documentSplitter != null && message.hasOwnProperty("documentSplitter")) - object.documentSplitter = message.documentSplitter; - if (message.documentAllowMultipleLabels != null && message.hasOwnProperty("documentAllowMultipleLabels")) - object.documentAllowMultipleLabels = message.documentAllowMultipleLabels; - if (message.prefixedNamingOnProperties != null && message.hasOwnProperty("prefixedNamingOnProperties")) - object.prefixedNamingOnProperties = message.prefixedNamingOnProperties; - if (message.skipNamingValidation != null && message.hasOwnProperty("skipNamingValidation")) - object.skipNamingValidation = message.skipNamingValidation; + if (options.defaults) { + object.auprc = 0; + object.estimatedCalibrationError = 0; + object.auprcExact = 0; + object.estimatedCalibrationErrorExact = 0; + object.metricsType = options.enums === String ? "METRICS_TYPE_UNSPECIFIED" : 0; + } + if (message.confidenceLevelMetrics && message.confidenceLevelMetrics.length) { + object.confidenceLevelMetrics = []; + for (var j = 0; j < message.confidenceLevelMetrics.length; ++j) + object.confidenceLevelMetrics[j] = $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.toObject(message.confidenceLevelMetrics[j], options); + } + if (message.auprc != null && message.hasOwnProperty("auprc")) + object.auprc = options.json && !isFinite(message.auprc) ? String(message.auprc) : message.auprc; + if (message.estimatedCalibrationError != null && message.hasOwnProperty("estimatedCalibrationError")) + object.estimatedCalibrationError = options.json && !isFinite(message.estimatedCalibrationError) ? String(message.estimatedCalibrationError) : message.estimatedCalibrationError; + if (message.confidenceLevelMetricsExact && message.confidenceLevelMetricsExact.length) { + object.confidenceLevelMetricsExact = []; + for (var j = 0; j < message.confidenceLevelMetricsExact.length; ++j) + object.confidenceLevelMetricsExact[j] = $root.google.cloud.documentai.v1beta3.Evaluation.ConfidenceLevelMetrics.toObject(message.confidenceLevelMetricsExact[j], options); + } + if (message.auprcExact != null && message.hasOwnProperty("auprcExact")) + object.auprcExact = options.json && !isFinite(message.auprcExact) ? String(message.auprcExact) : message.auprcExact; + if (message.estimatedCalibrationErrorExact != null && message.hasOwnProperty("estimatedCalibrationErrorExact")) + object.estimatedCalibrationErrorExact = options.json && !isFinite(message.estimatedCalibrationErrorExact) ? String(message.estimatedCalibrationErrorExact) : message.estimatedCalibrationErrorExact; + if (message.metricsType != null && message.hasOwnProperty("metricsType")) + object.metricsType = options.enums === String ? $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.MetricsType[message.metricsType] === undefined ? message.metricsType : $root.google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.MetricsType[message.metricsType] : message.metricsType; return object; }; /** - * Converts this Metadata to JSON. + * Converts this MultiConfidenceMetrics to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @instance * @returns {Object.} JSON object */ - Metadata.prototype.toJSON = function toJSON() { + MultiConfidenceMetrics.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Metadata + * Gets the default type url for MultiConfidenceMetrics * @function getTypeUrl - * @memberof google.cloud.documentai.v1beta3.DocumentSchema.Metadata + * @memberof google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Metadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + MultiConfidenceMetrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentSchema.Metadata"; + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics"; }; - return Metadata; + /** + * MetricsType enum. + * @name google.cloud.documentai.v1beta3.Evaluation.MultiConfidenceMetrics.MetricsType + * @enum {number} + * @property {number} METRICS_TYPE_UNSPECIFIED=0 METRICS_TYPE_UNSPECIFIED value + * @property {number} AGGREGATE=1 AGGREGATE value + */ + MultiConfidenceMetrics.MetricsType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "METRICS_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AGGREGATE"] = 1; + return values; + })(); + + return MultiConfidenceMetrics; })(); - return DocumentSchema; + return Evaluation; })(); v1beta3.CommonOperationMetadata = (function() { @@ -77441,6 +82592,7 @@ * @interface IProcessorVersion * @property {string|null} [name] ProcessorVersion name * @property {string|null} [displayName] ProcessorVersion displayName + * @property {google.cloud.documentai.v1beta3.IDocumentSchema|null} [documentSchema] ProcessorVersion documentSchema * @property {google.cloud.documentai.v1beta3.ProcessorVersion.State|null} [state] ProcessorVersion state * @property {google.protobuf.ITimestamp|null} [createTime] ProcessorVersion createTime * @property {string|null} [kmsKeyName] ProcessorVersion kmsKeyName @@ -77480,6 +82632,14 @@ */ ProcessorVersion.prototype.displayName = ""; + /** + * ProcessorVersion documentSchema. + * @member {google.cloud.documentai.v1beta3.IDocumentSchema|null|undefined} documentSchema + * @memberof google.cloud.documentai.v1beta3.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.documentSchema = null; + /** * ProcessorVersion state. * @member {google.cloud.documentai.v1beta3.ProcessorVersion.State} state @@ -77566,6 +82726,8 @@ writer.uint32(/* id 10, wireType 2 =*/82).string(message.kmsKeyVersionName); if (message.googleManaged != null && Object.hasOwnProperty.call(message, "googleManaged")) writer.uint32(/* id 11, wireType 0 =*/88).bool(message.googleManaged); + if (message.documentSchema != null && Object.hasOwnProperty.call(message, "documentSchema")) + $root.google.cloud.documentai.v1beta3.DocumentSchema.encode(message.documentSchema, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); if (message.deprecationInfo != null && Object.hasOwnProperty.call(message, "deprecationInfo")) $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.encode(message.deprecationInfo, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); return writer; @@ -77610,6 +82772,10 @@ message.displayName = reader.string(); break; } + case 12: { + message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.decode(reader, reader.uint32()); + break; + } case 6: { message.state = reader.int32(); break; @@ -77675,6 +82841,11 @@ if (message.displayName != null && message.hasOwnProperty("displayName")) if (!$util.isString(message.displayName)) return "displayName: string expected"; + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) { + var error = $root.google.cloud.documentai.v1beta3.DocumentSchema.verify(message.documentSchema); + if (error) + return "documentSchema." + error; + } if (message.state != null && message.hasOwnProperty("state")) switch (message.state) { default: @@ -77727,6 +82898,11 @@ message.name = String(object.name); if (object.displayName != null) message.displayName = String(object.displayName); + if (object.documentSchema != null) { + if (typeof object.documentSchema !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.ProcessorVersion.documentSchema: object expected"); + message.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.fromObject(object.documentSchema); + } switch (object.state) { default: if (typeof object.state === "number") { @@ -77807,6 +82983,7 @@ object.kmsKeyName = ""; object.kmsKeyVersionName = ""; object.googleManaged = false; + object.documentSchema = null; object.deprecationInfo = null; } if (message.name != null && message.hasOwnProperty("name")) @@ -77823,6 +83000,8 @@ object.kmsKeyVersionName = message.kmsKeyVersionName; if (message.googleManaged != null && message.hasOwnProperty("googleManaged")) object.googleManaged = message.googleManaged; + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) + object.documentSchema = $root.google.cloud.documentai.v1beta3.DocumentSchema.toObject(message.documentSchema, options); if (message.deprecationInfo != null && message.hasOwnProperty("deprecationInfo")) object.deprecationInfo = $root.google.cloud.documentai.v1beta3.ProcessorVersion.DeprecationInfo.toObject(message.deprecationInfo, options); return object; diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index f8ada9d376b..90f36807e1c 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -4414,6 +4414,10 @@ "fontSize": { "type": "FontSize", "id": 7 + }, + "fontFamily": { + "type": "string", + "id": 8 } }, "nested": { @@ -4504,9 +4508,16 @@ "type": "DetectedBarcode", "id": 15 }, + "imageQualityScores": { + "type": "ImageQualityScores", + "id": 17 + }, "provenance": { "type": "Provenance", - "id": 16 + "id": 16, + "options": { + "deprecated": true + } } }, "nested": { @@ -4610,7 +4621,10 @@ }, "provenance": { "type": "Provenance", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } } } }, @@ -4627,7 +4641,10 @@ }, "provenance": { "type": "Provenance", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } } } }, @@ -4644,7 +4661,10 @@ }, "provenance": { "type": "Provenance", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } } } }, @@ -4665,7 +4685,10 @@ }, "provenance": { "type": "Provenance", - "id": 4 + "id": 4, + "options": { + "deprecated": true + } } }, "nested": { @@ -4739,6 +4762,10 @@ "rule": "repeated", "type": "DetectedLanguage", "id": 4 + }, + "provenance": { + "type": "Provenance", + "id": 5 } }, "nested": { @@ -4835,6 +4862,33 @@ "id": 2 } } + }, + "ImageQualityScores": { + "fields": { + "qualityScore": { + "type": "float", + "id": 1 + }, + "detectedDefects": { + "rule": "repeated", + "type": "DetectedDefect", + "id": 2 + } + }, + "nested": { + "DetectedDefect": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + } + } + } + } } } }, @@ -5210,7 +5264,10 @@ "provenance": { "rule": "repeated", "type": "Provenance", - "id": 3 + "id": 3, + "options": { + "deprecated": true + } } } } @@ -5335,6 +5392,10 @@ "gcsUri": { "type": "string", "id": 1 + }, + "fieldMask": { + "type": "google.protobuf.FieldMask", + "id": 2 } } } @@ -5478,6 +5539,34 @@ } ] }, + "TrainProcessorVersion": { + "requestType": "TrainProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta3/{parent=projects/*/locations/*/processors/*}/processorVersions:train", + "(google.api.http).body": "*", + "(google.api.method_signature)": "parent,processor_version", + "(google.longrunning.operation_info).response_type": "TrainProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "TrainProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{parent=projects/*/locations/*/processors/*}/processorVersions:train", + "body": "*" + } + }, + { + "(google.api.method_signature)": "parent,processor_version" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "TrainProcessorVersionResponse", + "metadata_type": "TrainProcessorVersionMetadata" + } + } + ] + }, "GetProcessorVersion": { "requestType": "GetProcessorVersionRequest", "responseType": "ProcessorVersion", @@ -5741,6 +5830,70 @@ } } ] + }, + "EvaluateProcessorVersion": { + "requestType": "EvaluateProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1beta3/{processor_version=projects/*/locations/*/processors/*/processorVersions/*}:evaluateProcessorVersion", + "(google.api.http).body": "*", + "(google.api.method_signature)": "processor_version", + "(google.longrunning.operation_info).response_type": "EvaluateProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "EvaluateProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta3/{processor_version=projects/*/locations/*/processors/*/processorVersions/*}:evaluateProcessorVersion", + "body": "*" + } + }, + { + "(google.api.method_signature)": "processor_version" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "EvaluateProcessorVersionResponse", + "metadata_type": "EvaluateProcessorVersionMetadata" + } + } + ] + }, + "GetEvaluation": { + "requestType": "GetEvaluationRequest", + "responseType": "Evaluation", + "options": { + "(google.api.http).get": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*/evaluations/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta3/{name=projects/*/locations/*/processors/*/processorVersions/*/evaluations/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListEvaluations": { + "requestType": "ListEvaluationsRequest", + "responseType": "ListEvaluationsResponse", + "options": { + "(google.api.http).get": "/v1beta3/{parent=projects/*/locations/*/processors/*/processorVersions/*}/evaluations", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1beta3/{parent=projects/*/locations/*/processors/*/processorVersions/*}/evaluations" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] } } }, @@ -6294,6 +6447,108 @@ } } }, + "TrainProcessorVersionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorVersion" + } + }, + "processorVersion": { + "type": "ProcessorVersion", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "documentSchema": { + "type": "DocumentSchema", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "inputData": { + "type": "InputData", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "baseProcessorVersion": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "InputData": { + "fields": { + "trainingDocuments": { + "type": "BatchDocumentsInputConfig", + "id": 3 + }, + "testDocuments": { + "type": "BatchDocumentsInputConfig", + "id": 4 + } + } + } + } + }, + "TrainProcessorVersionResponse": { + "fields": { + "processorVersion": { + "type": "string", + "id": 1 + } + } + }, + "TrainProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + }, + "trainingDatasetValidation": { + "type": "DatasetValidation", + "id": 2 + }, + "testDatasetValidation": { + "type": "DatasetValidation", + "id": 3 + } + }, + "nested": { + "DatasetValidation": { + "fields": { + "documentErrorCount": { + "type": "int32", + "id": 3 + }, + "datasetErrorCount": { + "type": "int32", + "id": 4 + }, + "documentErrors": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + }, + "datasetErrors": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 2 + } + } + } + } + }, "ReviewDocumentRequest": { "oneofs": { "source": { @@ -6409,6 +6664,86 @@ } } }, + "EvaluateProcessorVersionRequest": { + "fields": { + "processorVersion": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + }, + "evaluationDocuments": { + "type": "BatchDocumentsInputConfig", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "EvaluateProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "EvaluateProcessorVersionResponse": { + "fields": { + "evaluation": { + "type": "string", + "id": 2 + } + } + }, + "GetEvaluationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Evaluation" + } + } + } + }, + "ListEvaluationsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListEvaluationsResponse": { + "fields": { + "evaluations": { + "rule": "repeated", + "type": "Evaluation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, "DocumentSchema": { "fields": { "displayName": { @@ -6523,6 +6858,167 @@ } } }, + "Evaluation": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/Evaluation", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "documentCounters": { + "type": "Counters", + "id": 5 + }, + "allEntitiesMetrics": { + "type": "MultiConfidenceMetrics", + "id": 3 + }, + "entityMetrics": { + "keyType": "string", + "type": "MultiConfidenceMetrics", + "id": 4 + }, + "kmsKeyName": { + "type": "string", + "id": 6 + }, + "kmsKeyVersionName": { + "type": "string", + "id": 7 + } + }, + "nested": { + "Counters": { + "fields": { + "inputDocumentsCount": { + "type": "int32", + "id": 1 + }, + "invalidDocumentsCount": { + "type": "int32", + "id": 2 + }, + "failedDocumentsCount": { + "type": "int32", + "id": 3 + }, + "evaluatedDocumentsCount": { + "type": "int32", + "id": 4 + } + } + }, + "Metrics": { + "fields": { + "precision": { + "type": "float", + "id": 1 + }, + "recall": { + "type": "float", + "id": 2 + }, + "f1Score": { + "type": "float", + "id": 3 + }, + "predictedOccurrencesCount": { + "type": "int32", + "id": 4 + }, + "groundTruthOccurrencesCount": { + "type": "int32", + "id": 5 + }, + "predictedDocumentCount": { + "type": "int32", + "id": 10 + }, + "groundTruthDocumentCount": { + "type": "int32", + "id": 11 + }, + "truePositivesCount": { + "type": "int32", + "id": 6 + }, + "falsePositivesCount": { + "type": "int32", + "id": 7 + }, + "falseNegativesCount": { + "type": "int32", + "id": 8 + }, + "totalDocumentsCount": { + "type": "int32", + "id": 9 + } + } + }, + "ConfidenceLevelMetrics": { + "fields": { + "confidenceLevel": { + "type": "float", + "id": 1 + }, + "metrics": { + "type": "Metrics", + "id": 2 + } + } + }, + "MultiConfidenceMetrics": { + "fields": { + "confidenceLevelMetrics": { + "rule": "repeated", + "type": "ConfidenceLevelMetrics", + "id": 1 + }, + "confidenceLevelMetricsExact": { + "rule": "repeated", + "type": "ConfidenceLevelMetrics", + "id": 4 + }, + "auprc": { + "type": "float", + "id": 2 + }, + "estimatedCalibrationError": { + "type": "float", + "id": 3 + }, + "auprcExact": { + "type": "float", + "id": 5 + }, + "estimatedCalibrationErrorExact": { + "type": "float", + "id": 6 + }, + "metricsType": { + "type": "MetricsType", + "id": 7 + } + }, + "nested": { + "MetricsType": { + "values": { + "METRICS_TYPE_UNSPECIFIED": 0, + "AGGREGATE": 1 + } + } + } + } + } + }, "CommonOperationMetadata": { "fields": { "state": { @@ -6573,6 +7069,10 @@ "type": "string", "id": 2 }, + "documentSchema": { + "type": "DocumentSchema", + "id": 12 + }, "state": { "type": "State", "id": 6 diff --git a/packages/google-cloud-documentai/samples/README.md b/packages/google-cloud-documentai/samples/README.md index c3fdc979a96..28100b4a64c 100644 --- a/packages/google-cloud-documentai/samples/README.md +++ b/packages/google-cloud-documentai/samples/README.md @@ -39,15 +39,19 @@ * [Document_processor_service.deploy_processor_version](#document_processor_service.deploy_processor_version) * [Document_processor_service.disable_processor](#document_processor_service.disable_processor) * [Document_processor_service.enable_processor](#document_processor_service.enable_processor) + * [Document_processor_service.evaluate_processor_version](#document_processor_service.evaluate_processor_version) * [Document_processor_service.fetch_processor_types](#document_processor_service.fetch_processor_types) + * [Document_processor_service.get_evaluation](#document_processor_service.get_evaluation) * [Document_processor_service.get_processor](#document_processor_service.get_processor) * [Document_processor_service.get_processor_version](#document_processor_service.get_processor_version) + * [Document_processor_service.list_evaluations](#document_processor_service.list_evaluations) * [Document_processor_service.list_processor_types](#document_processor_service.list_processor_types) * [Document_processor_service.list_processor_versions](#document_processor_service.list_processor_versions) * [Document_processor_service.list_processors](#document_processor_service.list_processors) * [Document_processor_service.process_document](#document_processor_service.process_document) * [Document_processor_service.review_document](#document_processor_service.review_document) * [Document_processor_service.set_default_processor_version](#document_processor_service.set_default_processor_version) + * [Document_processor_service.train_processor_version](#document_processor_service.train_processor_version) * [Document_processor_service.undeploy_processor_version](#document_processor_service.undeploy_processor_version) * [Quickstart](#quickstart) * [Quickstart.test](#quickstart.test) @@ -526,6 +530,23 @@ __Usage:__ +### Document_processor_service.evaluate_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js` + + +----- + + + + ### Document_processor_service.fetch_processor_types View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js). @@ -543,6 +564,23 @@ __Usage:__ +### Document_processor_service.get_evaluation + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_evaluation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_evaluation.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_evaluation.js` + + +----- + + + + ### Document_processor_service.get_processor View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_processor.js). @@ -577,6 +615,23 @@ __Usage:__ +### Document_processor_service.list_evaluations + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_evaluations.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_evaluations.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_evaluations.js` + + +----- + + + + ### Document_processor_service.list_processor_types View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_processor_types.js). @@ -679,6 +734,23 @@ __Usage:__ +### Document_processor_service.train_processor_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.train_processor_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.train_processor_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.train_processor_version.js` + + +----- + + + + ### Document_processor_service.undeploy_processor_version View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.undeploy_processor_version.js). diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js new file mode 100644 index 00000000000..e6af3689920 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(processorVersion) { + // [START documentai_v1beta3_generated_DocumentProcessorService_EvaluateProcessorVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ProcessorVersion google.cloud.documentai.v1beta3.ProcessorVersion to evaluate. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + */ + // const processorVersion = 'abc123' + /** + * Optional. The documents used in the evaluation. If unspecified, use the processor's + * dataset as evaluation input. + */ + // const evaluationDocuments = {} + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callEvaluateProcessorVersion() { + // Construct request + const request = { + processorVersion, + }; + + // Run request + const [operation] = await documentaiClient.evaluateProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callEvaluateProcessorVersion(); + // [END documentai_v1beta3_generated_DocumentProcessorService_EvaluateProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_evaluation.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_evaluation.js new file mode 100644 index 00000000000..7414abc0a9d --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.get_evaluation.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START documentai_v1beta3_generated_DocumentProcessorService_GetEvaluation_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Evaluation google.cloud.documentai.v1beta3.Evaluation to get. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}` + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callGetEvaluation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await documentaiClient.getEvaluation(request); + console.log(response); + } + + callGetEvaluation(); + // [END documentai_v1beta3_generated_DocumentProcessorService_GetEvaluation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_evaluations.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_evaluations.js new file mode 100644 index 00000000000..05b206dc802 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.list_evaluations.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START documentai_v1beta3_generated_DocumentProcessorService_ListEvaluations_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the ProcessorVersion google.cloud.documentai.v1beta3.ProcessorVersion to list evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + */ + // const parent = 'abc123' + /** + * The standard list page size. + * If unspecified, at most 5 evaluations will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListEvaluations` call. + * Provide this to retrieve the subsequent page. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListEvaluations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listEvaluationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEvaluations(); + // [END documentai_v1beta3_generated_DocumentProcessorService_ListEvaluations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js index 1a6657cabc9..b64abecbc4c 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.process_document.js @@ -56,6 +56,8 @@ function main(name) { // const skipHumanReview = true /** * Specifies which fields to include in ProcessResponse's document. + * Only supports top level document and pages field so it must be in the form + * of `{document_field_name}` or `pages.{page_field_name}`. */ // const fieldMask = {} diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.train_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.train_processor_version.js new file mode 100644 index 00000000000..24015f9da1a --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/document_processor_service.train_processor_version.js @@ -0,0 +1,82 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, processorVersion) { + // [START documentai_v1beta3_generated_DocumentProcessorService_TrainProcessorVersion_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project, location and processor) to create the new version for. + * Format: `projects/{project}/locations/{location}/processors/{processor}`. + */ + // const parent = 'abc123' + /** + * Required. The processor version to be created. + */ + // const processorVersion = {} + /** + * Optional. The schema the processor version will be trained with. + */ + // const documentSchema = {} + /** + * Optional. The input data used to train the `ProcessorVersion`. + */ + // const inputData = {} + /** + * 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}`. + */ + // const baseProcessorVersion = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1beta3; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callTrainProcessorVersion() { + // Construct request + const request = { + parent, + processorVersion, + }; + + // Run request + const [operation] = await documentaiClient.trainProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callTrainProcessorVersion(); + // [END documentai_v1beta3_generated_DocumentProcessorService_TrainProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json index bd2acbac3df..ab0ad8ef8f7 100644 --- a/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 79, + "end": 81, "type": "FULL" } ], @@ -307,6 +307,62 @@ } } }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_TrainProcessorVersion_async", + "title": "DocumentProcessorService trainProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Trains a new processor version. Operation metadata is returned as cloud_documentai_core.TrainProcessorVersionMetadata.", + "canonical": true, + "file": "document_processor_service.train_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TrainProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.TrainProcessorVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "processor_version", + "type": ".google.cloud.documentai.v1beta3.ProcessorVersion" + }, + { + "name": "document_schema", + "type": ".google.cloud.documentai.v1beta3.DocumentSchema" + }, + { + "name": "input_data", + "type": ".google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData" + }, + { + "name": "base_processor_version", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "TrainProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.TrainProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, { "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_GetProcessorVersion_async", "title": "DocumentProcessorService getProcessorVersion Sample", @@ -782,6 +838,138 @@ } } } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_EvaluateProcessorVersion_async", + "title": "DocumentProcessorService evaluateProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Evaluates a ProcessorVersion against annotated documents, producing an Evaluation.", + "canonical": true, + "file": "document_processor_service.evaluate_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "EvaluateProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.EvaluateProcessorVersion", + "async": true, + "parameters": [ + { + "name": "processor_version", + "type": "TYPE_STRING" + }, + { + "name": "evaluation_documents", + "type": ".google.cloud.documentai.v1beta3.BatchDocumentsInputConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "EvaluateProcessorVersion", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.EvaluateProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_GetEvaluation_async", + "title": "DocumentProcessorService getEvaluation Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a specific evaluation.", + "canonical": true, + "file": "document_processor_service.get_evaluation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEvaluation", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.GetEvaluation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.Evaluation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "GetEvaluation", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.GetEvaluation", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ListEvaluations_async", + "title": "DocumentProcessorService listEvaluations Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a set of evaluations for a given processor version.", + "canonical": true, + "file": "document_processor_service.list_evaluations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEvaluations", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListEvaluations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.ListEvaluationsResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListEvaluations", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListEvaluations", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } } ] } \ No newline at end of file diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts index 33fffdda1f0..a1045c0d373 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client.ts @@ -130,8 +130,11 @@ export class DocumentProcessorServiceClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - // If scopes are unset in options set scopes. - if (!('scopes' in opts)) { + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -158,6 +161,10 @@ export class DocumentProcessorServiceClient { // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, opts diff --git a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts index edd67bc8609..0e5f2654c67 100644 --- a/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta1/document_understanding_service_client.ts @@ -123,8 +123,11 @@ export class DocumentUnderstandingServiceClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - // If scopes are unset in options set scopes. - if (!('scopes' in opts)) { + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -151,6 +154,11 @@ export class DocumentUnderstandingServiceClient { // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { diff --git a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts index 295893caf18..9b8023969d9 100644 --- a/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta2/document_understanding_service_client.ts @@ -123,8 +123,11 @@ export class DocumentUnderstandingServiceClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - // If scopes are unset in options set scopes. - if (!('scopes' in opts)) { + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -151,6 +154,11 @@ export class DocumentUnderstandingServiceClient { // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts index 230e98be983..8f17822972f 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client.ts @@ -130,8 +130,11 @@ export class DocumentProcessorServiceClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - // If scopes are unset in options set scopes. - if (!('scopes' in opts)) { + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } @@ -158,6 +161,10 @@ export class DocumentProcessorServiceClient { // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, opts @@ -185,6 +192,9 @@ export class DocumentProcessorServiceClient { // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { + evaluationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}' + ), humanReviewConfigPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig' ), @@ -224,6 +234,11 @@ export class DocumentProcessorServiceClient { 'nextPageToken', 'processorVersions' ), + listEvaluations: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'evaluations' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -285,6 +300,12 @@ export class DocumentProcessorServiceClient { const batchProcessDocumentsMetadata = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta3.BatchProcessMetadata' ) as gax.protobuf.Type; + const trainProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse' + ) as gax.protobuf.Type; + const trainProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata' + ) as gax.protobuf.Type; const deleteProcessorVersionResponse = protoFilesRoot.lookup( '.google.protobuf.Empty' ) as gax.protobuf.Type; @@ -333,6 +354,12 @@ export class DocumentProcessorServiceClient { const reviewDocumentMetadata = protoFilesRoot.lookup( '.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata' ) as gax.protobuf.Type; + const evaluateProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse' + ) as gax.protobuf.Type; + const evaluateProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata' + ) as gax.protobuf.Type; this.descriptors.longrunning = { batchProcessDocuments: new this._gaxModule.LongrunningDescriptor( @@ -342,6 +369,13 @@ export class DocumentProcessorServiceClient { ), batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) ), + trainProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + trainProcessorVersionResponse.decode.bind( + trainProcessorVersionResponse + ), + trainProcessorVersionMetadata.decode.bind(trainProcessorVersionMetadata) + ), deleteProcessorVersion: new this._gaxModule.LongrunningDescriptor( this.operationsClient, deleteProcessorVersionResponse.decode.bind( @@ -398,6 +432,15 @@ export class DocumentProcessorServiceClient { reviewDocumentResponse.decode.bind(reviewDocumentResponse), reviewDocumentMetadata.decode.bind(reviewDocumentMetadata) ), + evaluateProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + evaluateProcessorVersionResponse.decode.bind( + evaluateProcessorVersionResponse + ), + evaluateProcessorVersionMetadata.decode.bind( + evaluateProcessorVersionMetadata + ) + ), }; // Put together the default options sent with requests. @@ -457,6 +500,7 @@ export class DocumentProcessorServiceClient { 'listProcessorTypes', 'listProcessors', 'getProcessor', + 'trainProcessorVersion', 'getProcessorVersion', 'listProcessorVersions', 'deleteProcessorVersion', @@ -468,6 +512,9 @@ export class DocumentProcessorServiceClient { 'disableProcessor', 'setDefaultProcessorVersion', 'reviewDocument', + 'evaluateProcessorVersion', + 'getEvaluation', + 'listEvaluations', ]; for (const methodName of documentProcessorServiceStubMethods) { const callPromise = this.documentProcessorServiceStub.then( @@ -577,6 +624,8 @@ export class DocumentProcessorServiceClient { * false. * @param {google.protobuf.FieldMask} request.fieldMask * Specifies which fields to include in ProcessResponse's document. + * Only supports top level document and pages field so it must be in the form + * of `{document_field_name}` or `pages.{page_field_name}`. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1045,6 +1094,98 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.innerApiCalls.createProcessor(request, options, callback); } + /** + * Retrieves a specific evaluation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the {@link google.cloud.documentai.v1beta3.Evaluation|Evaluation} to get. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Evaluation]{@link google.cloud.documentai.v1beta3.Evaluation}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta3/document_processor_service.get_evaluation.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_GetEvaluation_async + */ + getEvaluation( + request?: protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IEvaluation, + protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest | undefined, + {} | undefined + ] + >; + getEvaluation( + request: protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IEvaluation, + | protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEvaluation( + request: protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest, + callback: Callback< + protos.google.cloud.documentai.v1beta3.IEvaluation, + | protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEvaluation( + request?: protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1beta3.IEvaluation, + | protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1beta3.IEvaluation, + | protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IEvaluation, + protos.google.cloud.documentai.v1beta3.IGetEvaluationRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getEvaluation(request, options, callback); + } /** * LRO endpoint to batch process many documents. The output is written @@ -1200,6 +1341,157 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.BatchProcessMetadata >; } + /** + * Trains a new processor version. + * Operation metadata is returned as + * cloud_documentai_core.TrainProcessorVersionMetadata. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project, location and processor) to create the new version for. + * Format: `projects/{project}/locations/{location}/processors/{processor}`. + * @param {google.cloud.documentai.v1beta3.ProcessorVersion} request.processorVersion + * Required. The processor version to be created. + * @param {google.cloud.documentai.v1beta3.DocumentSchema} [request.documentSchema] + * Optional. The schema the processor version will be trained with. + * @param {google.cloud.documentai.v1beta3.TrainProcessorVersionRequest.InputData} [request.inputData] + * Optional. The input data used to train the `ProcessorVersion`. + * @param {string} [request.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}`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta3/document_processor_service.train_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_TrainProcessorVersion_async + */ + trainProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + trainProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + trainProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + trainProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.trainProcessorVersion(request, options, callback); + } + /** + * Check the status of the long running operation returned by `trainProcessorVersion()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta3/document_processor_service.train_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_TrainProcessorVersion_async + */ + async checkTrainProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.trainProcessorVersion, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.TrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.TrainProcessorVersionMetadata + >; + } /** * Deletes the processor version, all artifacts under the processor version * will be deleted. @@ -2340,6 +2632,153 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata >; } + /** + * Evaluates a ProcessorVersion against annotated documents, producing an + * Evaluation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.processorVersion + * Required. The resource name of the {@link google.cloud.documentai.v1beta3.ProcessorVersion|ProcessorVersion} to evaluate. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param {google.cloud.documentai.v1beta3.BatchDocumentsInputConfig} [request.evaluationDocuments] + * Optional. The documents used in the evaluation. If unspecified, use the processor's + * dataset as evaluation input. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EvaluateProcessorVersion_async + */ + evaluateProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + evaluateProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + evaluateProcessorVersion( + request: protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + evaluateProcessorVersion( + request?: protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + processor_version: request.processorVersion ?? '', + }); + this.initialize(); + return this.innerApiCalls.evaluateProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `evaluateProcessorVersion()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1beta3/document_processor_service.evaluate_processor_version.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_EvaluateProcessorVersion_async + */ + async checkEvaluateProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + > + > { + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.evaluateProcessorVersion, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1beta3.EvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.EvaluateProcessorVersionMetadata + >; + } /** * Lists the processor types that exist. * @@ -2943,6 +3382,207 @@ export class DocumentProcessorServiceClient { callSettings ) as AsyncIterable; } + /** + * Retrieves a set of evaluations for a given processor version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.documentai.v1beta3.ProcessorVersion|ProcessorVersion} to list evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param {number} request.pageSize + * The standard list page size. + * If unspecified, at most 5 evaluations will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * A page token, received from a previous `ListEvaluations` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Evaluation]{@link google.cloud.documentai.v1beta3.Evaluation}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listEvaluationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEvaluations( + request?: protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IEvaluation[], + protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest | null, + protos.google.cloud.documentai.v1beta3.IListEvaluationsResponse + ] + >; + listEvaluations( + request: protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + | protos.google.cloud.documentai.v1beta3.IListEvaluationsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IEvaluation + > + ): void; + listEvaluations( + request: protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + | protos.google.cloud.documentai.v1beta3.IListEvaluationsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IEvaluation + > + ): void; + listEvaluations( + request?: protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + | protos.google.cloud.documentai.v1beta3.IListEvaluationsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IEvaluation + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + | protos.google.cloud.documentai.v1beta3.IListEvaluationsResponse + | null + | undefined, + protos.google.cloud.documentai.v1beta3.IEvaluation + > + ): Promise< + [ + protos.google.cloud.documentai.v1beta3.IEvaluation[], + protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest | null, + protos.google.cloud.documentai.v1beta3.IListEvaluationsResponse + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listEvaluations(request, options, callback); + } + + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.documentai.v1beta3.ProcessorVersion|ProcessorVersion} to list evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param {number} request.pageSize + * The standard list page size. + * If unspecified, at most 5 evaluations will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * A page token, received from a previous `ListEvaluations` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Evaluation]{@link google.cloud.documentai.v1beta3.Evaluation} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listEvaluationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listEvaluationsStream( + request?: protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEvaluations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEvaluations.createStream( + this.innerApiCalls.listEvaluations as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listEvaluations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.documentai.v1beta3.ProcessorVersion|ProcessorVersion} to list evaluations for. + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param {number} request.pageSize + * The standard list page size. + * If unspecified, at most 5 evaluations will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * A page token, received from a previous `ListEvaluations` call. + * Provide this to retrieve the subsequent page. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Evaluation]{@link google.cloud.documentai.v1beta3.Evaluation}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1beta3/document_processor_service.list_evaluations.js + * region_tag:documentai_v1beta3_generated_DocumentProcessorService_ListEvaluations_async + */ + listEvaluationsAsync( + request?: protos.google.cloud.documentai.v1beta3.IListEvaluationsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listEvaluations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEvaluations.asyncIterate( + this.innerApiCalls['listEvaluations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } /** * Gets information about a location. * @@ -3204,6 +3844,92 @@ export class DocumentProcessorServiceClient { // -- Path templates -- // -------------------- + /** + * Return a fully-qualified evaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor + * @param {string} processor_version + * @param {string} evaluation + * @returns {string} Resource name string. + */ + evaluationPath( + project: string, + location: string, + processor: string, + processorVersion: string, + evaluation: string + ) { + return this.pathTemplates.evaluationPathTemplate.render({ + project: project, + location: location, + processor: processor, + processor_version: processorVersion, + evaluation: evaluation, + }); + } + + /** + * Parse the project from Evaluation resource. + * + * @param {string} evaluationName + * A fully-qualified path representing Evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromEvaluationName(evaluationName: string) { + return this.pathTemplates.evaluationPathTemplate.match(evaluationName) + .project; + } + + /** + * Parse the location from Evaluation resource. + * + * @param {string} evaluationName + * A fully-qualified path representing Evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromEvaluationName(evaluationName: string) { + return this.pathTemplates.evaluationPathTemplate.match(evaluationName) + .location; + } + + /** + * Parse the processor from Evaluation resource. + * + * @param {string} evaluationName + * A fully-qualified path representing Evaluation resource. + * @returns {string} A string representing the processor. + */ + matchProcessorFromEvaluationName(evaluationName: string) { + return this.pathTemplates.evaluationPathTemplate.match(evaluationName) + .processor; + } + + /** + * Parse the processor_version from Evaluation resource. + * + * @param {string} evaluationName + * A fully-qualified path representing Evaluation resource. + * @returns {string} A string representing the processor_version. + */ + matchProcessorVersionFromEvaluationName(evaluationName: string) { + return this.pathTemplates.evaluationPathTemplate.match(evaluationName) + .processor_version; + } + + /** + * Parse the evaluation from Evaluation resource. + * + * @param {string} evaluationName + * A fully-qualified path representing Evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromEvaluationName(evaluationName: string) { + return this.pathTemplates.evaluationPathTemplate.match(evaluationName) + .evaluation; + } + /** * Return a fully-qualified humanReviewConfig resource name string. * diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json index 7f6b23b7082..2ed5da479a8 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_client_config.json @@ -46,6 +46,10 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "TrainProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "GetProcessorVersion": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" @@ -90,6 +94,18 @@ "timeout_millis": 120000, "retry_codes_name": "idempotent", "retry_params_name": "default" + }, + "EvaluateProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetEvaluation": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListEvaluations": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json index 8264c6d698a..673527d6d32 100644 --- a/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json +++ b/packages/google-cloud-documentai/src/v1beta3/document_processor_service_proto_list.json @@ -4,6 +4,7 @@ "../../protos/google/cloud/documentai/v1beta3/document_io.proto", "../../protos/google/cloud/documentai/v1beta3/document_processor_service.proto", "../../protos/google/cloud/documentai/v1beta3/document_schema.proto", + "../../protos/google/cloud/documentai/v1beta3/evaluation.proto", "../../protos/google/cloud/documentai/v1beta3/geometry.proto", "../../protos/google/cloud/documentai/v1beta3/operation_metadata.proto", "../../protos/google/cloud/documentai/v1beta3/processor.proto", diff --git a/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json b/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json index 120820fcb8e..5252ce974c5 100644 --- a/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json +++ b/packages/google-cloud-documentai/src/v1beta3/gapic_metadata.json @@ -35,11 +35,21 @@ "createProcessor" ] }, + "GetEvaluation": { + "methods": [ + "getEvaluation" + ] + }, "BatchProcessDocuments": { "methods": [ "batchProcessDocuments" ] }, + "TrainProcessorVersion": { + "methods": [ + "trainProcessorVersion" + ] + }, "DeleteProcessorVersion": { "methods": [ "deleteProcessorVersion" @@ -80,6 +90,11 @@ "reviewDocument" ] }, + "EvaluateProcessorVersion": { + "methods": [ + "evaluateProcessorVersion" + ] + }, "ListProcessorTypes": { "methods": [ "listProcessorTypes", @@ -100,6 +115,13 @@ "listProcessorVersionsStream", "listProcessorVersionsAsync" ] + }, + "ListEvaluations": { + "methods": [ + "listEvaluations", + "listEvaluationsStream", + "listEvaluationsAsync" + ] } } }, @@ -131,11 +153,21 @@ "createProcessor" ] }, + "GetEvaluation": { + "methods": [ + "getEvaluation" + ] + }, "BatchProcessDocuments": { "methods": [ "batchProcessDocuments" ] }, + "TrainProcessorVersion": { + "methods": [ + "trainProcessorVersion" + ] + }, "DeleteProcessorVersion": { "methods": [ "deleteProcessorVersion" @@ -176,6 +208,11 @@ "reviewDocument" ] }, + "EvaluateProcessorVersion": { + "methods": [ + "evaluateProcessorVersion" + ] + }, "ListProcessorTypes": { "methods": [ "listProcessorTypes", @@ -196,6 +233,13 @@ "listProcessorVersionsStream", "listProcessorVersionsAsync" ] + }, + "ListEvaluations": { + "methods": [ + "listEvaluations", + "listEvaluationsStream", + "listEvaluationsAsync" + ] } } } diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts index 3791385f73f..e941eb82aaa 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1beta3.ts @@ -999,6 +999,148 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); + describe('getEvaluation', () => { + it('invokes getEvaluation without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetEvaluationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Evaluation() + ); + client.innerApiCalls.getEvaluation = stubSimpleCall(expectedResponse); + const [response] = await client.getEvaluation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEvaluation without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetEvaluationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Evaluation() + ); + client.innerApiCalls.getEvaluation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEvaluation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1beta3.IEvaluation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEvaluation with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetEvaluationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEvaluation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getEvaluation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEvaluation with closed client', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.GetEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.GetEvaluationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEvaluation(request), expectedError); + }); + }); + describe('batchProcessDocuments', () => { it('invokes batchProcessDocuments without error', async () => { const client = @@ -1214,8 +1356,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); - describe('deleteProcessorVersion', () => { - it('invokes deleteProcessorVersion without error', async () => { + describe('trainProcessorVersion', () => { + it('invokes trainProcessorVersion without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1225,33 +1367,33 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() + new protos.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', - ['name'] + '.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest', + ['parent'] ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteProcessorVersion = + client.innerApiCalls.trainProcessorVersion = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteProcessorVersion(request); + const [operation] = await client.trainProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.deleteProcessorVersion as SinonStub + client.innerApiCalls.trainProcessorVersion as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProcessorVersion as SinonStub + client.innerApiCalls.trainProcessorVersion as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes deleteProcessorVersion without error using callback', async () => { + it('invokes trainProcessorVersion without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1261,27 +1403,27 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() + new protos.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', - ['name'] + '.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest', + ['parent'] ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deleteProcessorVersion = + client.innerApiCalls.trainProcessorVersion = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.deleteProcessorVersion( + client.trainProcessorVersion( request, ( err?: Error | null, result?: LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata > | null ) => { if (err) { @@ -1293,22 +1435,22 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.protobuf.IEmpty, - protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.ITrainProcessorVersionMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.deleteProcessorVersion as SinonStub + client.innerApiCalls.trainProcessorVersion as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProcessorVersion as SinonStub + client.innerApiCalls.trainProcessorVersion as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes deleteProcessorVersion with call error', async () => { + it('invokes trainProcessorVersion with call error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1318,34 +1460,34 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() + new protos.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', - ['name'] + '.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest', + ['parent'] ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( + client.innerApiCalls.trainProcessorVersion = stubLongRunningCall( undefined, expectedError ); await assert.rejects( - client.deleteProcessorVersion(request), + client.trainProcessorVersion(request), expectedError ); const actualRequest = ( - client.innerApiCalls.deleteProcessorVersion as SinonStub + client.innerApiCalls.trainProcessorVersion as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProcessorVersion as SinonStub + client.innerApiCalls.trainProcessorVersion as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes deleteProcessorVersion with LRO error', async () => { + it('invokes trainProcessorVersion with LRO error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1355,33 +1497,33 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() + new protos.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', - ['name'] + '.google.cloud.documentai.v1beta3.TrainProcessorVersionRequest', + ['parent'] ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( + client.innerApiCalls.trainProcessorVersion = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.deleteProcessorVersion(request); + const [operation] = await client.trainProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( - client.innerApiCalls.deleteProcessorVersion as SinonStub + client.innerApiCalls.trainProcessorVersion as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.deleteProcessorVersion as SinonStub + client.innerApiCalls.trainProcessorVersion as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkDeleteProcessorVersionProgress without error', async () => { + it('invokes checkTrainProcessorVersionProgress without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1398,7 +1540,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteProcessorVersionProgress( + const decodedOperation = await client.checkTrainProcessorVersionProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -1406,7 +1548,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkDeleteProcessorVersionProgress with error', async () => { + it('invokes checkTrainProcessorVersionProgress with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1422,15 +1564,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedError ); await assert.rejects( - client.checkDeleteProcessorVersionProgress(''), + client.checkTrainProcessorVersionProgress(''), expectedError ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('deployProcessorVersion', () => { - it('invokes deployProcessorVersion without error', async () => { + describe('deleteProcessorVersion', () => { + it('invokes deleteProcessorVersion without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1440,10 +1582,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', ['name'] ); request.name = defaultValue1; @@ -1451,22 +1593,22 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deployProcessorVersion = + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall(expectedResponse); - const [operation] = await client.deployProcessorVersion(request); + const [operation] = await client.deleteProcessorVersion(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.deployProcessorVersion as SinonStub + client.innerApiCalls.deleteProcessorVersion as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.deployProcessorVersion as SinonStub + client.innerApiCalls.deleteProcessorVersion as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes deployProcessorVersion without error using callback', async () => { + it('invokes deleteProcessorVersion without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1476,10 +1618,10 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', ['name'] ); request.name = defaultValue1; @@ -1487,16 +1629,16 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const expectedResponse = generateSampleMessage( new protos.google.longrunning.Operation() ); - client.innerApiCalls.deployProcessorVersion = + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.deployProcessorVersion( + client.deleteProcessorVersion( request, ( err?: Error | null, result?: LROperation< - protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, - protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata > | null ) => { if (err) { @@ -1508,22 +1650,22 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); const operation = (await promise) as LROperation< - protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, - protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1beta3.IDeleteProcessorVersionMetadata >; const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.deployProcessorVersion as SinonStub + client.innerApiCalls.deleteProcessorVersion as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.deployProcessorVersion as SinonStub + client.innerApiCalls.deleteProcessorVersion as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes deployProcessorVersion with call error', async () => { + it('invokes deleteProcessorVersion with call error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1533,34 +1675,34 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', ['name'] ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( undefined, expectedError ); await assert.rejects( - client.deployProcessorVersion(request), + client.deleteProcessorVersion(request), expectedError ); const actualRequest = ( - client.innerApiCalls.deployProcessorVersion as SinonStub + client.innerApiCalls.deleteProcessorVersion as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.deployProcessorVersion as SinonStub + client.innerApiCalls.deleteProcessorVersion as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes deployProcessorVersion with LRO error', async () => { + it('invokes deleteProcessorVersion with LRO error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1570,33 +1712,33 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() + new protos.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + '.google.cloud.documentai.v1beta3.DeleteProcessorVersionRequest', ['name'] ); request.name = defaultValue1; const expectedHeaderRequestParams = `name=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( undefined, undefined, expectedError ); - const [operation] = await client.deployProcessorVersion(request); + const [operation] = await client.deleteProcessorVersion(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( - client.innerApiCalls.deployProcessorVersion as SinonStub + client.innerApiCalls.deleteProcessorVersion as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.deployProcessorVersion as SinonStub + client.innerApiCalls.deleteProcessorVersion as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes checkDeployProcessorVersionProgress without error', async () => { + it('invokes checkDeleteProcessorVersionProgress without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1613,7 +1755,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeployProcessorVersionProgress( + const decodedOperation = await client.checkDeleteProcessorVersionProgress( expectedResponse.name ); assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); @@ -1621,7 +1763,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkDeployProcessorVersionProgress with error', async () => { + it('invokes checkDeleteProcessorVersionProgress with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1637,15 +1779,15 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { expectedError ); await assert.rejects( - client.checkDeployProcessorVersionProgress(''), + client.checkDeleteProcessorVersionProgress(''), expectedError ); assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); - describe('undeployProcessorVersion', () => { - it('invokes undeployProcessorVersion without error', async () => { + describe('deployProcessorVersion', () => { + it('invokes deployProcessorVersion without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -1655,10 +1797,225 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() + new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest', + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deployProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deployProcessorVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deployProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deployProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deployProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IDeployProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deployProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deployProcessorVersion(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deployProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.DeployProcessorVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deployProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeployProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeployProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeployProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkDeployProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('undeployProcessorVersion', () => { + it('invokes undeployProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.UndeployProcessorVersionRequest', ['name'] ); request.name = defaultValue1; @@ -2924,8 +3281,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); - describe('listProcessorTypes', () => { - it('invokes listProcessorTypes without error', async () => { + describe('evaluateProcessorVersion', () => { + it('invokes evaluateProcessorVersion without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -2935,40 +3292,33 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + new protos.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', - ['parent'] + '.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest', + ['processorVersion'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorType() - ), - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorType() - ), - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorType() - ), - ]; - client.innerApiCalls.listProcessorTypes = - stubSimpleCall(expectedResponse); - const [response] = await client.listProcessorTypes(request); + request.processorVersion = defaultValue1; + const expectedHeaderRequestParams = `processor_version=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.evaluateProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.evaluateProcessorVersion(request); + const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listProcessorTypes as SinonStub + client.innerApiCalls.evaluateProcessorVersion as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listProcessorTypes as SinonStub + client.innerApiCalls.evaluateProcessorVersion as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listProcessorTypes without error using callback', async () => { + it('invokes evaluateProcessorVersion without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -2978,21 +3328,244 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + new protos.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', - ['parent'] + '.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest', + ['processorVersion'] ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorType() - ), - generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorType() - ), + request.processorVersion = defaultValue1; + const expectedHeaderRequestParams = `processor_version=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.evaluateProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.evaluateProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionResponse, + protos.google.cloud.documentai.v1beta3.IEvaluateProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.evaluateProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.evaluateProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes evaluateProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest', + ['processorVersion'] + ); + request.processorVersion = defaultValue1; + const expectedHeaderRequestParams = `processor_version=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.evaluateProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.evaluateProcessorVersion(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.evaluateProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.evaluateProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes evaluateProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.EvaluateProcessorVersionRequest', + ['processorVersion'] + ); + request.processorVersion = defaultValue1; + const expectedHeaderRequestParams = `processor_version=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.evaluateProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.evaluateProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.evaluateProcessorVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.evaluateProcessorVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkEvaluateProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + expectedResponse.name = 'test'; + expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; + expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')}; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = + await client.checkEvaluateProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkEvaluateProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.checkEvaluateProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listProcessorTypes', () => { + it('invokes listProcessorTypes without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + ]; + client.innerApiCalls.listProcessorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listProcessorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listProcessorTypes without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorType() + ), generateSampleMessage( new protos.google.cloud.documentai.v1beta3.ProcessorType() ), @@ -3463,12 +4036,375 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - (client.descriptors.page.listProcessors.createStream as SinonStub) + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request) + ); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listProcessorsStream with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.Processor[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1beta3.Processor) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request) + ); + assert( + (client.descriptors.page.listProcessors.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listProcessors without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.Processor() + ), + ]; + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = []; + const iterable = client.listProcessorsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listProcessors with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listProcessorVersions', () => { + it('invokes listProcessorVersions without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + ]; + client.innerApiCalls.listProcessorVersions = + stubSimpleCall(expectedResponse); + const [response] = await client.listProcessorVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listProcessorVersions without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + ]; + client.innerApiCalls.listProcessorVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessorVersions( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.documentai.v1beta3.IProcessorVersion[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listProcessorVersions with error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessorVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listProcessorVersions(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listProcessorVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listProcessorVersionsStream without error', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + ), + ]; + client.descriptors.page.listProcessorVersions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1beta3.ProcessorVersion[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.documentai.v1beta3.ProcessorVersion + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) .getCall(0) - .calledWith(client.innerApiCalls.listProcessors, request) + .calledWith(client.innerApiCalls.listProcessorVersions, request) ); assert( - (client.descriptors.page.listProcessors.createStream as SinonStub) + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -3476,7 +4412,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); - it('invokes listProcessorsStream with error', async () => { + it('invokes listProcessorVersionsStream with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3486,24 +4422,26 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listProcessors.createStream = + client.descriptors.page.listProcessorVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listProcessorsStream(request); + const stream = client.listProcessorVersionsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.documentai.v1beta3.Processor[] = + const responses: protos.google.cloud.documentai.v1beta3.ProcessorVersion[] = []; stream.on( 'data', - (response: protos.google.cloud.documentai.v1beta3.Processor) => { + ( + response: protos.google.cloud.documentai.v1beta3.ProcessorVersion + ) => { responses.push(response); } ); @@ -3516,12 +4454,18 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - (client.descriptors.page.listProcessors.createStream as SinonStub) + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) .getCall(0) - .calledWith(client.innerApiCalls.listProcessors, request) + .calledWith(client.innerApiCalls.listProcessorVersions, request) ); assert( - (client.descriptors.page.listProcessors.createStream as SinonStub) + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -3529,7 +4473,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); - it('uses async iteration with listProcessors without error', async () => { + it('uses async iteration with listProcessorVersions without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3539,41 +4483,46 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.Processor() + new protos.google.cloud.documentai.v1beta3.ProcessorVersion() ), ]; - client.descriptors.page.listProcessors.asyncIterate = + client.descriptors.page.listProcessorVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = []; - const iterable = client.listProcessorsAsync(request); + const responses: protos.google.cloud.documentai.v1beta3.IProcessorVersion[] = + []; + const iterable = client.listProcessorVersionsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( ( - client.descriptors.page.listProcessors.asyncIterate as SinonStub + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -3581,7 +4530,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); - it('uses async iteration with listProcessors with error', async () => { + it('uses async iteration with listProcessorVersions with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3591,20 +4540,20 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorsRequest() + new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorsRequest', + '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listProcessors.asyncIterate = + client.descriptors.page.listProcessorVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProcessorsAsync(request); + const iterable = client.listProcessorVersionsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.documentai.v1beta3.IProcessor[] = + const responses: protos.google.cloud.documentai.v1beta3.IProcessorVersion[] = []; for await (const resource of iterable) { responses.push(resource!); @@ -3612,12 +4561,16 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); assert.deepStrictEqual( ( - client.descriptors.page.listProcessors.asyncIterate as SinonStub + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - (client.descriptors.page.listProcessors.asyncIterate as SinonStub) + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -3626,8 +4579,8 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); }); - describe('listProcessorVersions', () => { - it('invokes listProcessorVersions without error', async () => { + describe('listEvaluations', () => { + it('invokes listEvaluations without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3637,40 +4590,39 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + new protos.google.cloud.documentai.v1beta3.ListEvaluationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + '.google.cloud.documentai.v1beta3.ListEvaluationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), ]; - client.innerApiCalls.listProcessorVersions = - stubSimpleCall(expectedResponse); - const [response] = await client.listProcessorVersions(request); + client.innerApiCalls.listEvaluations = stubSimpleCall(expectedResponse); + const [response] = await client.listEvaluations(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listProcessorVersions as SinonStub + client.innerApiCalls.listEvaluations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listProcessorVersions as SinonStub + client.innerApiCalls.listEvaluations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listProcessorVersions without error using callback', async () => { + it('invokes listEvaluations without error using callback', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3680,35 +4632,33 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + new protos.google.cloud.documentai.v1beta3.ListEvaluationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + '.google.cloud.documentai.v1beta3.ListEvaluationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), ]; - client.innerApiCalls.listProcessorVersions = + client.innerApiCalls.listEvaluations = stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.listProcessorVersions( + client.listEvaluations( request, ( err?: Error | null, - result?: - | protos.google.cloud.documentai.v1beta3.IProcessorVersion[] - | null + result?: protos.google.cloud.documentai.v1beta3.IEvaluation[] | null ) => { if (err) { reject(err); @@ -3721,16 +4671,16 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const response = await promise; assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( - client.innerApiCalls.listProcessorVersions as SinonStub + client.innerApiCalls.listEvaluations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listProcessorVersions as SinonStub + client.innerApiCalls.listEvaluations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listProcessorVersions with error', async () => { + it('invokes listEvaluations with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3740,34 +4690,31 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + new protos.google.cloud.documentai.v1beta3.ListEvaluationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + '.google.cloud.documentai.v1beta3.ListEvaluationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.innerApiCalls.listProcessorVersions = stubSimpleCall( + client.innerApiCalls.listEvaluations = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.listProcessorVersions(request), - expectedError - ); + await assert.rejects(client.listEvaluations(request), expectedError); const actualRequest = ( - client.innerApiCalls.listProcessorVersions as SinonStub + client.innerApiCalls.listEvaluations as SinonStub ).getCall(0).args[0]; assert.deepStrictEqual(actualRequest, request); const actualHeaderRequestParams = ( - client.innerApiCalls.listProcessorVersions as SinonStub + client.innerApiCalls.listEvaluations as SinonStub ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - it('invokes listProcessorVersionsStream without error', async () => { + it('invokes listEvaluationsStream without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3777,36 +4724,34 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + new protos.google.cloud.documentai.v1beta3.ListEvaluationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + '.google.cloud.documentai.v1beta3.ListEvaluationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), ]; - client.descriptors.page.listProcessorVersions.createStream = + client.descriptors.page.listEvaluations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listProcessorVersionsStream(request); + const stream = client.listEvaluationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.documentai.v1beta3.ProcessorVersion[] = + const responses: protos.google.cloud.documentai.v1beta3.Evaluation[] = []; stream.on( 'data', - ( - response: protos.google.cloud.documentai.v1beta3.ProcessorVersion - ) => { + (response: protos.google.cloud.documentai.v1beta3.Evaluation) => { responses.push(response); } ); @@ -3820,18 +4765,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { const responses = await promise; assert.deepStrictEqual(responses, expectedResponse); assert( - ( - client.descriptors.page.listProcessorVersions - .createStream as SinonStub - ) + (client.descriptors.page.listEvaluations.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listProcessorVersions, request) + .calledWith(client.innerApiCalls.listEvaluations, request) ); assert( - ( - client.descriptors.page.listProcessorVersions - .createStream as SinonStub - ) + (client.descriptors.page.listEvaluations.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -3839,7 +4778,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); - it('invokes listProcessorVersionsStream with error', async () => { + it('invokes listEvaluationsStream with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3849,26 +4788,24 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + new protos.google.cloud.documentai.v1beta3.ListEvaluationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + '.google.cloud.documentai.v1beta3.ListEvaluationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listProcessorVersions.createStream = + client.descriptors.page.listEvaluations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listProcessorVersionsStream(request); + const stream = client.listEvaluationsStream(request); const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.documentai.v1beta3.ProcessorVersion[] = + const responses: protos.google.cloud.documentai.v1beta3.Evaluation[] = []; stream.on( 'data', - ( - response: protos.google.cloud.documentai.v1beta3.ProcessorVersion - ) => { + (response: protos.google.cloud.documentai.v1beta3.Evaluation) => { responses.push(response); } ); @@ -3881,18 +4818,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); await assert.rejects(promise, expectedError); assert( - ( - client.descriptors.page.listProcessorVersions - .createStream as SinonStub - ) + (client.descriptors.page.listEvaluations.createStream as SinonStub) .getCall(0) - .calledWith(client.innerApiCalls.listProcessorVersions, request) + .calledWith(client.innerApiCalls.listEvaluations, request) ); assert( - ( - client.descriptors.page.listProcessorVersions - .createStream as SinonStub - ) + (client.descriptors.page.listEvaluations.createStream as SinonStub) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -3900,7 +4831,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); - it('uses async iteration with listProcessorVersions without error', async () => { + it('uses async iteration with listEvaluations without error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3910,46 +4841,42 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + new protos.google.cloud.documentai.v1beta3.ListEvaluationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + '.google.cloud.documentai.v1beta3.ListEvaluationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedResponse = [ generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ProcessorVersion() + new protos.google.cloud.documentai.v1beta3.Evaluation() ), ]; - client.descriptors.page.listProcessorVersions.asyncIterate = + client.descriptors.page.listEvaluations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.documentai.v1beta3.IProcessorVersion[] = + const responses: protos.google.cloud.documentai.v1beta3.IEvaluation[] = []; - const iterable = client.listProcessorVersionsAsync(request); + const iterable = client.listEvaluationsAsync(request); for await (const resource of iterable) { responses.push(resource!); } assert.deepStrictEqual(responses, expectedResponse); assert.deepStrictEqual( ( - client.descriptors.page.listProcessorVersions - .asyncIterate as SinonStub + client.descriptors.page.listEvaluations.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - ( - client.descriptors.page.listProcessorVersions - .asyncIterate as SinonStub - ) + (client.descriptors.page.listEvaluations.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -3957,7 +4884,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); }); - it('uses async iteration with listProcessorVersions with error', async () => { + it('uses async iteration with listEvaluations with error', async () => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -3967,20 +4894,20 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { ); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest() + new protos.google.cloud.documentai.v1beta3.ListEvaluationsRequest() ); const defaultValue1 = getTypeDefaultValue( - '.google.cloud.documentai.v1beta3.ListProcessorVersionsRequest', + '.google.cloud.documentai.v1beta3.ListEvaluationsRequest', ['parent'] ); request.parent = defaultValue1; const expectedHeaderRequestParams = `parent=${defaultValue1}`; const expectedError = new Error('expected'); - client.descriptors.page.listProcessorVersions.asyncIterate = + client.descriptors.page.listEvaluations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProcessorVersionsAsync(request); + const iterable = client.listEvaluationsAsync(request); await assert.rejects(async () => { - const responses: protos.google.cloud.documentai.v1beta3.IProcessorVersion[] = + const responses: protos.google.cloud.documentai.v1beta3.IEvaluation[] = []; for await (const resource of iterable) { responses.push(resource!); @@ -3988,16 +4915,12 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); assert.deepStrictEqual( ( - client.descriptors.page.listProcessorVersions - .asyncIterate as SinonStub + client.descriptors.page.listEvaluations.asyncIterate as SinonStub ).getCall(0).args[1], request ); assert( - ( - client.descriptors.page.listProcessorVersions - .asyncIterate as SinonStub - ) + (client.descriptors.page.listEvaluations.asyncIterate as SinonStub) .getCall(0) .args[2].otherArgs.headers['x-goog-request-params'].includes( expectedHeaderRequestParams @@ -4558,6 +5481,97 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { }); describe('Path templates', () => { + describe('evaluation', () => { + const fakePath = '/rendered/path/evaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + processor_version: 'processorVersionValue', + evaluation: 'evaluationValue', + }; + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + client.pathTemplates.evaluationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.evaluationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('evaluationPath', () => { + const result = client.evaluationPath( + 'projectValue', + 'locationValue', + 'processorValue', + 'processorVersionValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.evaluationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromEvaluationName', () => { + const result = client.matchProjectFromEvaluationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.evaluationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromEvaluationName', () => { + const result = client.matchLocationFromEvaluationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.evaluationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorFromEvaluationName', () => { + const result = client.matchProcessorFromEvaluationName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.evaluationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorVersionFromEvaluationName', () => { + const result = client.matchProcessorVersionFromEvaluationName(fakePath); + assert.strictEqual(result, 'processorVersionValue'); + assert( + (client.pathTemplates.evaluationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromEvaluationName', () => { + const result = client.matchEvaluationFromEvaluationName(fakePath); + assert.strictEqual(result, 'evaluationValue'); + assert( + (client.pathTemplates.evaluationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('humanReviewConfig', () => { const fakePath = '/rendered/path/humanReviewConfig'; const expectedParameters = {